Repository navigation
fractal: bundle and render program missions in the tree loader - #6304
Open
schickling-assistant wants to merge 9 commits into
Open
schickling-assistant wants to merge 9 commits into
schickling-assistant wants to merge 9 commits into
Conversation
…e data DSL StepSchema.program renders `program "/abs" sha256=… stalled-after=…?` and refuses an assignee, gates, products, exec or a produced or used mission, and finally steps. MissionSchema gains `concurrentRuns` and an `authority` block (publish, start, revise, write) rendered in the native parser's canonical order.
loadSubjectTree({ bundleDir }) bundles each Fractal.mission(intent,
program) with bun build --target=bun from the tree root into
<bundleDir>/<sha256>.mjs, checks the bundle's default export carries the
program entry, and loads the mission as its declaration: one text input
per input field and one program step pinning the bundle. The landing
fixture renders against a golden; builds are deterministic.
…name it into place
…ect ID from the file
schickling-assistant
marked this pull request as ready for review
November 10, 2026 18:31
…-program-loader # Conflicts: # packages/fractal/COVERAGE.md # packages/fractal/README.md # packages/fractal/src/tree.ts
schickling
temporarily deployed
to
evidence-signing
November 10, 2026 23:38 — with
GitHub Actions
Inactive
schickling
temporarily deployed
to
evidence-signing
November 10, 2026 23:38 — with
GitHub Actions
Inactive
schickling
temporarily deployed
to
evidence-signing
November 10, 2026 23:38 — with
GitHub Actions
Inactive
schickling
temporarily deployed
to
evidence-signing
November 10, 2026 23:38 — with
GitHub Actions
Inactive
Contributor
Author
|
Delta review record for head
|
schickling-assistant
enabled auto-merge
November 10, 2026 23:39
schickling
had a problem deploying
to
evidence-signing
November 10, 2026 23:44 — with
GitHub Actions
Failure
schickling
temporarily deployed
to
evidence-signing
November 10, 2026 23:52 — with
GitHub Actions
Inactive
schickling
temporarily deployed
to
evidence-signing
November 10, 2026 23:52 — with
GitHub Actions
Inactive
schickling
temporarily deployed
to
evidence-signing
November 11, 2026 00:14 — with
GitHub Actions
Inactive
Contributor
Author
|
Delta review record for head
|
schickling
temporarily deployed
to
evidence-signing
November 11, 2026 00:42 — with
GitHub Actions
Inactive
schickling
temporarily deployed
to
evidence-signing
November 11, 2026 00:44 — with
GitHub Actions
Inactive
schickling
temporarily deployed
to
evidence-signing
November 11, 2026 00:44 — with
GitHub Actions
Inactive
schickling
temporarily deployed
to
evidence-signing
November 11, 2026 00:45 — with
GitHub Actions
Inactive
schickling
temporarily deployed
to
evidence-signing
November 11, 2026 00:51 — with
GitHub Actions
Inactive
schickling
requested a deployment
to
evidence-signing
November 11, 2026 01:15 — with
GitHub Actions
In progress
schickling
requested a deployment
to
evidence-signing
November 11, 2026 01:15 — with
GitHub Actions
In progress
This branch is being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fractal.mission(intent, program)(fractal/effect, #6266) defines a program mission, but nothing turned one into something the daemon can publish. The engine runs aprogramstep that pins a bundle by sha256 (docs/st3/program-engine.md§3, §4), andfractal applycarries that bundle (#6264). The package's tree loader refused program modules: a program mission has nosteps, soMissionSchemadecoding failed. The data DSL could not expressprogram,authorityorconcurrent-runseither.Goal
The M2 publication path, TypeScript side.
loadSubjectTreebundles every program mission it finds and loads it as a declaration that renders as KDL.fractal validateandfractal applythen take that KDL with no other step.Decisions
StepSchema.programtakes{ bundle, sha256, stalledAfter? }and rendersprogram "/abs" sha256=… stalled-after=…?. As in the native parser, a program step may not have an assignee, gates, products, a produced or used mission, or be afinallystep; it also may not haveexec.MissionSchema.concurrentRunsrendersconcurrent-runs max=N.MissionSchema.authorityis{ publish?, start?, revise?, write? }, each a non-empty list of unique patterns, exact or ending in/*. Mission verbs refuse amission/prefix. The block renders in the parser's canonical order (verb, then pattern), so reordering the rules does not change the revision. The native grammar also hascancel, which is not offered here, since a run never cancels another one. The native parser checkswritesubjects against the schema registry; this package only checks their shape.loadSubjectTree({ root, context, bundleDir?, bun? }). When amission.tsdefault export carriesSymbol.for('fractal.program.v1'), the loader does the following:idequals the directory, and that everyinputfield is required and encodes to a string.bun build <module> --target=bun --format=esmwith the tree root as cwd, hashes the output and writes it to<bundleDir>/<sha256>.mjs.{ id, state: 'ready', reportTo, goal, timeout?, concurrentRuns?, authority?, inputs: one text input per field, steps: [{ id: 'program', timeout?, program: { bundle, sha256, stalledAfter? } }] }. That declaration goes through the existingmissionWire→MissionSchemapath, soemit([mission(intent)])renders it.bundleDir, or a relativebundleDir, is refused.fractal/effectruntime and the program's own imports. Bundles are content-addressed files, so a rebuild writes the same file.timeoutbounds both the mission and its program step.stalledAfterbecomes the program'sstalled-after, i.e. journal progress.concurrentRunsandauthorityare new optional fields of the program intent.Verification
On the Linux build host in
nix develop .#web(bun 1.4.2), at head ad1b75d:The skipped loader test is the
ST_BINnative check. It ran separately with afractalbinary built from #6264's branch:src/program-loader.unit.test.tscontains these tests:fixtures/programs/factory/land-program) renders byte for byte tofixtures/land-program.kdl, with the bundle directory shown as/bundles. The written bundle's bytes hash to the pinned sha256.bundleDir; a declared id other than the directory (fixtures/program-refusals/id-mismatch); a number input (fixtures/program-refusals/number-input); a bundle whose default export is not a program; a module Bun cannot build; a missing Bun.concurrent-runsrender exactly. The program-step outcome conflicts, afinallyprogram step, a relative bundle path, an uppercase sha256, malformed authority patterns, duplicate rules, an empty block andconcurrent-runs max=0are refused.ST_BIN,fractal validateaccepts the rendered KDL and refuses it once the bundle's bytes change.The golden is sensitive to the bundle's contents. Running oxfmt on the fixture changed the sha256, and the golden caught it.
Formatting: the changed files pass
oxfmtwith the effect-utils config. Pushed withST_EVIDENCE_LOCAL=off; hosted CI at the exact head is the proof.Complexity
The changes span three areas: the data-DSL grammar in
mod.ts(+124), the loader and bundler (tree.ts+125,program-bundler.ts89), and tests with fixtures. Bundling is a small Node module that spawns Bun, the sameEffect.callbackspawn patterntesting.tsuses. The loader reuses the existing declaration path rather than adding a new subject variant.Concerns
fractal/effect, the data DSL it imports throughagent.ts, Effect, or Bun.FRACTAL_UPDATE_GOLDENS=1 pnpm --filter fractal testrewrites it, and the README says so.../../../../node_modules/effect/...). A different Bun version produces different bytes and therefore a new revision. That is correct, but worth knowing.bun(on PATH or via thebunoption) at render time. Trees without program missions are unaffected.agent.tspulls in forreportTo.Friction & bottlenecks
fractalbinary had to be built from that branch on the build host for theST_BINtest. The cold debug build offractal-clitook 6m 02s on the build host.Follow-ups
docs/st3/program-engine.md§4 (versioning,fractal applybundle carriage) is rewritten by Program engine M1.1a: declare program steps and carry their bundles through apply #6264, so this PR leaves §4 alone to avoid a conflict. The publication path is documented in §11 instead. Once both PRs are in, §4 can link to it.crates/fractal/tests/validate.rsonce Program engine M1.1a: declare program steps and carry their bundles through apply #6264 is on main. That needs the bundle file to exist at its path, so it fits a test that renders first, as theST_BINtest does.References
docs/st3/program-engine.md§3, §4, §11; build plan M2.