fix: skip stack autodetect in file mode; remove CRIT_NO_AUTODETECT#423
Merged
tomasz-tomczyk merged 1 commit intomainfrom May 2, 2026
Merged
fix: skip stack autodetect in file mode; remove CRIT_NO_AUTODETECT#423tomasz-tomczyk merged 1 commit intomainfrom
tomasz-tomczyk merged 1 commit intomainfrom
Conversation
PR #391 introduced stacked-PR / local-stack autodetect but didn't gate it on file mode. Running `crit some-file.md` while sitting on a stacked branch silently promoted the session into range mode, throwing away the file argument and rebuilding the file list from a SHA range. Fix: add `len(sc.files) == 0` to the autodetect guard in applySessionOverrides. Also rip out the CRIT_NO_AUTODETECT escape hatch — it was unused (no CI, no docs, no scripts referenced it) and redundant with --working-tree, which is the discoverable, documented bypass. Adds TestAutoDetect_FileMode_Bypasses regression test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #423 +/- ##
==========================================
+ Coverage 67.28% 67.30% +0.01%
==========================================
Files 26 26
Lines 9690 9689 -1
==========================================
+ Hits 6520 6521 +1
+ Misses 2658 2656 -2
Partials 512 512
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
crit some-file.mdon a stacked branch was being silently promoted into range mode, throwing away the file argument and rebuilding the file list from a SHA range.applySessionOverrides(added in feat: PR-scoped and commit-range review (#300) #391) didn't check for file mode — only for--working-treeand theCRIT_NO_AUTODETECTenv var.len(sc.files) == 0to the guard so file-mode invocations skip autodetect.CRIT_NO_AUTODETECT— unused (no CI, no docs, no scripts referenced it) and redundant with--working-tree.Review
go test ./...clean;go vet/golangci-lintcleanTestAutoDetect_FileMode_BypassesTest plan
crit docs/some-spec.mdfrom a stacked branch now opens the file (file mode), not the stack rangecrit(no args) still autodetects the stack as beforecrit --working-treestill bypasses autodetect🤖 Generated with Claude Code