Repository navigation
Commit 68e5f80
authored
🔎 Inspect a sealed artifact with the commands that inspect a run (#619)
* 🔎 Inspect a sealed artifact with the commands that inspect a run
`xmd workflow status --artifact=<path.xmd>` and `xmd workflow history
--artifact=<path.xmd>`. The same questions a retained run answers, asked of a
file that left the machine which produced it.
They are sibling lifecycle operations rather than one operation over a union.
`inspect(runId)` addresses live lifecycle authority — something a caller may
still advance, cancel or delete — and `inspectArtifact(path)` addresses immutable
evidence somebody is holding. Widening one to accept either would make that
difference a detail of a parameter. The Deno provider owns the container: it
verifies the whole file through the existing reader before answering with any of
it, and reaches no run store, lock, Workspace, definition reader or external
provider. The CLI never imports the reader, so a host without the Deno provider
gives the standard refusal and the grammar stays portable.
History is one projection now. Authored source, cumulative forkability,
inherited provenance and freezing moved to `projectHistory()` beside the
provider-neutral contract, and both sources call it — a live journal table on
one side, verified journal records on the other. Two mappings are how history
quietly starts meaning different things depending on where it was read.
The path is presentation. It heads the human output and appears nowhere in JSON,
so two copies of one artifact are one answer. Artifact history JSON is an
envelope because the identity and the frontier have nowhere else to go; retained
history stays the bare array. `retrieval` is absent from an artifact snapshot as
a fact rather than an omission — where a definition can be fetched from now is
authority belonging to the machine that exported.
Status and history take exactly one source. Neither named is a refusal showing
both forms, both named is a refusal naming both, and a second `--artifact` is
refused rather than letting the parser keep the last of two different files.
`list` stays a registry of runs and refuses `--artifact` like any other action.
I1 compares the artifact's answers field-for-field against the retained answers
captured from the same run before it was exported through the real `workflow
export`. I1b is the discriminating case for the frontier: the last event's root
and the current pointer coincide in every ordinary run, so the run is edited
from outside XMD to make them differ — reading one as the other fails it. I2
proves two paths give byte-identical JSON, I3 that both commands answer from a
directory with no repository and an empty run store while the file and its
directory stay untouched, I4 that a refused file presents nothing at all, and I5
the source grammar. DLC13 and C9 already hold the locality and entrypoint
boundaries over the new modules.
Refs #601
* 🔍 Read an artifact where nothing may be written beside it
I2 was arranged but not complete. It copied the artifact to a second path and
compared the answers, which proves the path is not part of identity — and proves
nothing at all about the claim underneath it, that inspecting an artifact writes
nothing. A directory that merely happened to stay clean is not a directory that
could not have been written to.
So the copy is inspected while its containing directory refuses new entries. A
reader that opened the container for writing, or left a journal, a WAL or a lock
next to it, cannot finish there at all. The refusal is proven before the
assertions rather than assumed, because a host that quietly ignored the mode
change would make every line after it a coincidence. Permissions are restored
through this scope's teardown, registered inside the fixture's own removal so it
runs first: a failing assertion still leaves the temporary tree removable.
Status and history both still answer, the two paths give byte-identical JSON,
the human heading names the path each caller supplied, and the file and its
directory are unchanged afterwards.
The `architecture.md` lifecycle excerpt now says what the surface is. It had
drifted before this story — no fork lineage on the snapshot and no `export` —
and it gains the artifact result types and the two sibling operations. The
retained pair stays distinct, and the paragraph under it says why: a run ID
names live lifecycle authority, a path names evidence somebody is holding, and
`WorkflowArtifactSnapshot` extends the retained snapshot rather than restating
it.
Refs #601
* 🧱 Give an artifact snapshot no retrieval to leave unset
The contract says an artifact carries no record of where its definition could be
fetched from now. The type said otherwise. `WorkflowArtifactSnapshot` extended
`WorkflowLifecycleSnapshot`, so `retrieval` was a valid key of it, and the whole
exclusion rested on the Deno projection happening not to write one. A member a
type admits is a member some caller will eventually set.
So the shared shape is what both forms are. `WorkflowInspectionSnapshot` holds
the record, the executions, the journal frontier, the current Workspace root and
the fork lineage — everything true of the run itself. The retained-run snapshot
alone adds `retrieval`, because where a definition can be fetched from now is a
fact about the machine holding the run rather than about the run. The artifact
snapshot alone adds which artifact answered and the boundary it was sealed at.
Neither extends the other.
The renderer had to say this too. `renderStatus` takes the shared shape and
receives retrieval as its own argument, supplied by the retained caller and by
nobody else — reading it off the value would have made the renderer expect a
member half its callers cannot have. Structural assignability hid this: an
optional member kept every call site compiling either way, which is exactly why
the boundary needed stating rather than inferring.
The regression is compile-time, because that is where the defect was. Three
`Assert<false>` guards in the lifecycle inspection suite fail if `retrieval`
becomes a key of the artifact snapshot or of the shared base, or stops being one
of the retained snapshot. Putting the artifact snapshot back to extending the
retained one fails the first of them, which is the exact mistake being fixed.
Runtime behavior, the sibling operations, both JSON shapes and the retrieval-free
projection are unchanged; the architecture excerpt and artifact spec now describe
the relationship the types actually have.
Refs #601
---------
Co-authored-by: Taras Mankovski <[email protected]>1 parent 6717e86 commit 68e5f80
14 files changed
Lines changed: 1065 additions & 88 deletions
File tree
- packages
- cli
- src
- tests
- workflow
- src
- deno
- lifecycle
- tests
- specs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
531 | 537 | | |
532 | | - | |
533 | 538 | | |
534 | 539 | | |
535 | 540 | | |
536 | 541 | | |
537 | 542 | | |
538 | 543 | | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
539 | 549 | | |
540 | 550 | | |
541 | 551 | | |
542 | 552 | | |
543 | 553 | | |
544 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
545 | 575 | | |
546 | 576 | | |
547 | 577 | | |
548 | 578 | | |
549 | 579 | | |
| 580 | + | |
| 581 | + | |
550 | 582 | | |
551 | 583 | | |
| 584 | + | |
552 | 585 | | |
553 | 586 | | |
554 | 587 | | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
555 | 602 | | |
556 | 603 | | |
557 | 604 | | |
| |||
659 | 706 | | |
660 | 707 | | |
661 | 708 | | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
662 | 725 | | |
663 | 726 | | |
664 | 727 | | |
| |||
3209 | 3272 | | |
3210 | 3273 | | |
3211 | 3274 | | |
3212 | | - | |
| 3275 | + | |
3213 | 3276 | | |
3214 | 3277 | | |
3215 | 3278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
0 commit comments