Skip to content

Skip image registry checks for Hub commands#115

Merged
ptone merged 1 commit intoGoogleCloudPlatform:mainfrom
mfreeman451:fix/hub-auth-without-image-registry
Apr 11, 2026
Merged

Skip image registry checks for Hub commands#115
ptone merged 1 commit intoGoogleCloudPlatform:mainfrom
mfreeman451:fix/hub-auth-without-image-registry

Conversation

@mfreeman451
Copy link
Copy Markdown
Contributor

Summary

  • skip image_registry preflight validation for the scion hub command tree
  • keep container-launch commands gated on image_registry as before
  • add a regression test for scion hub auth login in a clean global setup

Testing

  • go test ./cmd -run 'Test(HubAuthLoginDoesNotRequireImageRegistry|FormatFlagCheck|DevAuthWarning|NonInteractiveImpliesAutoConfirm)$'\n

Copy link
Copy Markdown
Contributor Author

@mfreeman451 mfreeman451 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mfreeman451 mfreeman451 marked this pull request as ready for review April 10, 2026 01:03
@mfreeman451 mfreeman451 force-pushed the fix/hub-auth-without-image-registry branch from 3659c83 to 1cdcf88 Compare April 10, 2026 01:11
@mfreeman451 mfreeman451 force-pushed the fix/hub-auth-without-image-registry branch from 1cdcf88 to 5002b18 Compare April 11, 2026 05:15
@ptone
Copy link
Copy Markdown
Member

ptone commented Apr 11, 2026

PR #115: Skip image registry checks for Hub commands

Executive Summary

Low-risk, well-scoped fix that exempts the entire hub command subtree from image_registry preflight validation, fixing a bug where scion hub auth login would fail in a clean global setup. The implementation is correct and introduces a clean helper function with an appropriate regression test.

Critical Issues

None.

Observations

1. Consolidation opportunity for the config subtree check (Minor)

The old code used parentName == "config" (single-level check). The PR replaces it with commandInSubtree(cmd, "config") which walks the full ancestry — a strict improvement. However, there is now a redundancy: the switch on line 144–146 already handles cmdName == "config" (the config root itself), while commandInSubtree also matches when current.Name() == "config" for the config root. This is harmless (it just sets requiresRegistry = false twice) but could be noted for future cleanup.

2. commandInSubtree also matches the root command name

commandInSubtree walks all the way to the root (whose Name() is typically "scion"). If a future developer adds a top-level command named "hub", it would be indistinguishable from the subtree hub. This is a non-issue today given the existing command tree structure, but worth noting as a design caveat.

3. Test relies on package-level global state (Acceptable)

The test manually saves/restores 8 package-level variables. This pattern already exists in the codebase (TestDevAuthWarning, TestFormatFlagCheck) so it is consistent. The defer restore block is correct.

4. Test does not verify the negative case

The test confirms hub auth login does not require image registry, but does not assert that a command that should require it still fails without one. This is covered by existing tests, so not blocking, but a paired negative assertion would strengthen the regression test.

Positive Feedback

  • commandInSubtree helper is a clean, reusable utility — better than the previous single-level parentName comparison. It correctly handles arbitrary nesting depth.
  • The PR description includes an exact go test invocation, making verification easy.
  • The test sets up a realistic minimal environment (temp HOME, global mode, hub endpoint) rather than mocking, which catches integration-level regressions.
  • The change is minimal and surgical — only the lines that matter are touched.

Final Verdict

Approve. The change is correct, minimal, well-tested, and introduces no security or performance concerns. Ship it.

@ptone ptone merged commit 1f493b8 into GoogleCloudPlatform:main Apr 11, 2026
1 check passed
scion-gteam bot pushed a commit to ptone/scion that referenced this pull request Apr 12, 2026
skip image_registry preflight validation for the scion hub command tree
keep container-launch commands gated on image_registry as before
add a regression test for scion hub auth login in a clean global setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants