fix(cli): avoid false dirty warnings on onboarding resume - #3003
fix(cli): avoid false dirty warnings on onboarding resume#3003WcaleNieWolny wants to merge 19 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthroughThe init command tracks automatic Git mutations with validated fingerprints, persists resumable progress, classifies repository changes, validates native-directory boundaries, and restores or clears tracked state across onboarding lifecycle transitions. Guardrail tests cover parsing, attribution, persistence, failure handling, and path safety. ChangesOnboarding Git tracking
Estimated code review effort: 5 (Critical) | ~90 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Stale comment
Risk: medium. Left a non-blocking comment — this CLI onboarding git-fingerprint/resume change is above the low-risk auto-approval threshold, and Cursor Bugbot was not present to provide a clean automated-review signal. Human review is needed; assigning reviewers next.
Sent by Cursor Approval Agent: Pull Request Approver External
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cli/src/init/command.ts`:
- Around line 941-980: Bound captureInitGitSnapshot before hashing files by
tracking the scoped entry count and total file size, and return undefined once
either configured threshold is exceeded. Apply this to directory-scoped
snapshots so oversized native trees are classified as unrecognized, while
preserving normal fingerprinting below the limits and the existing fail-closed
behavior in trackInitGitChanges.
- Around line 655-674: Canonicalize startDir in createInitGitChangeScope before
resolving targets, using the same realpath-based approach as getInitGitRepoRoot,
then resolve each target against that canonical directory before computing
repository-relative paths. Preserve the existing validation and empty-scope
behavior for invalid targets, while ensuring symlinked start directories produce
paths relative to repoRoot.
In `@cli/test/test-init-guardrails.mjs`:
- Around line 445-457: Replace the repeated git initialization, user
configuration, staging, and commit setup in the tests at the shown block and the
additional locations with the existing initializeGitRepo helper. Pass the
temporary repository root and preserve each test’s fixture files and subsequent
behavior.
- Around line 1290-1332: Update the coverage loop in the guardrail test to
assert at least one runTrackedInitMutation call per automatic onboarding
section, rather than exact call and scope token counts. Keep the existing
negative assertions for manual waits, device runs, and project builds, along
with the native-reset regex checks, unchanged.
- Around line 1172-1219: Wrap each of the three onboarding tests beginning with
“tracked init mutation persists changed process...” in a try/finally block,
placing the existing test body in try and moving beginFreshInitProgress() into
finally. Ensure the shared state reset runs even when assertions or mutations
fail, matching the cleanup pattern used by the nearby gate tests.
In `@docs/superpowers/specs/2026-08-11-cli-onboarding-git-fingerprints-design.md`:
- Around line 51-55: Update the helper example in the specification to use the
shipped runTrackedInitMutation(operation, options) wrapper instead of
trackInitGitChanges. Include the options object with startDir, scope, and
isSuccess: result => result.success, preserving the automatic mutation and
success-predicate behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 01f4aedb-b2b4-4e0a-a5b1-db637bf80dc4
📒 Files selected for processing (3)
cli/src/init/command.tscli/test/test-init-guardrails.mjsdocs/superpowers/specs/2026-08-11-cli-onboarding-git-fingerprints-design.md
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Cap-go/capacitor-updater(manual)
There was a problem hiding this comment.
1 issue found across 3 files
Confidence score: 3/5
- In
cli/src/init/command.ts, the porcelain-v2 status parsing appears to reject valid submodule records as malformed, which can trap onboarding in a status-error retry loop when submodules are dirty. Treat submodule records as ordinary dirty entries in this path so initialization can proceed instead of repeatedly failing.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="cli/src/init/command.ts">
<violation number="1" location="cli/src/init/command.ts:821">
P2: Dirty Git submodules make onboarding get stuck in the status-error retry loop because valid porcelain-v2 submodule records are rejected as malformed. Parsing submodule records as ordinary dirty entries (while leaving them unrecognized for fingerprint skipping) would preserve the fail-closed behavior without blocking the continue-anyway path.</violation>
</file>
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
| return undefined | ||
| const [, rawStatus, submodule, headMode, indexMode, worktreeMode, headObjectId, indexObjectId, filePath] = fields | ||
| const status = normalizeInitGitStatus(rawStatus) | ||
| if (!status || !filePath || submodule !== 'N...' |
There was a problem hiding this comment.
P2: Dirty Git submodules make onboarding get stuck in the status-error retry loop because valid porcelain-v2 submodule records are rejected as malformed. Parsing submodule records as ordinary dirty entries (while leaving them unrecognized for fingerprint skipping) would preserve the fail-closed behavior without blocking the continue-anyway path.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cli/src/init/command.ts, line 821:
<comment>Dirty Git submodules make onboarding get stuck in the status-error retry loop because valid porcelain-v2 submodule records are rejected as malformed. Parsing submodule records as ordinary dirty entries (while leaving them unrecognized for fingerprint skipping) would preserve the fail-closed behavior without blocking the continue-anyway path.</comment>
<file context>
@@ -329,17 +418,699 @@ export function getGitRepoStatus(startDir = cwd()): GitRepoStatus {
+ return undefined
+ const [, rawStatus, submodule, headMode, indexMode, worktreeMode, headObjectId, indexObjectId, filePath] = fields
+ const status = normalizeInitGitStatus(rawStatus)
+ if (!status || !filePath || submodule !== 'N...'
+ || !hasValidInitGitStatusMetadata([headMode, indexMode, worktreeMode], [headObjectId, indexObjectId]))
+ return undefined
</file context>
There was a problem hiding this comment.
Fixed in commit bd9e81f. Valid porcelain-v2 dirty-submodule markers are accepted for live status display and prompting, while snapshot capture still rejects them as unrecognized. A real-submodule regression proves the user reaches Continue instead of the status-error retry path.
There was a problem hiding this comment.
Risk: medium. Left a non-blocking comment — this CLI onboarding git-fingerprint/resume change remains above the low-risk auto-approval threshold, and Cursor Bugbot was not present after the first checks poll. Human review is already requested; no additional reviewers assigned.
Sent by Cursor Approval Agent: Pull Request Approver External
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|





Summary
Test plan
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
New Features
Bug Fixes
Documentation