Repository navigation
fix(errors): keep every desktop close failure and drop abort-guard false positives - #13168
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
[Medium impact] The runtime change reaches desktop export's state-reader cleanup reporting. The PR needs the new test moved to an isolated project before merge. FindingsFix with agent prompt### Issue 1
tests/boundary/cli/desktopStateReaderCleanup.test.ts:20-24
This test adds four `vi.mock` calls, but its `cli-boundary` project has `isolate: false`. The repository requires module mocks to run in an isolated project, and `rea/no-shared-module-mock` rejects these calls as errors. Move the file to `tests/process-global/`, or explicitly give it an isolated owner and exclude it from `cli-boundary`.
### Issue 2
scripts/verify/architecture-guards.mjs:640
The new pattern drops valid positive checks that the old guard counted. For example, `results[0].ok && signal.aborted` and `getResult().ok && isAborted(signal)` now produce no match. Both can still reclassify a completed result, so new copies can pass without a baseline entry. Keep these receiver forms covered while excluding unary negation, and add positive and negative regression cases.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThe PR folds all desktop close failures through
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Scope["Artifact scope failure"] --> First["Compose first two failures"]
SQLite["SQLite close failure"] --> First
First --> Final["Compose with worker failure"]
Worker["Worker retry failure"] --> Final
Final --> Output["CLI error keeps every reason"]
Final --> Owners["Completion follows every child owner"]
Reviews (1) · Last reviewed commit: "fix(desktop): keep every state-reader cl..." · Reviewed by Greptile |
15160ee to
89cb9d7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89cb9d72b2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…ication guard The completed-abort-reclassification pattern matched any `.ok && …aborted`, including `!outcome.ok && signal?.aborted`, which attaches a secondary cancellation to an already failed primary and reclassifies nothing. Move the pattern to completed-abort-guard.mjs, where the receiver chain (member, optional, private, element and call segments) must start the check, and cover positive and negated forms in tests. DesktopApplicationState and FridaInstrumentationService leave the baseline. Fixes #11920 Co-Authored-By: gensokyo-dev <[email protected]>
…mposite The desktop state-reader close collects up to three failures (artifact scope, SQLite service, and the export worker retry), but composed only the first two with analysisErrorWithCleanupFailure and bound the rest by hand. The third failure's reason never reached the caller. Fold the failures through analysisErrorWithCleanupDependencies so each keeps its reason and owner; two failures produce the same composite as before. Refs #11859 Co-Authored-By: gensokyo-dev <[email protected]>
89cb9d7 to
6783e8b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6783e8b66a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
gensokyo-dev
left a comment
There was a problem hiding this comment.
Approved: guard accuracy and desktop close composition fix with regressions; review findings addressed; CI green.
Summary
Two error-composition cleanups tracked by the architecture guards:
completed-abort-reclassificationguard counted negated failure checks such as!outcome.ok && signal?.aborted, which attach a secondary cancellation to a failed primary and reclassify nothing. The guard now requires the receiver chain to start the check, soDesktopApplicationState.tsandFridaInstrumentationService.tsleave the baseline. The other 15 counted files are unchanged.withStateReadersinsrc/cli/desktopCaptureCommands.ts) collects up to three failures (artifact scope, SQLite service, export-worker retry). It composed only the first two withanalysisErrorWithCleanupFailureand bound all of them by hand, so the third failure's reason never reached the caller. The failures are now folded throughanalysisErrorWithCleanupDependencies, so each keeps its reason and cleanup owner. The directbindCleanupDependenciescall leaves the baseline (31 → 30 files).Supersedes #11922 (token-scanner version of the guard fix; a one-pattern change covers the current sites) and #12000. #12000 assumed at most two close failures. On current main there can be three, so its two-argument helper call would drop the third failure from the composite's cleanup dependencies. Its CLI-level test approach is reused here.
Problem and expected behavior
.okcheck is not a completed-result reclassification and should not count as debt.Export worker remains owned.Change and scope
scripts/verify/completed-abort-guard.mjs(used byarchitecture-guards.mjs, with a.d.mtsdeclaration like the other guard helpers): a receiver chain of member, optional,#private, element and call segments, or a leading parenthesized receiver, each optionally with a non-null assertion, must start the.ok && …abortedcheck; a leading!excludes it.src/cli/desktopCaptureCommands.ts:typed.reduce(analysisErrorWithCleanupDependencies). With two failures this builds the same composite as before. With three, the first composite becomes the primary of the second, so each part keeps its owner.Sibling check (source-read):
AdbProvideroutput-directory cleanup,DesktopApplicationExporthandle closes,CompositeProvider, anddecompileAllkeep every failure (ProviderCleanupErrorover all parts orretainSecondaryFailureper part). Only the desktop state-reader close dropped one.Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.
Contract and boundary impact
analysisErrorWithCleanupDependencies(src/domain/analysisErrorCleanup.ts) now owns the desktop close composite; architecture guard pattern.export-desktop-applicationretries the worker), its CLI errors now include the third reason under nesteddiagnostics.primary_error. With one or two failures, output is unchanged. MCP is unchanged.partial_observationis preserved as before.Evidence and regression coverage
tests/evaluation/completedAbortGuard.test.ts(14 positive and 10 negative receiver forms, includingresults[0].ok,getResult().ok,(await settle()).ok, non-null assertions such asresult!.ok, and their negations);tests/process-global/desktopStateReaderCleanup.test.ts(isolated project, since it uses module mocks) runsrea export-desktop-application --jsonthrough the CLI with a retained scope lease whose close fails, plus failing SQLite and worker closes. It asserts that all three reasons and resources are in the output, and that released parts leave the composite's pending resources while the unreleased lease keeps it incomplete.expected '{"code":"cleanup_incomplete",…' to contain 'Export worker remains owned'(executed locally).Validation performed
npm run test:focused -- tests/process-global/desktopStateReaderCleanup.test.ts tests/evaluation/completedAbortGuard.test.ts— 26/26 passed.npm run test:focused -- tests/boundary/cli/desktopApplicationCli.test.ts tests/boundary/cli/desktopCaptureCli.test.ts(with the new test) — 20/20 passed.npx oxlintandnpx oxfmt --checkon changed files — no errors.node scripts/verify/architecture-guards.mjs— passed across 2936 source files.npm run typecheck— passed.npm run check:fast— passed.Compatibility, safety, and release
Author readiness
Human owner: gensokyo-dev (exempt from the readiness declaration per CONTRIBUTING.md)
Before merge
type(scope): outcome.