Skip to content

test: pin what a background-originated program mount cannot name (#230 E1) - #238

Merged
Huxpro merged 1 commit into
new-lynxfrom
feat/lynx-mount-program-run
Aug 30, 2026
Merged

Huxpro merged 1 commit into
new-lynxfrom
feat/lynx-mount-program-run

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

E1's opener. I went to build mount-program-run and found that the thing the issue's readiness table lists as already built — "MTS-resident compiled create" — is built only for the first screen, where the main thread renders. A background-originated mount has no way to name a resident program, and closing that gap means renegotiating an invariant #163 deliberately pinned.

This PR is the finding stated as two tests. No product code changes.

Why

The first-screen join needs no addressing at all: the main thread renders, so the applier holds the UniversalProgramPlan object itself and keys boundPrograms on it (host-driver.ts:4332). Nothing crosses a realm, so nothing has to be named.

E1 inverts the direction — the background renders a keyed range and asks the main thread to instantiate a resident program — and there is nothing for it to say:

  • The background compile never sees the program. lynxMainThreadProgramObjectAst returns null when state.universalRuntime?.thread !== 'main-thread' (compile-universal.js:4232), so the caller at :4351 falls back to lynxTemplateObjectAst and the background gets the interpreted {kind:'template', slots, create} it has always had.
  • UniversalProgramPlan carries no serializable identity (universal-core.ts:308) — no name, no index, no digest. bind and create are functions, so they are realm-local by construction and cannot travel.
  • The shared vocabulary is kind and slots. A category and a shape. Neither distinguishes two programs with the same slot map, which two rows of one table routinely have.

And the asymmetry is not an oversight — it is a tested #163 invariant. The gate directly above these new tests, changes nothing outside the main-thread lynx compile, exists precisely to keep the background chunk and universal bundle byte-identical across the backend switch. So E1 is not "add an op": it is a wire-ABI decision that has to renegotiate that promise.

mount-template-run's existing program field is not the precedent it looks like, either — it is a wire-carried template descriptor the MTS applier walks (protocol.ts:368), which is the interpretation cost E1 exists to delete, not a reference to a resident program.

Changes

Two tests in packages/octane/tests/compiler/lynx-main-thread-program.test.ts, the file whose subject is "the join, which is the part neither package can test alone":

  • one plan compiles to kind:'program' on the main thread and kind:'template' on the background, with the slot map identical — two encodings of one plan;
  • neither object carries an identifier the other could resolve, asserted over the complete key sets so a later addition cannot slip past.

Validation

  • pnpm format:check — not run repo-wide; pnpm format:files clean on the one changed file.
  • pnpm typecheck — not run; test-only change, and the file typechecks as part of the run below.
  • pnpm test — not run in full.
  • targeted: packages/octane/tests/compiler/lynx-main-thread-program.test.ts → 14 passed (was 12).
  • surrounding surface: packages/octane/tests/compiler/ + lynx-main-thread-program-first-screen.test.ts → 46 files, 1490 passed, 1 skipped, 0 failed.
  • pnpm sync clean, no generated changes.

Red-verified with the exact change E1 would make. Removing the thread gate at compile-universal.js:4232 — which is how the background would learn the program exists — turns both new tests red, alongside #163's own byte-identity gate:

× changes nothing outside the main-thread lynx compile
× compiles one plan to a program on the main thread and a template on the background
× gives neither side an identifier the other could resolve
Tests  3 failed | 11 passed (14)

Restored, 14/14. That is the point of the pair: E1 cannot quietly widen the background chunk without updating them deliberately.

Risk / follow-ups

This needs your gate before I build further, and it is the second time E1's ordering has come up.

The addressing has to be designed, and the shape of it is a build-time key emitted into both compiles so the background can name what the main thread holds. The raw material exists — both compiles walk the same state.plans in the same order from the same source, which is what makes deriveLynxMainThreadProgram's same-source derivation signature-gateable in the first place — so a deterministic key is derivable. What it costs is #163's byte-identity promise for the background chunk, and a disagreement between the two compiles would bind a mount to the wrong program, so the key has to make drift a build error rather than a runtime surprise.

I have not built that, for the same reason I stopped before the speculative compactHosts redesign in Order 3: it is an ABI decision, not a slice.

Second, restating what Order 3 measured (issuecomment-5461743426), because it bears on whether E1 is the right next step at all: E1's op reduces ~20 commands per row to one on the wire, but for create the wire is already one mount-template-run command and the cost is on the receiver — ~282 ms of clear-prepare and a 1.87× recreate penalty at 10k, both caused by a warm container falling off the compact regime. That is E2's territory, and it is where the oracle's margin is. The goal set the sequence E1 → E2 → E3 before that measurement existed; I have followed it, and this PR is the honest first step of E1, but E2-first still looks like the shorter path to create ≤ 1.0× upstream.

Also still open from the earlier slices: the harness assigned branch claude/octane-issue-66-phase-a-7wz97z, but create-a-pr mandates a feat/|fix/|docs/|test/|perf/ topic branch for the label bot. I have used topic branches throughout; say if you want the assigned name instead.

Provenance

  • An agent produced this diff (agent-authored)

Generated by Claude Code

…E1)

