Skip to content

fix(preview): cancel client reads when document grants are revoked - #35493

Closed
OrcaWin wants to merge 1 commit into
mainfrom
audit/doc-preview-grant-revocation
Closed

OrcaWin wants to merge 1 commit into
mainfrom
audit/doc-preview-grant-revocation

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​150 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​143
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​53 $\color{#cf222e}{\Huge{\mathbf{−}}}$​34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19

LoC: +203/-41

Cancel client document-preview reads when closing/replacing a page or hard-reminting its grant. Subscribe to the existing grant-revocation event, forward its optional signal through the reader into existing runtime-call cancellation, suppress obsolete outcomes before payload conversion/failure publication, and unsubscribe on every outcome. Sibling and same-page/path successor grants stay live. No new wire protocol or shared-socket close.

Validation:60 configured tests/3 suites; exact old production fails4 regressions and passes7 controls. Five normal hook tasks pass. Exact committed focused TypeScript exits1 with7 byte-identical baseline diagnostics, zero added; this is not a clean typecheck. Root verified the original110-artifact proof+88 pinned source hashes and independently reran it. Exact formatted implementation repeats22 scenarios per arm through83 actual protocol/reader/queue/shared-request modules with declared environment/transport boundaries. AtN1/10/100, obsolete queued sendsN→0;100 old reads plus a sibling go from8pending/93queued to1pending/0queued. Timers/admissions follow pending records, successor succeeds, late replies do not decode. Completed scenarios clean all counted state. All88 source/ownership blobs equal main5748d11d.

Remaining limits: ordinary same-grant reload has no revoke; managed setup wait persists until setup resolves; already-sent remote I/O is not canceled. Legacy transport checks signal forwarding only. Response.error()→ERR_FAILED is supported by pinned Electron43.8.1 source but native preview/UI behavior was not executed. No CPU/RSS/heap/latency or real host/socket claim. Folder/worktree authorization and mixed-peer compatibility are preserved. #27171 local-owner/raw-byte/.py additions are separate and must survive rebase; full overlap patch retained.

Required aggregate queued after #35492; no aggregate pass or Claude takeover claimed. Failed mixed-baseline typecheck and initial style-hook attempts are preserved/excluded. No dependency operations. Frozen head fac1be8b0925f843ac7cf013d2b513ed02fbdc63, base 79dbada2c873bef3584a0c53b23ae98f2a84e536. Evidence /home/neil/.local/state/orca-electron-audit/doc-preview-grant-revocation/report.md;143-payload seal 6daa47469410eb18986edd9248a2319eff18612c44a723b49a5b0856f0161d71.

@OrcaWin

OrcaWin commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for this. We're closing it because main already drops late doc-preview reads once a grant is revoked: the guest has been torn down, and HtmlDocPreview ignores failure notices whose grantId it no longer holds. Aborting the read only frees queued runtime-call slots in a rare close-during-load race. It doesn't cancel I/O that has already been sent, and the SSH path gets no signal at all. That gain doesn't justify about 200 added lines, most of them tests, plus the change to an ERR_FAILED response.

Closing per maintainer triage (low-risk / zero user trade-off / material-gain bar).

@OrcaWin OrcaWin closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant