Repository navigation
fix(electron): retain wrapped protocol handler registrations - #8490
ShuaixinHuang wants to merge 1 commit into
Conversation
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. |
[Medium impact] The change affects Electron protocol findings in JavaScript application analysis. The behavior fix appears sound, but the redundant filesystem regression must be removed to satisfy the repository's test guidance before merging. Findings
Fix with agent prompt### Issue 1
tests/boundary/filesystem/javascript-applications/electronProtocolBoundaries.test.ts:40-41
This filesystem case repeats the same six registrations and graph checks already covered by the new CLI/MCP test. It adds no distinct assertion, so maintainers must keep two copies of the fixture and checks in sync. `AGENTS.md` requires removing redundant tests after checking affected consumers. Remove this extra case before merging; keep the public workflow coverage and the domain test's separate session checks.
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.SummaryRetains source calls to Electron's
Reviews (1) · Last reviewed commit: "fix(electron): retain wrapped protocol h..." · Reviewed by Greptile |
| describe("Electron wrapped protocol.handle graph", () => { | ||
| it("retains wrapped handle registrations while rejecting missing legacy callbacks", async () => { |
There was a problem hiding this comment.
The graph test duplicates coverage
This filesystem case repeats the same six registrations and graph checks already covered by the new CLI/MCP test. It adds no distinct assertion, so maintainers must keep two copies of the fixture and checks in sync. AGENTS.md requires removing redundant tests after checking affected consumers. Remove this extra case before merging; keep the public workflow coverage and the domain test's separate session checks.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/boundary/filesystem/javascript-applications/electronProtocolBoundaries.test.ts
Line: 40-41
Comment:
**The graph test duplicates coverage**
This filesystem case repeats the same six registrations and graph checks already covered by the new CLI/MCP test. It adds no distinct assertion, so maintainers must keep two copies of the fixture and checks in sync. `AGENTS.md` requires removing redundant tests after checking affected consumers. Remove this extra case before merging; keep the public workflow coverage and the domain test's separate session checks.
**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.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!
Supersedes #8256 at the author's explicit request to resubmit the existing PR. This replacement reuses verified head 51a2f60 and preserves the original discussion and validation record at #8174. Historical validation and its limitations below remain at their stated execution points. This new PR must pass its own hosted CI.
Summary
Retain source registrations for
protocol.handle("app"),protocol.handle("app", null)andprotocol.handle("app", void 0), including the session protocol receiver. The static analyzer currently drops these calls even though Electron installs its own wrapper before invoking the supplied handler on a later request.This corrects behavior introduced by merged #2978; no separate issue was filed. Searches found no existing PR for this correction.
Problem and expected behavior
On Electron 33.4.11/Windows, each of those
handlecalls returns without throwing and changesprotocol.isProtocolHandled(scheme)from false to true. The equivalent legacyregisterStringProtocolcalls throw and leave it false. The current shared missing-handler filter treats both APIs as the legacy API, removing the modern calls from the graph and CLI/MCP summary.The Electron 33.4.11 implementation installs a native callback which invokes the supplied handler only when a request arrives. Registration presence does not establish that the handler can serve a request successfully.
Change and scope
Apply the missing-handler filter only to legacy registration/interception APIs. Preserve existing scheme resolution, receiver/session classification, source-call evidence and uncertainty about successful execution, routing and responses. Two incorrect modern-API negative expectations become legacy-API controls; their refusal assertions remain, with an additional
void 0control. No shared nullish evaluation, schema, provider, authority, budget or target-execution behavior changes.Contract and boundary impact
inspectElectronProtocolNode, then existing graph projection and application summary.handleand legacy native registration retain their distinct callback behavior.ast-static-analysissource-call observations and successful-registration limitations remain.Expected effects of the analysis remain:
Evidence and regression coverage
47fa6ab3795d547207001ffb01643c0aa39dcad8: the two complete source/graph files produced 3 failed / 43 passed. The compiled public CLI and stdio MCP cases both failed, reportingprotocol_registrations: 0instead of 6.handlesedges, retaining AST authority and uncertainty. A throwing source fixture stays inert during analysis. Legacy missing/null/void callbacks remain excluded.undefinedas a syntactically known nullish value; this was corrected to unambiguousvoid 0before the final baseline and fix results. No shared identifier-resolution expansion was made.For evidence-bearing changes:
Validation performed
npm run test:focused -- src/domain/javascript/electronStaticAnalysisProtocol.test.ts tests/boundary/filesystem/javascript-applications/electronProtocolBoundaries.test.ts tests/acceptance/applications/electronProtocolHandleCli.test.ts— 3 prerequisite build tasks and all 48 tests passed.npm run check:fast— typecheck and lint passed, 2/2 tasks, 19.344s. The initial lint run caught an oversized test describe; the added graph case now has its own describe without suppressions.npm run verify:test-discovery— all 2884 files discovered exactly once.Compatibility, safety, and release
Author readiness
Human owner: @ShuaixinHuang
Before merge
type(scope): outcome.This replacement preserves the prior PR discussion and validation history at #8256. It reuses the verified published head and requires its own hosted CI.
Resubmitted at the author's request as #8539: #8539. This PR is closed unmerged; its original discussion and validation history are retained.