Split CLI help snapshots by command group to reduce merge conflicts#116
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reorganized the CLI help snapshot tests to split the monolithic
test_snapshots_help_run.ambrfile 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.ambrinto: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_GROUPSdict mapping command groups to their commandsnormalize()function for ANSI-stripping and whitespace normalizationHELP_ARGVSgeneration logicGuard test: Added
test_snapshots_help_groups.pyto 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.pymodule with its owntest_snapshots_errors.ambrfile.CI/workflow updates: Added
merge_grouptrigger toci.ymlandcodeql.ymlso merge-queue runs validate the queued result.Test fixture: Added
fixed_render_sizefixture inconftest.pyto 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.pyand runs the same snapshot assertion. TheHELP_GROUPSpartition is enforced by the guard test, so adding a new command requires updatingHELP_GROUPSfirst, making the assignment explicit and preventing accidental omissions.The snapshot files remain
.ambr(syrupy format) and are regenerated withuv run pytest --snapshot-updateas 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