Skip to content

fix(branching): root-only --branch; JSON envelopes for saved-filter branch failures - #177

Merged
thomaschristory merged 2 commits into
mainfrom
fix/branching-flag-and-saved-filter-errors
Oct 22, 2026
Merged

thomaschristory merged 2 commits into
mainfrom
fix/branching-flag-and-saved-filter-errors

Conversation

@thomaschristory

Copy link
Copy Markdown
Owner

Summary

  • Global --branch is picked up even when it appears after the subcommand #170: _extract_global_overrides scanned the whole argv, so --branch after the subcommand (for example the Branching plugin's own changes list --branch filter) switched the whole invocation into that branch. --branch is now taken as global only before the first subcommand. Other global flags (-o, --profile, …) keep scanning anywhere, as before.
  • Branch failure during --saved filter loading ignores -o json #173: a BranchError raised while resolving --saved filters (outside the handler's try) fell through to main()'s catch-all, which always renders TABLE. It is now caught at the call site and emitted with map_error, using the requested -o format and including details.branch.
  • The branching guide notes that --branch goes before the subcommand. CHANGELOG has Unreleased → Fixed entries.

Test plan

  • test_branch_after_subcommand_is_not_global and test_saved_filter_branch_failure_honours_json_output failed before the fix and pass after it
  • Guard test: --branch before the subcommand plus -o after it still both apply
  • just lint; full suite 1552 passed
  • CI

Closes #170
Closes #173

https://claude.ai/code/session_01NfmMN4S8UFCdVCVrnMkjGH

…r branch failures

- --branch after the subcommand is left to that command (e.g. a plugin's
  branch filter) instead of switching the invocation into a branch (#170).
- A BranchError while resolving --saved filters now emits the envelope in
  the requested output format instead of the catch-all table (#173).

Claude-Session: https://claude.ai/code/session_01NfmMN4S8UFCdVCVrnMkjGH
…command

Found by adversarial review of #177: `nsc --branch x profiles list` was not
recognised as a meta command and bootstrapped the schema.

Claude-Session: https://claude.ai/code/session_01NfmMN4S8UFCdVCVrnMkjGH
@thomaschristory

Copy link
Copy Markdown
Owner Author

Adversarial review: no critical/important findings; both fixes verified to fail without the change. Applied: --branch added to _first_non_option skip-flags (test RED→GREEN) + CHANGELOG exit-code wording. Not in this PR (pre-existing, tracked separately if wanted): invalid -o value raises ValueError on dynamic commands; no end-to-end test with a schema that has a branch filter.

@thomaschristory
thomaschristory merged commit a22c72e into main Oct 22, 2026
15 checks passed
@thomaschristory
thomaschristory deleted the fix/branching-flag-and-saved-filter-errors branch October 22, 2026 19:12
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.

Branch failure during --saved filter loading ignores -o json Global --branch is picked up even when it appears after the subcommand

1 participant