Skip to content

perf: preserve private Context proofs across split templates - #1160

Merged
domgan-oai merged 2 commits into
octanejs:mainfrom
openai-oss-forks:codex/perf-private-context-split-provenance-20260919
Sep 19, 2026
Merged

domgan-oai merged 2 commits into
octanejs:mainfrom
openai-oss-forks:codex/perf-private-context-split-provenance-20260919

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Preserve the production compiler's existing closed-module Context lifetime proof through compiler-owned split Hydrate capture modules. Exact original provider tags and generated capture binding IDs keep private providers on the existing compiled output path; exported, escaped, shadowed or authored-override identities retain general rendering. No runtime or public ABI changes.

Against measured main 068ead53d23feeaae0a6d8b2bf3bb3fad5eb4499 (landed #1155/#1157), the same complete button-only consumer shrinks from 92,428 to 65,715 gzip bytes (-26,713). Its values, native update identity and mount/cleanup match. All seven stock/export and fifteen public/model/SSR/used-signal controls have identical bundle SHA and raw/gzip/Brotli bytes. The matched predecessor incorporates docs-only main 95e6674e2d1d2c485e7a80bb16ff3126e6e92aa5. Main95’s 204 Octane source files, package.json and lock are identical to measured main068; candidate files match the validated immutable candidate snapshot. The committed report pins fixtures, sources, toolchain, runners, public results and limitations.

Validation

  • pnpm format:check (repository-wide not run locally)
  • pnpm typecheck (repository-wide not run locally)
  • pnpm test (repository-wide not run locally)
  • Final targeted tests: 136 owning/nearby Vitest results across normal/production projects, four CI-wired Node compiler/whole-consumer guards, and the actual ci:workflow:test 218 Node results.
  • Three fresh main068 matched production Vite/Chromium consumers × baseline/candidate (six executions): authentic dormant SSR adoption/current Context update, obsolete suspended work retirement, and late model handle update/draft/focus/caret identity/cleanup plus exported descriptor/ordinary-output controls. Pre-navigation console warning/error and page-error capture stayed empty.
  • Four historical main0b meaningful RED mutants, exactly restored: lost certificate, shifted capture ordinal, omitted private provider publication and invalid exported-lifetime acceptance. Same compiler patch blobs; current frozen parser AST/location checks passed.
  • Scoped compiler/public types, separate benchmark .tsrx types, changed-file formatting, changeset and sync checks. No generated/unrelated diff.

The PR is ready for review; latest-head full CI is tracked below. The throwaway Git-fixture workflow tests used process-scoped signing disablement only for fixture commits; no authored commit/config uses that override.

The initial full main068 run passed 135/136, missing the dev nested provider's inner text after update. The unchanged isolated case passed both projects, then one unchanged full rerun passed 136/136. No source/assertion/deadline changed. That exact fixture's dev/HMR object-registry parent and five sidecars are byte-identical between base/patch, and the selected runtime hashes match; this does not establish the cause of the initial loaded-run failure.

Risk / follow-ups

This addresses an exact closed Context capture seam; it does not certify arbitrary imported components or eliminate all unused-signal/generic renderer bytes. A historical main0b shared imported Reader control retained a separate componentSlot(Reader) edge and saved only 62 gzip bytes; it was not repeated on main068. Before #1155 landed, the same fixture's Context-only patch on main929 saved 30 gzip; the material measured delta uses the now-landed Hydrate policy.

The extra original-lifetime proof adds compiler analysis. A historical main0b 12-pair sample observed parent+query medians 9.092→10.298ms / 13.756→14.806ms on two actual Context corpora, with paired ratios1.059/1.033 and IQRs crossing1. No current-base CPU speedup or zero-cost claim. Ordinary Vitest scalar→handle and nested identity assertions also fail on unchanged-main controls; source-selected bundled/native identity proof is reported separately, with no runtime workaround.

Related to #1118 and the unused-signal/generic graph discussion in #1130; this does not close the compound checklist.

Current base and CI

Signed normal merge d630679ec49f4846a17e4c2a692b77aab162d823 includes live main 40ff19fcf39839714f02f2dc6bfa9e9fbd2f38cd (landed SSR Frame fix #1152). Both the incoming SSR guard and this PR’s own guard list are preserved without duplicates. Refreshed local checks pass: 18 public cases, 220 actual workflow guards, scoped package formatting, changesets, pnpm sync and diff checks. All 204 source hashes are stable; incoming runtime.server.ts is exactly main40ff, and this PR’s existing client/compiler patch is unchanged. No new byte or CPU claim is made by this merge. Full current-head CI run 35467472675 passes (26 successful jobs). Current-head Bugbot passes; no unresolved review threads.

Provenance

  • An agent produced this diff (agent-authored)

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Medium Risk
Compiler-only but changes Context provider codegen on split-hydration paths; incorrect certification could mis-route providers, though proofs are narrowly gated and heavily tested.

Overview
Extends the production compiler so closed-module private Context proofs still apply after <Hydrate> splits a child module. During boundary extraction it re-derives the original lifetime proof, records generated capture binding IDs for provider tags moved into capture slots, and only then routes those providers through the existing __createCompiledContext / componentSlotVoid path when lexical resolution matches the original binding.

Exported, escaped, shadowed, or override-heavy contexts (e.g. authored children, spreads, __* attrs, dev/HMR/server modes) stay on generic componentSlot rendering—no runtime or public ABI changes.

Adds benchmark fixtures, a size-audit runner, boundary Node tests (wired into ci:workflow:test), hydration Vitest coverage, pinned evidence/report for the closed split consumer (~−27KB gzip with unchanged semantics), and a patch changeset.

Reviewed by Cursor Bugbot for commit d630679. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant