Repository navigation
feat(standalone): experimental AOT build modes - #183224
Conversation
Compile original TypeScript through the existing build entry and worker contracts, retaining native resources and lazy runtime metadata. Keep emitted-JavaScript JIT, bytecode, and AOT behavior; expose experimental trim and string-code-generation controls with explicit compiler capability checks.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
P7 reproduced a source-bridge identity issue in this head before invoking the compiler: equivalent absolute aliases in two relocated checkouts change both the context directory and semantic identity.
Using the actual exported source-entry and graph APIs with identical synthetic TS bytes/config semantics, two roots with A prepared candidate normalizes only identity preimages for checkout-contained absolute alias/cwd/string-tsconfig paths, leaving actual compiler options and recorded semantic inputs untouched. Its relocated-root probe and eight controls pass: changed owned aliases/query suffixes still invalidate identity, external paths retain their semantics, prefix-sibling paths are not mistaken for children, and define/env values are preserved. Integration still needs the owning test/type/lint/review gates. The P0 source tree was not edited because its runtime build is active. This should be incorporated at the source-bridge owner before claiming TS reproducibility. The independent JS build-ID/WASM-path/local-stamp repair is PR #183179; full-application byte identity remains an explicit P7 qualification step. |
|
Codex review: needs changes before merge. What this changesThis PR adds original-TypeScript AOT compilation and experimental compiler controls to the standalone builder. Example: A packager runs bun scripts/build-bun-standalone.mjs ./standalone-typed --aot-source.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the experimental direction is owner-approved and the previous finding is fixed, but typed-source changes can still receive an unchanged build identity. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe standalone builder consumes a completed runtime build, source files, plugin selection, and compiler options, then produces an executable, resource sidecar, and provenance manifest. flowchart TD
A[Build configurations and TypeScript] --> B[Source graph and transforms]
C[Completed runtime and resources] --> B
B --> D[JavaScript discovery graph]
D --> E[Shared build identity]
B --> F[Native AOT compilation]
E --> F
F --> G[Executable sidecar and manifest]
Technical reviewBest possible solution: Include stable typed-source and semantic-input digests in the existing shared build identity before stamping the source AOT artifact. Do we have a high-confidence way to reproduce the issue? The source shows the identity omission, and the author's reduced production-API probe demonstrates equal build IDs for different typed inputs; this review did not execute code or establish native binary differences. Is this the best way to solve the issue? Reusing build configurations, resource planning, and the shared identity owner is appropriate, but the identity must cover every input consumed by native compilation. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 33d229b35cf2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceTests +4288, Docs +49, Other +3529. Total +7866 across 53 files. Added test files: 12. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 25, 2026, 12:48 AM ET / 04:48 UTC (Revision 2). |
|
P7 found a second original-TS build-identity issue at current head A reduced probe using the actual source-graph and shared compilation APIs compares these two inputs: export function identity(value: number): number { return value; }
export function identity(value: string): string { return value; }Node type erasure produces identical JS bytes. The actual graph records different The immutable bundled-plugin fingerprint uses that build ID. The original-source digest therefore needs to participate before stamping, using stable checkout-relative names/config identity and sorted original/transformed source hashes. Retain the emitted-JS digest and same-ID standard/support contract. This is separate from the previously reported absolute-alias relocation defect; P7 has a reviewed-path candidate for that defect in progress and can carry the owner repair after this port lands. No changes were made to the frozen P0 build checkout or artifacts. Follow-up: the focused five-file repair is now validated against the repaired owner and the adopted path fix. The actual support-owner regression fails at the expected unchanged build ID before the repair; all 78 affected tests, both required test type leaves, scoped lint and formatting pass afterward. Independent review is scoped-clean at P0–P2. The digest covers recorded runtime graph inputs and normalized contexts; declarations/type-only/config bytes outside that graph remain outside this proof. P7 is retaining this as a follow-up to the source port rather than opening a duplicate port PR. |
|
Addressed the source-context identity finding in 5c12cad. Checkout-contained absolute alias, cwd, and string-tsconfig paths are normalized only in hash inputs; compiler options and recorded semantic inputs remain unchanged. The regression fails on the preceding head for context IDs, semantic hashes, and embedded entry paths. With the correction, all 69 affected graph/entry/module-URL/native-resource tests pass, both relevant test type-check scopes pass, scoped lint/formatting pass, and independent review found no actionable issues. External paths, query suffixes, and separate configuration owners retain their distinctions. Full executable reproducibility remains a separate qualification. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* feat(standalone): experimental AOT build modes Compile original TypeScript through the existing build entry and worker contracts, retaining native resources and lazy runtime metadata. Keep emitted-JavaScript JIT, bytecode, and AOT behavior; expose experimental trim and string-code-generation controls with explicit compiler capability checks. * test(standalone): remove duplicate metadata fixture binding * fix(standalone): normalize source context path identities
Related: #183143
What Problem This Solves
The standalone builder needs a reproducible way to compile original TypeScript and select experimental AOT compiler controls without carrying a separate application patch stack.
User Impact
Developers can select
--aot-source, trimming, function-source retention, and string-code-generation restrictions with an AOT-capable Bun. JIT and bytecode keep their full emitted-module inventory, and emitted-JavaScript AOT retains--compile-aot. These modes are experimental, leave the production Bun pin unchanged, and require separate per-platform runtime/signing qualification before shipping.Why This Change Was Made
Build configurations now own source-to-emitted identities, including isolated plugins and postbuild rewrites. The source bridge preserves types, package scopes, and named entry contracts while consuming current worker manifests, WASM inventory, plugin loading, native resources, and lazy metadata tables. It refreshes the complete lazy lookup expression after source discovery.
Source AOT rejects
--support-outputbefore staging: its JIT companion would need another discovery compilation after final aliases are known. Build an independent JIT control from the same commit instead. Existing emitted-JavaScript AOT support companions remain supported.The integration preserves main's content-derived build identity and relative WASM imports from #183179. The TS AOT callback shares the same resource and provenance owner as emitted-JavaScript builds.
Source context identities normalize checkout-contained absolute alias, cwd, and string-tsconfig paths before hashing. Compiler options and recorded semantic inputs remain unchanged; external paths, query suffixes, and different configuration owners keep their distinct semantics.
Evidence
Native artifact smoke/signing qualification is tracked separately; these source checks do not establish macOS or Linux shipping readiness.
The relocated-checkout regression fails on the preceding head for context IDs, semantic hashes, and embedded entry paths, then passes with the source-owner correction. All 69 affected graph, entry, module-URL, and native-resource tests pass, as do both scripts and tooling test type-check scopes. This establishes stable source inputs for that case; full native executable reproducibility remains a separate qualification.
CI follow-up: the original head exposed strict type errors in new test fixtures. The fixtures now use the current tsdown and manifest-worker APIs, and the failing test-scripts type leaf passes. The integration also removes a stale test-only build identity argument after #183179. The focused follow-up passes 95 support/native/contract/WASM tests, 61 source-bridge tests, and six artifact-adapter tests. The application build at the original head completed in 764 seconds. A CodeQL alert on first-newline replacement is addressed with explicit shebang insertion; exact-head CI remains the final gate for the updated branch.