Repository navigation
Commit c00fa82
authored
* ✨ Add source-bundle workflow identity
A workflow definition can now be the source itself. The v2 descriptor
addresses exact bytes by logical path, so a file outside a repository, an
untracked file and a modified tracked file all have one immutable identity
before anything retains them.
Identity is two domain-separated, length-framed SHA-256 computations over the
entrypoint, the canonical source manifest and the component mapping, through
the platform's own `crypto`. The exact target stays outside the bundle hash
and inside the definition: selecting a section does not change the bytes in
the bundle. Host paths, props and retrieval metadata are not members of the
shape at all.
Parsing is closed and canonical. Logical paths are NFC scalar values without
NUL, C0, DEL, backslash or `#`; manifests arrive in UTF-8 byte order with no
duplicates, and a parser refuses a malformed order rather than sorting it.
Snapshot verification copies the caller's buffers before checking them, so a
later mutation of a caller-owned array cannot change what a run would retain.
`WorkflowDefinition` stays v1-only here, so existing storage and runtime code
remains coherent; storage, lifecycle, journals and artifacts become
version-aware in the next commit.
Refs #443
* ✨ Retain source-bundle workflow runs
A workflow run can now be a run of the bytes it retains. Storage, lifecycle,
journals and artifacts each became version-aware by their own identity rather
than by widening version 1's, so a Git run keeps exactly the schema, record,
descriptor, journal value and artifact bytes it always had.
Live storage gains a second immutable inventory. Version 2 keeps every
version-1 object byte for byte, replaces `workflow_run` with one that has no
base column, and adds the two definition-source tables. Recognition reads the
application id, then dispatches on version 1 or 2 and holds the whole inventory
to that version's declaration: a hybrid, an extra object or version 0 is the
file disagreeing with itself, never a migration candidate.
Creating a version-2 run crosses only the trusted lifecycle transition. Public
`WorkflowRunStorage.create()` stays version-1 and refuses a source-bundle
descriptor, because that request carries a descriptor and no bytes. The
transition copies the caller's buffers and holds them to the descriptor before
the transaction opens, then writes schema, run, manifest, de-duplicated content,
Workspace, lifecycle and the first execution together or not at all.
Source is proved before anything moves. A version-2 run's content is re-derived
from its own store — every length, every source hash and the bundle hash — and a
missing entry, damaged content or a disagreeing hash refuses with the run's
lifecycle and journal untouched. A version-1 run's content crosses the
host-captured `LegacyWorkflowSourceReader`, which is a direct closure reachable
through no Context, Api, component or Plugin; Workflow recomputes the returned
root and component blob identities from the bytes themselves before any of it
counts as this run's. A creation is held to its own descriptor before
persistence, so a host that cannot obtain a Git definition's Markdown never
reaches the transaction that would make the run exist.
The public and durable `WorkflowRun` is one closed union. Version 1 keeps its
exact three members; version 2 records `definitionVersion`, `bundleHash` and its
exact target and invents no base or pinned commit. Readers accept either exact
member set in any key order and nothing between them.
Artifacts keep the physical container at version 1 and dispatch the semantic
format from the header. Format 1 keeps its manifest, identity domain and Git
closure byte for byte; format 2 has manifest version 2, the `xmd-artifact\0v2\0`
domain, its own closed inventory, and one entry/content pair per logical source.
The writer selects the format from the run's version and the reader verifies
only the format its header declares.
Refs #443
* ✨ Start workflows from retained source
`xmd workflow start ./notes.md` now runs the file's current bytes. A file
outside a repository starts, an untracked file starts, and a modified tracked
file runs what it says rather than what its last commit said — because the run
retains those bytes before it becomes durable, and a record naming a commit
while executing something else was the thing that could not be true.
Establishment reads the supplied root once. The logical entrypoint is the
file's own final segment, normalized; the containing directory, the absolute
path and the invocation working directory never reach the descriptor. Declared
components are resolved against the root's own directory, read as bytes,
decoded strictly and parsed — so a declaration this command cannot read refuses
the start before any storage exists, rather than surfacing the first time a
document writes the name. Every source's identity is the hash of the bytes that
were actually read, and the descriptor is parsed back through storage's own
closed parser before it is offered to anything.
Git is provenance now, not retrieval. A start records where it happened when
that is cheaply available, as replaceable metadata; a directory that is not a
working tree simply has none, and the start is an ordinary start. Nothing reads
it back to find a source.
After admission the CLI executes the closure the lifecycle authenticated and
nothing it read itself. The run id is reported only once the creation
transaction has committed, and the post-admission reloads are gone: a candidate
that remained a second path to execution would be a second answer to what the
run is a run of.
`workflow-source.ts` is now only the legacy version-1 Git reader, captured by
the Deno host on both the run-host and lifecycle installations and reachable
through no Context, Api, component or Plugin. It maps an unreadable object into
the categorical failure Workflow declares for it and judges nothing else:
Workflow recomputes the returned blob identities itself.
Status and history render a source-bundle run by its entrypoint and bundle
hash, with no base line and no fabricated commit.
Refs #443
* 📝 Specify source-bundle workflow durability
A workflow definition is two versions now, and the five authoritative documents
say so. Version 2 is a source bundle: the exact bytes themselves, addressed by
logical paths and retained with the run, so a file outside a repository, an
untracked file and a file edited since its last commit all start and all stay
runnable after the original is edited, moved or deleted. Version 1 is unchanged
in shape, identity, behavior and bytes, and nothing migrates between them.
`specs/workflow-spec.md` states the closed descriptor union and its dispatch by
kind, the logical-path grammar, the domain-separated source and bundle hashes
and what each commits to, the target's exclusion from the bundle hash and its
place in identity, per-version compatible reuse, the two immutable live schema
versions and their recognition, what a retained source has to prove, the
creation union with its owned copies and one atomic transaction, the order that
puts every source check before recovery and admission, the legacy source reader
and its validation, and the five source refusals.
`specs/xmd-artifact-spec.md` keeps the physical container at schema version 1
and splits the semantic format: format 1 retains its manifest, identity domain
and Git closure byte for byte, and format 2 declares its own manifest version,
`xmd-artifact\0v2\0` domain, closed inventory and one entry/content pair per
logical source. The reader selects the verifier from the header and never reads
one version's closure as the other's.
`specs/workflow-workspace-spec.md` states the start ordering, the boundary that
proves source before recovery, execution records, Workspace attachment or
replay, the reference grammar `start` accepts, the fork candidate's independence
from the source run and from every file it was read from, and the status shapes
that carry no fabricated Git fields.
`architecture.md` records the terminology, the two live schema versions, the CLI
candidate against the authoritative retained source, and the inventory rows for
the definition, the reader and both artifact formats.
Two things are stated as undelivered rather than described as done: the
artifact-backed fork, which this revision supplies the authenticated source
input for, and #822's extraction of `workflowInstallation({ base })` — still the
one place this package reaches Git to establish a run.
Refs #443
* 🐛 Narrow v1-only test hosts
* 🐛 Install the legacy source reader in v1 CLI test hosts
* 🐛 Split the Deno-only source-bundle fork tier into its own file
* 🐛 Settle a committed run interrupted from the executor hold
1 parent 2231b64 commit c00fa82
75 files changed
Lines changed: 8151 additions & 1136 deletions
File tree
- packages
- cli
- src
- tests
- support
- workflow
- src
- deno
- artifact
- lifecycle
- storage
- tests
- support
- scripts
- tests
- specs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1624 | 1624 | | |
1625 | 1625 | | |
1626 | 1626 | | |
1627 | | - | |
1628 | | - | |
1629 | | - | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
1630 | 1630 | | |
1631 | 1631 | | |
1632 | 1632 | | |
| |||
1961 | 1961 | | |
1962 | 1962 | | |
1963 | 1963 | | |
1964 | | - | |
| 1964 | + | |
1965 | 1965 | | |
1966 | 1966 | | |
1967 | 1967 | | |
| |||
2035 | 2035 | | |
2036 | 2036 | | |
2037 | 2037 | | |
2038 | | - | |
2039 | | - | |
2040 | | - | |
2041 | | - | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
2042 | 2042 | | |
2043 | 2043 | | |
2044 | 2044 | | |
| |||
3044 | 3044 | | |
3045 | 3045 | | |
3046 | 3046 | | |
3047 | | - | |
3048 | | - | |
3049 | | - | |
3050 | | - | |
3051 | | - | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
3052 | 3052 | | |
3053 | 3053 | | |
3054 | 3054 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
66 | | - | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
43 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
44 | 54 | | |
| 55 | + | |
45 | 56 | | |
46 | 57 | | |
47 | 58 | | |
| |||
61 | 72 | | |
62 | 73 | | |
63 | 74 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
| |||
183 | 195 | | |
184 | 196 | | |
185 | 197 | | |
186 | | - | |
187 | | - | |
| 198 | + | |
| 199 | + | |
188 | 200 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
195 | 207 | | |
196 | 208 | | |
197 | 209 | | |
| |||
210 | 222 | | |
211 | 223 | | |
212 | 224 | | |
213 | | - | |
| 225 | + | |
214 | 226 | | |
215 | 227 | | |
216 | 228 | | |
| |||
235 | 247 | | |
236 | 248 | | |
237 | 249 | | |
238 | | - | |
| 250 | + | |
239 | 251 | | |
240 | 252 | | |
241 | 253 | | |
| |||
253 | 265 | | |
254 | 266 | | |
255 | 267 | | |
256 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
257 | 275 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 276 | + | |
| 277 | + | |
263 | 278 | | |
264 | 279 | | |
265 | 280 | | |
266 | 281 | | |
267 | 282 | | |
268 | 283 | | |
269 | | - | |
| 284 | + | |
270 | 285 | | |
271 | | - | |
272 | | - | |
273 | | - | |
| 286 | + | |
| 287 | + | |
274 | 288 | | |
275 | | - | |
| 289 | + | |
276 | 290 | | |
277 | 291 | | |
278 | 292 | | |
| |||
282 | 296 | | |
283 | 297 | | |
284 | 298 | | |
285 | | - | |
| 299 | + | |
286 | 300 | | |
287 | | - | |
288 | | - | |
| 301 | + | |
289 | 302 | | |
290 | | - | |
291 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
292 | 309 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 310 | + | |
297 | 311 | | |
298 | 312 | | |
299 | 313 | | |
300 | | - | |
301 | | - | |
| 314 | + | |
| 315 | + | |
302 | 316 | | |
303 | 317 | | |
304 | 318 | | |
305 | 319 | | |
306 | | - | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
307 | 323 | | |
308 | 324 | | |
309 | | - | |
| 325 | + | |
| 326 | + | |
310 | 327 | | |
311 | 328 | | |
312 | 329 | | |
313 | | - | |
| 330 | + | |
| 331 | + | |
314 | 332 | | |
315 | 333 | | |
316 | 334 | | |
317 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
318 | 342 | | |
319 | 343 | | |
320 | 344 | | |
| |||
346 | 370 | | |
347 | 371 | | |
348 | 372 | | |
349 | | - | |
| 373 | + | |
350 | 374 | | |
351 | 375 | | |
352 | 376 | | |
| |||
366 | 390 | | |
367 | 391 | | |
368 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
0 commit comments