BACK-471 - Fix cli-commit-behaviour tests using git rev-list --count HEAD#638
BACK-471 - Fix cli-commit-behaviour tests using git rev-list --count HEAD#638lenucksi wants to merge 1 commit into
Conversation
MrLesk
left a comment
There was a problem hiding this comment.
Alex's Agent: Thanks, the git rev-list --count HEAD change itself looks reasonable for this test. Counting only commits reachable from the current branch is the right signal for these auto-commit assertions, and it avoids unrelated refs such as notes.
I do not think this PR is ready to merge as-is though, because the branch includes unrelated terminal-status configuration changes in addition to the BACK-471 test fix.
Could you please split or rebase this PR so it only contains the src/test/cli-commit-behaviour.test.ts change?
Specific blockers:
-
The PR title/body describe a one-line test fix and say no implementation changes are needed, but the branch also changes
src/file-system/operations.ts,src/types/index.ts,src/utils/terminal-status.ts, andsrc/test/terminal-status.test.tsforterminalStatuses. -
The included
terminalStatusesconfig work is incomplete. It parsesterminal_statuses, butserializeConfigdoes not write it back, so a later config save can silently drop that setting. -
The new helper accepts a
terminalStatusesoverride, but the actual runtime call sites still pass onlystatuses: CLI cleanup, core cleanup selection, the Web board cleanup affordance, and the All Tasks terminal-status filtering. So the tests cover the helper directly, but not behavior users would actually see. -
I do not see a matching Backlog task for
BACK-471in this branch. If this PR is kept, it should include the task details according to the project workflow.
I would be happy with the HEAD test-count change as a narrow PR once the unrelated terminal-status changes are removed or moved into a separate, complete task/PR.
587bdf6 to
f001b41
Compare
|
Branch has been force-pushed and cleaned up. The PR now contains exactly one commit with two files:
All unrelated terminal-status changes from BACK-466/467 have been removed. |
…HEAD Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f001b41 to
d2cb760
Compare
Basic problem here: If you use a tool that also writes to separate refs per commit, this will break a bunch of tests.
Namely these here:
This ensures they're not breaking in such contexts.
Summary
getCommitCountInTestinsrc/test/cli-commit-behaviour.test.tsusedgit rev-list --all --count, which includes commits inrefs/notes/ai— a ref written asynchronously by a globalgit-aidaemon configured viatrace2.eventTargetin~/.gitconfig.initialCommitCount) and after it (finalCommitCount) could differ by 1 even when no real commit was made, causing all 6 tests to fail non-deterministically.--all→HEAD.git rev-list --count HEADcounts only commits reachable from the current branch tip, which is the correct metric for "did this CLI command produce a commit on this branch?". This matches the approach already used by the sibling tests incli.test.ts.shouldAutoCommitand all three CLI handlers (task create,doc create,decision create) already readautoCommitfrom config correctly.Test plan
bun test src/test/cli-commit-behaviour.test.ts— 6/6 pass (was 0/6)bun test— 1256 pass, 0 fail, no regressionsbunx tsc --noEmit— cleanbun run check .— clean🤖 Generated with Claude Code