Skip to content

Follow-ups: Rosetta x86 / multi-platform cleanup (deferred from #279, #54) #283

Description

@rgarcia

Deferred, non-blocking cleanup opportunities identified during review of the Rosetta x86 / multi-platform PRs (#279, kernel/hypeman-cli#54). None affect behavior; they were intentionally left out to keep those PRs reviewable. Two are marked inline with TODO(followup) and link here.

hypeman (server)

  • Unify Resolve / ResolveForPlatform (lib/images/reference.go) — near-duplicate methods differing only by platform-aware vs platform-less manifest inspection; collapse behind one path. (inline TODO(followup))
  • createAndQueueImage re-resolves the platform (lib/images/manager.go) — CreateImage already parsed/validated the platform; pass it in instead of calling resolveRequestPlatform again, which also removes the effectively-unreachable error branch. (inline TODO(followup))
  • ResolvedRef.DigestRef() helper — replace hand-assembled repo + "@" + digest strings with a method on ResolvedRef.
  • conversionFailedErr(msg) helper — extract the 3 duplicated WaitForReady failure-message branches in lib/images/manager.go.
  • Single source of truth for the rate-limit user message — one package const, or fold the actionable hint into ErrRateLimited and use err.Error() in the handlers (cmd/api/api/{images,instances}.go).
  • Tests: assertFailsFastNotFound helper for the two structurally identical fail-fast restore tests; a generic captureManager[Req] to collapse the 4 near-identical capture mocks (cmd/api/api/instances_test.go).

hypeman-cli

  • Drop the platform WithJSONSet / RawJSON workarounds once the hypeman-go SDK exposes a typed platform field — inspect/image list/run/pull can then read the typed field directly. Marked inline with TODO(sdk-bump:...).

Filed from the reviewer cleanup pass; see the discussion on #279.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions