Skip to content

Track five-pass Octane audit fixes across server, SSR, compiler, bindings, and performance #967

Closed

Description

@domgan-oai

Summary

Track the follow-up to a five-pass audit of Octane's app/server path, client runtime and SSR, compiler/build adapters, React-facing bindings, and package validation. This is one coordination issue; fixes should be split into package-owned PRs with behavioral regressions and performance evidence.

Status (2026-09-08): PR #968, PR #969, PR #994, and PR #998 are merged; PR #971 closed #962. The reproduced hoisted head listener rollback is fixed by #994, which passed current-head CI. Performance and cleanup checks remain open; the separate V8 audit is tracked in #981.

The audit ran against local commit 3574f50c81f5ef831e4a0a113c6b38a3903e5c1c on feat/chat-stream-nested-host-memoization. That SHA is not available in the upstream repository. Upstream main was c6516c0752eabe2d47dc75b0e5105bd1af2a9dbc when this issue was drafted. Reproduce each item on current main before treating it as an outstanding upstream defect. The first several source patterns (server error text, static symlink handling, config cache filename, Rspack compiler creation, and SSR callback placement) were also checked on current main.

Highest priority: production correctness and containment

  • ServerRoute error disclosure: packages/app-core/src/server/server-route.js returns an exception's error.message in the production 500 JSON body. Return a generic client response while retaining server diagnostics; cover a thrown message containing a sensitive marker. PR #968
  • Static symlink containment: packages/app-core/src/server/node-http.js verifies a lexical path inside staticDir, then follows symlinks with statSync/createReadStream. An HTTP probe served a file outside the static root through an in-root symlink. Enforce the real file boundary and cover file and directory symlinks; exposure requires a symlink in the served tree. PR #968
  • Streaming injection under backpressure: packages/octane/src/runtime.server.ts can close before an accepted injection write drains; the audit reproduced a missing fragment. Preserve ordering and wait for queued writes before terminal close, including failure paths. PR #968
  • SSR callback settlement: renderToReadableStream can hang if onShellReady or error reporting throws before its deferred promises settle. Guard user callbacks and settle/release resources exactly once. PR #968
  • Imported descriptor children in Rspack/Rsbuild: packages/rspack-plugin-octane/src/loader.js does not supply isDescriptorChildrenImport to the bundler compiler. A current-source client/server transform of an imported marked Slot emitted ordinary block children; the Vite proof emitted inspectable descriptor children. Cover direct imports and re-exports in real adapter builds, including Children.only behavior. PR #968

Runtime, SSR, compiler, and binding correctness

  • Config evaluation: packages/app-core/src/config-loader.js writes a fixed octane.config.mjs and imports it with a query keyed only to emitted bytes. Two loads of unchanged source reading different environment values returned the first value twice; concurrent Rsbuild client/server loads can overwrite the shared file. Test sequential reevaluation and simultaneous config changes; use immutable emitted paths and explicit invalidation semantics. PR #969
  • Injection finalization on early abort: pre-shell cancellation and shell-write failure in runtime.server.ts skip injection.renderComplete(). An abort while use() awaited a never-settling promise rejected the stream with zero completion calls. Exercise all terminal paths against the exact-once contract. PR #968
  • Form controls: updating an uncontrolled input's defaultChecked currently changes its pristine live checked value; a controlled same-name radio group inside a ShadowRoot fails to restore after a click because cousin lookup uses document.getElementsByName. Add public-render differential cases against pinned React and inspect the related rollback lookup. PR #969
  • Head and descriptor bindings: recheck removal of hoisted title/attributes in packages/octane/src/runtime.ts, and lexical shadowing of descriptorChildren bindings in packages/octane/src/compiler/compile.js. Both produced incorrect output in the earlier audit probes. PR #969
  • Hoisted direct-listener transition rollback: a suspended render can detach a retained head element's direct listener without restoring its handler record/native listener on rollback. Merged PR #994 reproduces an aliased native-listener collision in development and production, covers replacement/removal/explicit-undefined neighbors, and passes CI.
  • Window binding: packages/window/src/components/{list,grid}/types.ts declares React ReactNode/ReactElement for Octane-rendered children and row/cell components. Four ordinary Octane JSX consumer cases failed typechecking. Also fix src/hooks/useMemoizedObject.ts: {left: 1} to {right: 1} retains the old object because only Object.values are compared. The latter is inherited from upstream react-window, but is still observable here. PR #969
  • Day Picker event types: public callbacks advertise React synthetic mouse/keyboard/focus events while DayPicker.tsrx forwards native DOM events. A type-correct callback can access nonexistent event.nativeEvent. Make its public contract match delivered values; remove the typecheck suppression where practical. PR #969
  • Redux SSR edge case: packages/redux/src/Provider.tsrx treats a falsy serverState as absent. Confirm the public state contract and cover a valid falsy value. PR #969