#230's E1 spec reads as though the addressing for a `mount-program-run`
already exists — its readiness table lists "MTS-resident compiled create"
as built. It is built, but only for the first screen, where the main
thread *renders*: the applier holds the plan object itself and keys
`boundPrograms` on it, so nothing has to be named because nothing crosses
a realm.

E1 inverts that. The background renders a keyed range and asks the main
thread to instantiate a resident program, so it has to name one. It
cannot:

- `lynxMainThreadProgramObjectAst` (compile-universal.js:4232) returns
  null off the main-thread compile, so the background falls back to
  `lynxTemplateObjectAst` and gets the interpreted `{kind:'template'}`
  description. The background compile never sees the program.
- `UniversalProgramPlan` carries no serializable identity — no name, no
  index, no digest. `bind` and `create` are functions, so they are
  realm-local by construction.
- The two compiles' shared vocabulary is `kind` and `slots` alone: a
  category and a shape, neither of which distinguishes two programs with
  the same slot map, which two rows of one table routinely have.

That asymmetry is not an oversight. It is a deliberate #163 invariant,
pinned by the "changes nothing outside the main-thread lynx compile" gate
in this same file. E1 has to renegotiate it, which makes it a wire-ABI
decision rather than an added op.

These two tests state that consequence positively so the design lands
against a checked fact. Red-verified by removing the thread gate — the
exact change E1 would make — which turns both red alongside #163's own
byte-identity gate, so E1 cannot quietly widen the background chunk
without updating them deliberately.

No product code changes.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy

Huxpro commented Aug 29, 2026

Copy link
Copy Markdown
Owner Author

Answering the open scope question (comment 5462016946): accepted in full — the readiness table overstated, cross-realm nameable programs do not exist today, and E1 is a wire-ABI renegotiation rather than an op addition. Ruling and re-sequencing (E2 → E3 → E1, E1 design issue first) in #230, comment 5465592015. Hold implementation here until that design issue exists.


Generated by Claude Code

Huxpro commented Aug 30, 2026

Copy link
Copy Markdown
Owner Author

The gate question this PR raised is answered: per the ruling on #230 (issuecomment-5465592015) E1 is re-scoped as a wire-ABI renegotiation and sequenced last, and its design issue is now #246.

This PR stays held and stays draft — deliberately. Its two tests are the guard that makes the renegotiation explicit: they go red the moment the background compile learns the program exists, alongside #163's own byte-identity gate. That is the property #246 §5 asks to retire knowingly rather than quietly, so the tests are worth more unmerged-and-red-on-demand than merged and forgotten.

One thing #246 adds that this PR left as an open shape: the deterministic key it hypothesised already half-exists. allocPlan names each plan __octaneUniversalPlan<N> positionally in walk order (compile-universal.js:2530), so plan.name agrees between the two compiles today — it is module-local, and its $-suffixing depends on the two compiles allocating the same set of plans, which is exactly the assumption E1 has to stop making and start checking. #246 §2 and §4 carry that through.

The branch-name question in this PR's follow-ups is still open and still flagged on every PR since.


Generated by Claude Code

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant