Repository navigation
fix(javascript): keep unselected sources out of cancellation failures - #1975
kaoru0822-kitauji wants to merge 1 commit into
Conversation
With source_paths, the analysis loop checked cancellation before it recognized an outside-analysis-scope file. Cancellation arriving after the last selected source therefore recorded the next unselected file as a cancelled analysis failure, and the completion loop skipped it as already analyzed. Give out-of-selection classification one owner, used by the loop, the interruption handler and the completion loop. The cancellation is still reported as the interruption. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
TL;DR: The fix works on Linux. On 1d4c4eb (#1962), a cancel after the last chosen source marks one unchosen file as cancelled. On 8a8efb8, no unchosen file is marked, and the cancel is still reported. ResultsEach row says which commit it ran on. "Base" is 1d4c4eb (#1962), the commit this PR branched from.
The key result: on base, the file wrongly marked is broken.json. It carries an analysis failure with the code "cancelled", and the other four unchosen files are fine. On head, all five stay outside the selection and the run still reports the cancel. The partial result on head is byte-identical to a run with no cancel (same sha256). How I cancelled: the real command line has no way to hit this. The gap is one event-loop tick wide, and no progress event falls inside it. So I injected the cancel two ways. In the built-code repro, the cancel fires right after the worker returns the chosen file. In the service-path run, the abort flag turns true when the analysis loop reads it for the second file. Both use the real worker, the real inventory scan and the fixture from the PR. The PR body says 229 tests in the four suites. I count 231 on head: 230 existing plus the 1 new test. I don't know why the counts differ. Not run
Thanks, Kaoru0822, for the fix. Commands# sources, from a read-only mirror
git -C ~/code/rea-mirror/rea.git archive 8a8efb822677327070ef36fa187f00eafc9d0ef6 | tar -x -C /tmp/p1975/head
git -C ~/code/rea-mirror/rea.git archive 1d4c4eb0308b4cb5761a91533edeb33fcfb442f2 | tar -x -C /tmp/p1975/base
# in each tree (Node 24 first on PATH)
npm ci && npm run build && npm run test:prepare
# the PR's new test, on base and head, Node 22 / 24 / 26
npx vitest run tests/boundary/filesystem/javascript-applications/javascriptSelectedSourceCancellation.test.ts
# four related suites plus the new test, on head
npx vitest run tests/boundary/mcp/javascriptSourceSelection.test.ts \
tests/boundary/filesystem/javascript-applications/javascriptApplicationService.test.ts \
tests/acceptance/applications/javascriptSourceSelectionCli.test.ts \
src/application/javascript \
tests/boundary/filesystem/javascript-applications/javascriptSelectedSourceCancellation.test.ts
# CLI control, no cancel
node scripts/rea.mjs analyze /tmp/p1975/fixture --source-path main.mjs --format json
# built-code repro (modes: late, none, early) and service path (modes: late, none)
node dist-repro.mjs <tree> late /tmp/p1975/fixture
node service-dump.mjs <tree> late /tmp/p1975/fixture <out.json>
# checks on head
npm run typecheck ; npm run format:check ; node_modules/.bin/oxlintTest setup
🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
Superseded by 7285e15 on main, which consolidates source-scope classification so cancellation can't mark unselected files as failed, and adds coverage in |
|
Thanks, @kaoru0822-kitauji, for the late-cancellation repro showing an unselected source could be mislabeled as failed. Main now keeps cancellation outcomes within the selected source set (main). |
Fixes #1968
Behavior
With
source_paths,analyzeAndAdoptJavaScriptArtifactFileschecked cancellation before it recognized anoutside-analysis-scopefile. If cancellation arrived after the last selected source finished, the next unselected file was recorded as a cancelledanalysis_failure. The completion loop then skipped that file as already analyzed. Every unselected file now stays classified as outside the caller-selectedsource_paths, and the cancellation is still returned as the interruption. Found by Codex on #1944.Related cleanup
The worker loop, its interruption handler, and the completion loop now share one
recordOutsideSelectionowner. Before, the loop and the completion loop each had their own copy of the classification, and the handler had none.Still separate:
analyzeArtifactFileSteps, the in-process step path, has its own out-of-scope check. It has no semantic projection to record into, so it only appends the file.Validation
tests/boundary/filesystem/javascript-applications/javascriptSelectedSourceCancellation.test.tsuses the real selection fixture and the real worker, and aborts right after the selected source returns. It fails on main (one unselected file carries acancelledanalysis_failure) and passes here.src/application/javascriptsuites pass.npm run lint,npm run typecheck,npm run format:check: pass.npm test: 8,408 passed, 16 failed. Twelve are this Mac's usual environmental failures (ibtool, hdiutil, JS runtime paths under/private/var). The other four fail identically on clean main1d4c4eb03and are unrelated to this change:src/browser/CdpCaptureEvents.redirectBodyShape.test.ts: already captured response shapetests/boundary/filesystem/qwenClientConfiguration.test.ts(×2):{ ok: true, value: "installed" }vs"installed"tests/boundary/providers/native/nativeProvider.test.ts: otool output is missing the Mach header🤖 Generated with Claude Code