Skip to content

Split CLI help snapshots by command group to reduce merge conflicts#116

Merged
alexkroman merged 1 commit into
mainfrom
claude/elegant-edison-b96yrt
Jun 12, 2026
Merged

Split CLI help snapshots by command group to reduce merge conflicts#116
alexkroman merged 1 commit into
mainfrom
claude/elegant-edison-b96yrt

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Summary

Reorganized the CLI help snapshot tests to split the monolithic test_snapshots_help_run.ambr file into five separate snapshot modules, one per command group. This reduces merge conflicts when concurrent PRs modify different commands' help text.

Key Changes

  • Snapshot file reorganization: Split tests/__snapshots__/test_snapshots_help_run.ambr into:

    • test_snapshots_help_account.ambr (login, logout, whoami, balance, usage, audit, keys, limits)
    • test_snapshots_help_build.ambr (onboard, init, dev, share, deploy)
    • test_snapshots_help_run.ambr (transcribe, stream, agent, speak, llm, eval, webhooks)
    • test_snapshots_help_tools.ambr (doctor, setup, telemetry, _update-check)
    • test_snapshots_help_history.ambr (transcripts, sessions)
  • New test modules: Created corresponding test files (test_snapshots_help_account.py, etc.) that each test their command group's help output, with the argv list derived from the live Typer tree filtered to that group.

  • Shared infrastructure: Extracted common snapshot utilities into tests/_snapshot_surface.py:

    • HELP_GROUPS dict mapping command groups to their commands
    • normalize() function for ANSI-stripping and whitespace normalization
    • HELP_ARGVS generation logic
  • Guard test: Added test_snapshots_help_groups.py to verify the partition is complete and disjoint—every top-level command is in exactly one group, so a new command fails loudly until assigned.

  • Error snapshots: Moved error golden tests into a dedicated test_snapshots_errors.py module with its own test_snapshots_errors.ambr file.

  • CI/workflow updates: Added merge_group trigger to ci.yml and codeql.yml so merge-queue runs validate the queued result.

  • Test fixture: Added fixed_render_size fixture in conftest.py to pin render width/height for byte-identical goldens across machines.

Implementation Details

The split preserves the original behavior—each group's test file imports its filtered argv list from _snapshot_surface.py and runs the same snapshot assertion. The HELP_GROUPS partition is enforced by the guard test, so adding a new command requires updating HELP_GROUPS first, making the assignment explicit and preventing accidental omissions.

The snapshot files remain .ambr (syrupy format) and are regenerated with uv run pytest --snapshot-update as before. The per-group split means concurrent branches touching different commands now regenerate different files instead of all conflicting in one.

https://claude.ai/code/session_01PC6rFfEQ83Jo4F72ANv9rz

Three changes aimed at many branches being developed and merged in parallel:

- Split the single CLI-surface snapshot module (one 1455-line .ambr that
  conflicted whenever two branches touched any command output) into per-group
  help modules (test_snapshots_help_{build,run,tools,history,account}.py) plus
  test_snapshots_errors.py, so each group's goldens live in their own .ambr
  file. tests/_snapshot_surface.py holds the HELP_GROUPS partition and shared
  helpers; test_snapshots_help_groups.py guards that the partition stays
  complete and disjoint, preserving the old file's "every command must have a
  help snapshot" property. The 45 goldens are byte-identical, just
  redistributed.

- Baseline check.sh's escape-hatch diff and Any/cast count gates on the
  merge-base with origin/main instead of the origin/main tip (matching what
  diff-cover and the mutation gate already do), so an unrelated merge to main
  that lowers a baseline count can no longer fail an in-flight branch that
  added nothing.

- Add merge_group triggers to ci.yml and codeql.yml so the required checks run
  on merge-queue refs; enabling the queue in branch protection then ensures two
  individually-green PRs can't land a semantic conflict on main together.

https://claude.ai/code/session_01PC6rFfEQ83Jo4F72ANv9rz
@alexkroman alexkroman enabled auto-merge June 12, 2026 17:19
@alexkroman alexkroman added this pull request to the merge queue Jun 12, 2026
Merged via the queue into main with commit 58f58fb Jun 12, 2026
16 checks passed
@alexkroman alexkroman deleted the claude/elegant-edison-b96yrt branch June 12, 2026 17:25
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