Skip to content

docs: plan the dedicated Lynx compiler backend (#1055) - #1699

Merged
trueadm merged 1 commit into
mainfrom
docs/lynx-compiler-backend-plan
Oct 4, 2026
Merged

trueadm merged 1 commit into
mainfrom
docs/lynx-compiler-backend-plan

Conversation

@trueadm

@trueadm trueadm commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds docs/lynx-compiler-backend-plan.md, the plan for #1055: a dedicated target: 'lynx' compiler backend that removes Lynx's dependency on universal host-plan interpretation.

  • The plan was written on 2026-10-01 against da9b1e46c and never committed. Its worktree was later reused and the file was lost, so it was recovered from that session's transcript. Committing it here keeps that from happening again.
  • It has been refreshed against 76b5b02671, 179 commits later. §2.7 lists what moved:
    • perf(octane): ship universal host bindings and template programs only to renderers that use them #1652 put template programs and host bindings behind opt-in supports, so retiring them for Lynx no longer needs a universal-core refactor.
    • The hook ranges in universal-core.ts shifted by about 1,000 lines.
    • Every universal gate in the compiler is unchanged in substance, at new line numbers.
    • Strong gained new families, which all run in the shared front end.
    • lynx-bundle-size budgets were reset.
    • The fork's head is unchanged and is now 671 commits behind.
  • §2.6 records the root cause of both weekly lynx-render failures: fix(lynx): serialize cross-thread transport payloads #885. The fix is still uncommitted, and it is a prerequisite for Phase 1.
  • §10 records the maintainer's decisions from 2026-10-04. Every recommendation was taken:
    • build on main, and port the Huxpro/octane:new-lynx fork in reviewed slices with attribution;
    • phase order: measure, then extract the kernel and spike, then build the compiler;
    • hook state ships before signals and Strong;
    • an explicit whole-application backend choice, with no fallback;
    • two ABI integers plus a pair digest;
    • the owner kernel lives at octane/internal/owner-kernel;
    • the fix(lynx): serialize cross-thread transport payloads #885 fix lands as its own PR;
    • lynx-render --quick runs report-only on pull requests.

This PR is documentation only. No code changes, so no changeset.

Refs #1055

Validation

  • pnpm format:files:check docs/lynx-compiler-backend-plan.md
  • pnpm sync (no generated changes)
  • pnpm format:check, not run (one Markdown file changed)
  • pnpm typecheck, not applicable (docs only)
  • pnpm test, not applicable (docs only)

Risk / follow-ups

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


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


Note

Low Risk
Documentation-only change with no product behavior, build, or deployment impact.

Overview
Adds docs/lynx-compiler-backend-plan.md, committing the approved plan for #1055 so it is not lost again. The doc was recovered from an earlier session and refreshed against current main (§2.7), including how #1652 opt-in supports affect Lynx retirement and updated compiler line references.

It specifies a future target: 'lynx' path (compile-lynx.js, Lynx template IR, owner-kernel extraction, compiled wire ABI, eight implementation phases), coexistence via an explicit backend choice, and maintainer decisions in §10 (fork port strategy, phase order, ABI versioning, no universal fallback). It also documents lynx-render gaps, the #885 benchmark prerequisite, and follow-ups (separate fix PR, then Phase 1 harness work).

No runtime or compiler code changes in this PR.

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

Commit the #1055 plan so it can no longer be lost with a reused worktree.
The 2026-10-01 draft is refreshed against main 76b5b02 and records the
maintainer's 2026-10-04 decisions: build on main and port the
Huxpro/octane new-lynx fork in reviewed slices, measure before the
compiler work, ship hook state before signals and Strong, use an explicit
whole-application backend with no fallback, use two ABI integers plus a
pair digest, and put the owner kernel at octane/internal/owner-kernel.

Refs #1055

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm marked this pull request as ready for review October 4, 2026 15:05
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent docs PR: documentation only labels Oct 4, 2026
@trueadm
trueadm merged commit 9952f4e into main Oct 4, 2026
42 checks passed
@trueadm
trueadm deleted the docs/lynx-compiler-backend-plan branch October 4, 2026 15:27
KevinVandy pushed a commit to KevinVandy/octane that referenced this pull request Oct 9, 2026
* feat: add @octanejs/tanstack-db binding

Port the Octane live-query bindings for @tanstack/db (TanStack/db PR octanejs#1699,
`packages/octane-db`, still open) into the monorepo as `@octanejs/tanstack-db`.

- Re-exports @tanstack/[email protected] unchanged; adapts the live-query surface
  (useLiveQuery, useLiveInfiniteQuery, useLiveSuspenseQuery, useLiveQueryEffect,
  usePacedMutations) onto Octane hooks. Source imports only public @tanstack/db.
- Package shape matches sibling bindings: exports point at src/ (no dist build),
  self-contained tsconfig (jsxImportSource octane), status.json.
- Tests decoupled from the db monorepo: internal src imports rewritten to
  @tanstack/db; test helpers, the conformance suite, and db's expression
  evaluator vendored under tests/db-fixtures/ (pinned to 0.6.17, test-only) so
  the infinite-query tests can interpret the where/cursor IR db generates.
- Wired into vitest.config.js and the root typecheck script; registered in
  website/src/content/bindings.json; changeset added.

Generated inventories (docs/packages.md, docs/bindings-status.md, CLI data,
react-parity lockfile hashes) are intentionally omitted from this diff and
should be regenerated with `pnpm sync` at merge time.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(tanstack-db): move @octanejs/tanstack-db to TanStack DB 0.7.0 and fix live-query blockers

Rebinds the binding to the TanStack DB 0.7.0 adapter architecture and fixes the
PR review's P1 blockers at the source:

- Suspense suspends via Octane `use(thenable)` instead of `throw promise`
  (Octane Suspense only recognizes the use() sentinel). Proven by an async
  fallback regression test.
- useLiveQuery/useLiveSuspenseQuery rebuilt on db's shared createLiveQueryObserver
  (db octanejs#1642) so status-only transitions (error/cleaned-up) update isError/
  isCleanedUp.
- useLiveInfiniteQuery rebuilt on the coordinated createLiveQueryWindowController
  (db octanejs#1675): window leases stop two hooks on one collection truncating each
  other (regression test), and a failed page load rolls back and surfaces
  snapshot.error with a clean retry.
- useLiveQueryEffect parses deps + the compiler slot together from ...rest, so
  no-deps usage keeps its call-site slot.
- Conformance suite: drop order-only-move from universal expected-fail (db octanejs#1669
  fixed the contract); un-skip the missing-orderBy test (surfaced synchronously
  during render via getWindow()); record StrictMode double-invoke as
  not-applicable. Committed-test-marker gate passes.
- Bump @tanstack/db ^0.6.17 -> ^0.7.0; re-pin vendored db-internal fixtures;
  vendor the @tanstack/[email protected] adapter source under upstream/ with
  SHA256SUMS; add UPSTREAM.md pin + crosswalk; refresh status.json/README.

Octane-adaptation: the subscribe wrappers defer an initial onStoreChange to a
microtask because Octane's useSyncExternalStore re-checks the snapshot before
(not after) subscribe; pinned by the eager-onstorechange test.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(tanstack-db): call use() unconditionally in useLiveSuspenseQuery; document startSync divergence

Addresses two Cursor Bugbot findings on the 0.7.0 remediation commit.

- [High] useLiveSuspenseQuery called use() only on the loading/idle path and
  skipped it once ready. Octane keys use(thenable) by dynamic call-order index
  (runtime __thenableIdx), not by compiler slot, so a ready hook that skips its
  use() shifts the thenable index of a sibling use()/second useLiveSuspenseQuery
  in the same component. On the replay after the first query resolves, the
  second hook read the first's fulfilled thenable (resume-replay leniency path)
  and stopped suspending, surfacing its still-loading collection as ready. Fix:
  call use() unconditionally — exactly once per render — handing it an
  already-resolved sentinel on the ready/stale paths so the call-order index
  stays stable and no suspend occurs. New regression test drives two
  independently gated collections and asserts the later sibling stays suspended
  while the earlier one is ready (fails pre-fix with `a:3|b:0`).

- [Medium] Documented the useLiveInfiniteQuery `startSync: true` divergence in
  status.json. The query-function collection is created with the first-page
  window already applied (.limit(pageSize + 1).offset(0)), so eager sync fetches
  exactly the first page — never a wider subset — before the window controller
  grows it; only the fetch-start timing differs from upstream's post-commit
  start. (Bugbot's third finding, "stale pages after deps change", was against
  the pre-remediation commit and no longer applies: the controller rewrite
  computes page count synchronously during render.)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(tanstack-db): pre-tag the useLiveSuspenseQuery ready-path sentinel as fulfilled

Follow-up to the unconditional-use() change. The shared `SETTLED` thenable handed
to `use()` on the non-loading paths was a bare `Promise.resolve()`. Octane's
`use()` tags an untagged thenable `'pending'` synchronously (its fulfillment
callback runs a microtask later), so the first `use(SETTLED)` on the ready path
suspended and flashed the Suspense fallback even though data was already ready.

Give `SETTLED` the React 19 `cache()` settled shape (`status: 'fulfilled'`) so
`trackThenable` leaves it untouched and `use()` returns synchronously without
suspending. New regression test preloads a collection to `ready` before mount so
the first render takes the ready path, and asserts the fallback never renders
(fails pre-fix: first commit shows `Loading...` instead of `ready:3`).

Reported by Cursor Bugbot on the previous commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(tanstack-db): defer infinite query sync until commit

* fix: repair tanstack db CI integration

* fix: complete tanstack db CI integration

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: Dominic Gannaway <[email protected]>
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 docs PR: documentation only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant