Commit a2f298c
authored
* ✨ Project REPL views from durable history
Slice A of #848: the durable reconstruction kernel. Code outside the runtime can
take an array of the repository's real `Yield | Close` events and obtain a
deeply frozen view of one execution, for the whole Journal or for one inclusive
checkpoint prefix, and can address any part of that view with a URL. There is no
REPL yet — no storage, no session, no component tree, no command — and nothing
in core's execution semantics changed.
`<Elicit>` now retains the compiled schema beside its answer. The validated
answer is still the record's result and the fingerprint over schema and message
is still the only guard; the schema travels in the same description under
`executablemd.elicitation-schema`, where a source position already travels, so
`type` and `name` still decide what a replay matches. Historical inspection
needs to know which fields the person was shown, and the provider that could
have said so is not running any more. `@executablemd/core/host` publishes the
field name and a parsing reader for it, because a description is journal data
and a schema that merely looked plausible would reach a form as one.
`packages/cli/src/repl/model.ts` projects the vocabulary an ordinary execution
already appends — root and nested `import_component`, `eval`, `generated_xmd`,
`elicit`, and the root `Close` — into immutable structural values, deep-frozen,
with no REPL record, no cache, and no `DurableEvent` leaving the module. Every
retained value is detached from the event that carried it — copied, then frozen
— so the model cannot be changed by whoever still holds the events, and the
events are neither frozen nor modified by having been read: a projector that
froze its input would make a caller's own data immutable as a side effect of
being looked at. A
checkpoint marker is derived from protocol identity, `yield:<coroutine>:<ordinal>`
or `close:<coroutine>`, so the same event has the same marker in every process
that reads the file and nothing extra is written down to make that true.
Attribution is by the source path a position names: an effect whose owner is
absent, ambiguous or unreadable refuses, because a binding attached to a guessed
scope is a value shown where nothing published it.
`packages/cli/src/repl/route.ts` is the pure half of navigation. `decodeLocation`
decides only what a grammar can decide, `encodeLocation` emits one canonical
spelling, and `resolveLocation` answers with the exact objects the projection
holds. The two are separate so that a typo in a location is never answered with
a guess about the history.
Evidence runs against a journal produced by really executing the reference entry
rather than a recorded array, so the projector is held to the vocabulary the
current runtime writes. The fixture holds one of each thing this slice projects:
a durable evaluation publishing JSON, one nested component occurrence whose
source the run retains, one generated fragment admitted from a value that
evaluation published, and one validated question whose answer changes what
renders after it.
One thing the vocabulary turned out to say that a reader has to handle: the root
`Close` records three outcomes, not one — a document result, a protocol `err`
for a run that failed before producing one, and `cancelled` — so `ReplTerminal`
has three statuses and only the first carries rendered output. A serialized
`err` also carries a stack naming host paths, so the transcript shows its
message and nothing else.
* ⚡ Remeasure test weights at 970bc0d
Slice A adds `repl-model.test.ts` and `repl-route.test.ts`, so the corpus moved
and every runtime's partition was reading a fallback weight for both. Measured
by **Measure test weights** run 36270414251 against `970bc0db`, on
`ubuntu-latest`, and committed exactly as the artifact came out.
The shard counts do not move. The measured floors are 14, 8 and 4 for Deno,
Node and Bun; the installed counts are 15, 10 and 5, so each is already above
its floor and no five-run evidence asks for a change.
1 parent e9855a0 commit a2f298c
13 files changed
Lines changed: 3583 additions & 1071 deletions
File tree
- packages
- cli
- src/repl
- tests
- fixtures/repl
- core
- src
- components
- tests
- specs
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
0 commit comments