Skip to content

fix(branching): ignore profile sticky branch when --url targets another server (#171) - #185

Merged
thomaschristory merged 2 commits into
mainfrom
fix/profile-branch-url-override
Oct 23, 2026
Merged

thomaschristory merged 2 commits into
mainfrom
fix/profile-branch-url-override

Conversation

@thomaschristory

Copy link
Copy Markdown
Owner

Closes #171

  • resolve_branch_selection drops the profile's branch: when --url/NSC_URL differs from the profile URL. Both are normalised with HttpUrl, so a trailing slash or a different host case still counts as the same server. --branch and NSC_BRANCH still apply.
  • The duplicated profile lookup is replaced by _select_base_profile.
  • Docs (branching.md, managing-profiles.md) and the CHANGELOG are updated.

Tests: new cases in tests/cli/test_runtime_branch.py (different server via flag and env, same server in three spellings, explicit branch with an override). Full suite: 1572 passed. Manual check: nsc --url <other> branch current reports source: null.

🤖 Generated with Claude Code

… another server (#171)

resolve_branch_selection applied the profile's branch even when --url or
NSC_URL pointed at a different NetBox, failing with not_found there. The
profile branch is now dropped when the URL override differs from the
profile URL (normalised; trailing slash and host case ignored). --branch and
NSC_BRANCH still apply. Reuses _select_base_profile instead of duplicating
the profile lookup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ile branch is ignored

Review follow-ups for #171: nsc branch use / create --use wrote or cleared
the profile's sticky branch while --url/NSC_URL targeted another server.
They now fail with a config error before any write. When the profile branch
is dropped because of a URL override, a one-line stderr notice says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thomaschristory

Copy link
Copy Markdown
Owner Author

Adversarial review addressed. Fixed: branch use / create --use now refuse to write the profile branch while a URL override targets another server (this existed before, but contradicted the new rule); a stderr notice is printed when the profile branch is ignored; added a path-prefix test. Filed separately: invalid --url crashes with an internal error (existed before this PR).

@thomaschristory
thomaschristory merged commit e306138 into main Oct 23, 2026
15 checks passed
@thomaschristory
thomaschristory deleted the fix/profile-branch-url-override branch October 23, 2026 14:20
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.

Sticky profile branch still applies when --url points at another server

1 participant