orca icon indicating copy to clipboard operation
orca copied to clipboard

Treat check-ignore no-match as expected

Open brennanb2025 opened this issue 5 months ago • 1 comments

Description

Treat git check-ignore exit code 1 as an expected result for the file-explorer ignore probe instead of throwing through the git runner.

Git uses exit 1 to mean “none of these paths are ignored.” The Windows crash bundles showed this normal no-match case being recorded as repeated failed git.exec spans during Source Control/file-explorer refresh, especially in 04-renderer-killed-mtt-nakasone.

This adds an opt-in successExitCodes option to gitExecFileAsync and uses it only for checkIgnoredPaths, so other git failures keep surfacing normally.

Evidence

Crash evidence:

  • 04-renderer-killed-mtt-nakasone had 13 git check-ignore failure spans around D:\Maqia-web / D:\tmp\paidy-payment-error-logging; the command text matched Git’s no-match exit-1 shape.
  • 02-renderer-crashed-bbiyakfather also had no-match check-ignore failure spans amid the same heavy git refresh loop.
  • Local repro probe confirmed Git behavior: git check-ignore -- src/a.ts exits 1 when no paths are ignored, while mixed ignored paths exit 0 and print matches.

Validation:

  • pnpm exec vitest run --config config/vitest.config.ts src/main/git/check-ignored-paths.test.ts src/main/git/runner-command-exec.test.ts
  • pnpm run typecheck
  • git diff --check HEAD~1 HEAD

ELI5

Orca was asking Git, “are any of these files ignored?” Git answered “no” using exit code 1. That is not actually an error, but Orca’s runner still treated it like one. Now this one question knows that 1 can be a normal answer.

Tradeoffs

  • The new runner option is opt-in; only checkIgnoredPaths uses it.
  • Real check-ignore errors, like a bad repo or unsupported command failure, still throw.
  • This reduces exception/span noise and refresh churn; it does not claim to be the exact native renderer crash root cause for reports 02/04.

brennanb2025 avatar Jul 03 '26 07:07 brennanb2025

Review Change Stack

📝 Walkthrough

Walkthrough

This change introduces a successExitCodes option to gitExecFileAsync in the git runner, allowing specific process exit codes to be treated as successful rather than triggering a rejection. Helper functions extract exit codes and captured stdout/stderr from rejection errors. checkIgnoredPaths is updated to use successExitCodes: [1] for git's "no paths ignored" exit code, removing its previous try/catch error-handling logic and the GitExecError type. Corresponding tests are updated to reflect the new resolved-promise behavior.

Changes

Area Change
runner.ts Added successExitCodes option, exit-code extraction/check helpers, and captured error output helper; updated gitExecFileAsync to resolve on configured exit codes
check-ignored-paths.ts Removed GitExecError type and try/catch; now uses successExitCodes: [1]
Tests Updated check-ignored-paths.test.ts and runner-command-exec.test.ts to match new behavior

Sequence Diagram(s)

See hidden review stack diagram for gitExecFileAsync success exit code flow.

Related PRs: None identified.

Suggested labels: bug, enhancement, tests

Suggested reviewers: None identified.

🰵 A rabbit hums a small refrain, Exit code one is not in vain, No paths ignored, no need to fret, Success returns without regret, Clean stdout, the tests attest again.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change, but it misses the required template sections like Summary, Screenshots, AI Review Report, Security Audit, and Notes. Reformat the PR description to match the template and add all required sections, including Summary, Screenshots, Testing checklist, AI Review Report, Security Audit, and Notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: treating git check-ignore no-match as expected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jul 03 '26 07:07 coderabbitai[bot]

Moving this PR to draft because it has been untouched for more than 80 days (latest recorded PR activity or commit timestamp: 2026-07-03T07:12:34Z; checked on 2026-10-27). This keeps the review queue focused on active work while preserving the proposal. Please mark it ready for review when work resumes.

OrcaWin avatar Oct 27 '26 09:10 OrcaWin