The TanStack Router selector-cache defect tracked by #962 was fixed in merged PR #971; #962 is closed.

Measured and source-level performance follow-up

  • SSR pending subscriptions: staggered settlement of 32 deferred thenables attached 1,056 .then callbacks during one completed stream (runtime.server.ts). Track subscriptions across waves; retain shell/segment semantics in the benchmark.
  • Effect postorder (common comparisons): Merged PR #998 short-circuits direct parent and sibling comparisons while retaining ancestry fallback and effect/ref order. Its focused 400-node sort benchmark measured 80,199 → 798 parent reads, and current-head CI passed. Profile deep disjoint branches in a full render before considering traversal or indexing; that residual question remains tracked in #981.
  • Rspack compiler lifecycle: rspack-plugin-octane/src/loader.js creates a new compiler per module and discards manifest-rule caches. A 100-module probe read package.json 300 times versus three with a shared compiler. Share within a compilation with correct option/layer invalidation.
  • Dev route lookup: rsbuild-plugin-octane/src/dev-server.js creates and sorts a router on every request even while caching the handler. A pre-#955 synthetic 1,000-route/1,000-request probe took 485 ms versus 61 ms when reused. PR perf: index dynamic app-core routes by last static segment #955 improved route matching but left per-request router construction intact; remeasure on current main and cache by manifest identity.
  • Compiler scaling: compiler/slot-hooks.js repeatedly slices the whole source for edits. compiler/compile.js repeatedly scans component graphs to fixed point: a 1,000-component forward chain required 1,000 memo-safety passes versus two in reverse declaration order. Compare a single-pass edit application and reverse-edge worklists with equivalent output.
  • Vite CSS proof scheduling: independent concurrent importers of the same CSS module can receive static versus dynamic class writers depending on inFlight timing. Coalesce safe independent requests without creating dependency cycles.
  • Broader runtime costs: benchmark global Fragment-ref rebinding, context-epoch invalidation of unrelated memo subtrees, and HMR strong-set retention of disposed blocks. Distinguish production cost from development-only memory behavior.

Cross-cutting cleanup and review gates

  • Share the development and production route hydration-payload serializer (vite-plugin-octane/src/server/render-route.js and app-core/src/server/production.js), preserving byte-level payload compatibility. — Landed in #1162, merged as 5f4b258d; development and production use the shared app-core/html helper.
  • Review the documented process-global async transition-priority window with an unrelated-root regression. Preserve intended post-await transition behavior while preventing or clearly specifying priority bleed.
  • Plan down the 101 pre-existing entries in scripts/check-source-publication.mjs (80 Node-type validation configs, 4 .tsrx projects checked by tsgo, 17 packages with untyped published JavaScript). The gate currently passes because these are tracked debt; see historical consumer report Several published TSRX source bindings fail strict consumer tsrx-tsc typechecking #721. Do not add wildcard .tsrx declarations or suppress consumer diagnostics.
  • Verify one lower-confidence candidate before adding fix scope: tanstack-virtual/src/index.ts caches only a numeric direct-DOM offset, apparently skipping the style write when switching from transform to position mode at an unchanged offset.

Completion criteria

  1. Reproduce each checked item on current main; close or annotate items already fixed or intentionally divergent. Keep separate issue/PR links next to each checklist item.
  2. Fix defects in their owning packages with consumer-visible regressions (including production compiler, SSR, adapter, and React differential cases where applicable). Do not assert private operation counts in correctness tests.
  3. For performance items, capture before/after deterministic benchmarks with semantic controls and account for per-render, per-node, SSR, compiler, and bundle costs as relevant.
  4. Run targeted tests/typechecks, pnpm sync before any push, and current-head CI for each PR. This audit did not run the full Vitest suite because the review checkout's node_modules symlink was dangling; focused current-source probes and the standalone typecheck-coverage, .tsrx declaration, and source-publication checks were used instead. Synthetic timings are directional, not release benchmarks.

Activity

  1. added
    bug
    enhancement
    agent-authored
    on Sep 5, 2026
  2. domgan-oai commented on Sep 19, 2026

    @domgan-oai
    ContributorAuthor

    The shared development/production route hydration-payload serializer landed in #1162, merged as 5f4b258d80701d70f17790d14c6ac39ec9cb3d0b. Both routes use the same app-core/html helper, preserving payload fields, defaults, build omission and inline-script escaping. Eight regression cases compare raw payload bytes across build metadata on/off, defaults and streaming/buffered rendering, normalizing only the independent per-request UUID. All 26 current-head CI jobs and Bugbot passed. The matching checklist item is checked; the remaining audit work stays open.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-authoredbugenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions