Skip to content

experiment(rpc): defer implementations behind static metadata - #33893

Closed
OrcaWin wants to merge 1 commit into
OrcaWin/mem-02-ssh-boundaryfrom
OrcaWin/mem-03-rpc-boundary
Closed

OrcaWin wants to merge 1 commit into
OrcaWin/mem-02-ssh-boundaryfrom
OrcaWin/mem-03-rpc-boundary

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Current disposition: performance hold; do not merge. Adding this experiment increased median main RSS by 5.906 MB and loaded main CJS files by 201 in the historical full-app comparison. A smaller isolated import graph did not translate into a memory win. Evidence #33912 is merged independently into main.

Performance hold: exclude this experiment from the historical measured stack. Full-app comparison with and without M3 shows roughly 200 extra loaded main chunks, slightly higher V8 heap, and higher RSS/private/external memory. The standalone registry graph improves, but it does not establish a whole-app win. This draft preserves the prototype and contract tests for a future design with a proven full-app benefit.

ELI5

Listing RPC capabilities should not load every feature implementation.

What Changed

Advertise the full ordered method/security/schema/streaming surface from generated static metadata and load implementation groups on first dispatch. Preserve compile switches and parameter schemas, verify metadata against original declarations, share concurrent imports, and retry failed loads. Streaming callers canceled during loading cannot install late subscriptions. Update the existing catalog generator and narrow generated-file lint boundaries.

Why

RPC registration previously pulled large unused feature graphs into desktop and headless startup. Static metadata keeps authorization, validation, CLI/mobile capability discovery and mixed-version method names available before implementation loading.

Visual Proof

N/A — main-process loading/lifecycle changes; no rendered UI change. Hidden Playwright CDP checks on the complete stack passed, including the rendered SSH add-host/test/refusal flow; see the evidence PR.

Testing

Catalog verification, Node typecheck, lazy-registry/cancellation tests, and serve/remote/CLI/mobile suites passed. Cold bundled enumeration evaluated zero implementation groups. Independent review checked 70 groups and 777 declarations. A 21-check changed gate passed before a final test-only import move. The RPC-inclusive combined gate passed 23/24 checks; its unit run exposed incomplete runtime/SSH mocks and three daemon fixture failures. After the five test-only mock corrections, all eight failing files (122 tests) passed together on both candidates. The same three daemon cases fail in a broad control at the pinned upstream base. The historical measured stack’s gate excludes this experiment; no successful full RPC-inclusive gate is claimed after the mock corrections.

Local runtime evidence is Linux x64/Electron 43.8.1. macOS physical footprint and native Windows/macOS behavior are not measured locally. Remote, folder workspace, mobile and serve contracts remain in scope; there is no wire-protocol change.

Review

Separate experimental branch; performance hold. Depends on #33892. Review this PR against its configured base branch.

Evidence and benchmark: #33912. The historical measured stack measures −4.44 MB median idle V8 heap and −5.87 MB median Linux RSS (n=3, 120 seconds, fresh hidden profiles, telemetry/GPU disabled). macOS physical footprint is unverified. M3 is a separate experiment on performance hold; M4/M5 do not make xterm/YAML cold at full idle.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer content copied.

Checklist

@OrcaWin OrcaWin changed the title perf(rpc): defer implementations behind static method metadata experiment(rpc): defer implementations behind static metadata Oct 26, 2026
Keep names, permissions, schemas and streaming metadata synchronously available,
then single-flight each implementation group on invocation. Generate metadata
from the original declarations, preserve admission checks and build switches,
and cancel retired streams before their handlers can acquire subscriptions.
@OrcaWin
OrcaWin force-pushed the OrcaWin/mem-02-ssh-boundary branch from 759b6b2 to c5f3a4e Compare October 26, 2026 10:52
@OrcaWin
OrcaWin force-pushed the OrcaWin/mem-03-rpc-boundary branch from d470aca to 5b53184 Compare October 26, 2026 10:52
@OrcaWin
OrcaWin force-pushed the OrcaWin/mem-02-ssh-boundary branch from c5f3a4e to da5e68f Compare October 26, 2026 11:22
@OrcaWin
OrcaWin force-pushed the OrcaWin/mem-03-rpc-boundary branch from 5b53184 to 4230d58 Compare October 26, 2026 11:22
@OrcaWin
OrcaWin force-pushed the OrcaWin/mem-02-ssh-boundary branch from da5e68f to c5f3a4e Compare October 26, 2026 12:01
@OrcaWin
OrcaWin force-pushed the OrcaWin/mem-03-rpc-boundary branch from 4230d58 to 5b53184 Compare October 26, 2026 12:01
@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator Author

Closing this experimental implementation because the completed full-app measurements invalidate its current performance rationale under the performance acceptance criterion.

The evidence is now preserved independently in merged #33912, in main-startup-loading-study.md. The controlled comparison adds M3 to the otherwise measured candidate and records +201 loaded main CJS files, +0.471 MB median heap, +5.906 MB median RSS, +7.557 MB reported private memory, and +2.089 MB external memory. The source graph reduction therefore did not become a full-app memory saving. The report identifies remaining eager runtime-inheritance owners and extra generated metadata/bundler partitions; the PR itself now explicitly says “performance hold; do not merge.” These are the study’s reported Linux measurements, not a claim of fresh local benchmark execution or universal native-platform results.

I checked the complete production scope: generated metadata for 70 groups/777 declarations, the group loader/registry wrappers, schema extraction, generator updates and lint exceptions all serve this same loading experiment. Single-flight/retry, metadata identity, cancellation and contract tests protect that new mechanism; there is no separate user-facing bug fix here requiring this implementation to remain open. Current main still uses the eager registry. Since the review checkout, its relevant RPC changes are unrelated clipboard upload metadata and test removals; the merged study remains the applicable evidence.

This does not reject a future coarse owner boundary or a redesigned lazy registry. Such a proposal needs a measured full-app benefit sufficient to justify the manifest, loading and first-dispatch costs. The prototype, discussion and contract tests remain available in this PR and its commits; no branch is being deleted. Closing the current measured regression keeps that future work separate from an implementation the evidence says not to land.

@OrcaWin OrcaWin closed this Oct 26, 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