@@ -69,10 +69,20 @@ therefore does not name a resource -- it names whichever generation is current a
6969graph reloaded after a resource has been re-produced binds to a generation it never saw, while the generation
7070it actually used is still in the ledger under its original id.
7171
72- This is not confined to dispatch. ` resolveDispatchResource ` (` method.go:807 ` ) has the same flaw for declared
73- targets, but the codec path reaches it first: ` discoverResource ` is called from the resource's
74- ` UnmarshalJSON ` , ` UnmarshalText ` , and ` UnmarshalYAML ` (` file/resource_base.go:389,420,446 ` , and the same shape
75- in eight other providers). Retiring the dispatch path alone would not fix it.
72+ This is not confined to dispatch. Three paths re-identify by URI, and the codec one is reached first:
73+
74+ | Path | Location | Reached from |
75+ | --- | --- | --- |
76+ | ` discoverResource ` | nine providers' ` UnmarshalJSON ` /` UnmarshalText ` /` UnmarshalYAML ` | deserialization |
77+ | ` resolveDispatchResource ` | ` method.go:807 ` | dispatch; one production caller, ` method.go:725 ` |
78+ | ` resolveRecordedResource ` | ` recovery_stack.go:678 ` | receipt rehydration on resume |
79+
80+ The third is the sharpest: it resolves a ** recorded result** -- what a node actually produced on the original
81+ run -- so a resumed run can bind a generation that did not exist when the node ran. A produced resource is a
82+ historical fact with exactly one right entry.
83+
84+ The second and third are both gated on the target or product type implementing [ Resource] , so neither fires
85+ for an ` any ` slot at all, which is the gap finding 3's first row describes.
7686
7787** Ruled: both are fixed at once** (filed as #735 ). Fixing the ` any ` case alone would leave one slot
7888resolving correctly by id while the declared slot beside it drifts to the current generation -- one
@@ -155,6 +165,73 @@ Receipts and the recovery stack feed compensation and resume. A float that reloa
155165changes a * compensating* call, which is worse than changing a forward one. One shared treatment at every
156166` any ` seam, not a local patch at ` bindingData ` .
157167
168+ ## Work in progress — state as of 2026-08-28
169+
170+ ** Branch:** ` any-slot-types ` . ** Committed:** ` b17067b ` (Phase 1: the plan and nine failing tests).
171+ ** Everything below this line is UNCOMMITTED and will be lost if the tree is discarded.**
172+
173+ ### The tree is red, deliberately and not
174+
175+ Three executor tests fail: ` TestRun_AKindMismatchStopsEvenUnderIgnore ` ,
176+ ` TestRun_ScopedPreflightFailsOnConsumedMissingClaim ` , ` TestRun_ScopedPreflightVerifiesConsumedClaims ` . All
177+ three fail with ` op.encodeTypeWrapper: $resource ... has no catalog to name it ` — the write side reaches for
178+ ` resource.RuntimeEnvironment().ResourceCatalog ` , which is the WRONG catalog (see below).
179+
180+ Six of the nine Phase 1 tests now pass. Still red: the truthiness guard (task 15), the Resource case, and the
181+ recovery-stack seam.
182+
183+ ### Uncommitted files
184+
185+ | File | State |
186+ | --- | --- |
187+ | ` pkg/op/type_wrapper.go ` | New. The wrapper codec. Its own tests pass. |
188+ | ` pkg/op/type_wrapper_test.go ` | New. Round trips over both codecs, all green. |
189+ | ` pkg/op/node.go ` | Modified. ` marshalBindings ` /` assembleBindings ` wrap and unwrap; signatures changed. |
190+ | ` pkg/op/graph.go ` | Modified. ` assembleUnits ` takes the environment. |
191+ | ` pkg/op/binding_test.go ` | Modified. Call sites updated for the new signatures. |
192+ | ` pkg/op/provider/file/graph_shape_demo_test.go ` | Scratch. Fails on purpose to print a doc. DELETE. |
193+ | ` pkg/op/provider/file/resource_lifecycle_order_test.go ` | Scratch. Does NOT compile; see below. |
194+ | ` test_path_* ` artifacts (repo root) | devlore-test litter. DELETE. |
195+ | ` */inventory.gen.go ` (op and star) | Touched by ` make ` regeneration; verify before committing. |
196+
197+ ### The correction the next session must apply first
198+
199+ ` encodeResource ` currently reads ` resource.RuntimeEnvironment().ResourceCatalog ` . That is wrong. The graph
200+ carries its own catalog and ` Graph.resourceCatalog ` 's doc comment says so explicitly: "every later
201+ session-owner (a Go-side ` GraphExecutor.Run ` , ** a serializer** , an inspector) reads from ` resourceCatalog `
202+ rather than from the long-gone planning environment."
203+
204+ The obstacle: ` Node.MarshalYAML() (any, error) ` takes no context, and the canonical form marshals nodes
205+ through exactly that path, so a node marshaling standalone cannot reach ` graph.resourceCatalog ` . Three
206+ options, none chosen: give ` Node ` a catalog reference at construction; resolve slot ids once at ` NewGraph ` ;
207+ or route the canonical form through a graph-aware marshal instead of the node's own marshaler. ** This is an
208+ open structural decision and belongs to the user.**
209+
210+ The read side threads ` env.ResourceCatalog ` through ` assembleUnits ` /` assembleNode ` /` assembleBindings ` , which
211+ is likewise probably the wrong catalog — the graph's own unpacked catalog is the right one.
212+
213+ ### What the devlore-test investigation established
214+
215+ Run against real documents rather than reasoned about, and all of it now backed by artifacts:
216+
217+ - ** A graph's immediate slots hold literals.** A resource produced by a node travels as a ` promise ` carrying a
218+ unit id. Confirmed against a two-node write-then-remove plan.
219+ - ** A resource DOES reach an immediate slot** when the author passes a path to a ` Resource ` -typed parameter:
220+ plan-time coercion mints the entry, ` resources: ` gains ` id: res-1 ` , and the slot records the ** URI** . That
221+ document is #735 in one screen — the id the slot should use is eleven lines below it.
222+ - ** Passing a path instead of a promise drops the dependency edge.** No ` edges: ` key is emitted, nothing
223+ orders the consumer after the producer, and scoped pre-flight then fails the consumer's claim. Not filed;
224+ see Open Questions.
225+ - ** ` mode: 420 ` ** appears in a planner-produced document — #711 in the wild.
226+
227+ ### Blocked on
228+
229+ - ** #738 ** — ` devlore-test ` is broken (High/P1). Its ` graph.yaml ` is empty for any plan whose units return
230+ nil, the graph document is written to the stream named ` receipt ` , and no execution trace is persisted. That
231+ last point blocks observing a resource's ` Pending ` to ` Active ` transition, which is a test this plan needs.
232+ - ** A missing accessor.** ` GraphExecutor ` exposes no ` RuntimeEnvironment() ` , so a test cannot reach the run's
233+ catalog to assert resource state. Whether that is a gap or an intended restriction is unanswered.
234+
158235## Requirements
159236
160237### Requirement 1: Every value in an ` any ` slot is enveloped
@@ -470,6 +547,27 @@ the executor's pre-flight resolve pass through `VerifyExistence`, and by nothing
470547When a consumer does find a resource missing at run time, [ MissingResourcePolicy] governs: ` Stop ` or ` Ignore ` ,
471548` Stop ` winning aggregation across the consumers of one entry, with a warning emitted under every policy.
472549
550+ ### 9. The wrapper is in the canonical form, and that is what makes reload stable
551+
552+ Measured rather than assumed. ` Graph.canonicalForm ` marshals the live ` *Node ` values
553+ (` graph.go:830-851 ` ), ` Node.MarshalYAML ` returns ` n.marshalData() ` (` node.go:203 ` ), and ` marshalData ` fills
554+ its slots through [ marshalBindings] . Wrapping in [ marshalBindings] therefore puts the wrapper into the
555+ canonical form as well as the document.
556+
557+ Three consequences, all wanted:
558+
559+ - ** The checksum changes** for every graph holding an immediate slot value. Greenfield, so no document needs
560+ to keep validating; the Migration section already states this.
561+ - ** The canonical form becomes codec-independent.** It now carries explicit types, so a graph written as json
562+ and the same graph written as yaml canonicalize identically even for values the two codecs disagree about.
563+ That is what the "JSON and YAML agree" goal has been asking for.
564+ - ** It fixes #734 at the root.** A reloaded ` {"$float64": "42"} ` resolves to ` float64(42) ` , which re-wraps to
565+ the identical bytes, so the recomputed checksum matches the stored one. The regression exists precisely
566+ because a ` json.Number ` re-canonicalized differently from the ` float64 ` that was written.
567+
568+ The last point is the load-bearing one: the wrapper is not merely tolerated by the checksum, it is what makes
569+ save and reload agree at all.
570+
473571### Out of scope, and why
474572
475573` converter.go:446 ` collapses ` *starlark.List ` , ` starlark.Tuple ` , and ` *starlark.Set ` into a single
@@ -597,6 +695,7 @@ change already read back wrong; Phase 4 makes them fail loudly instead of quietl
597695
598696| File | Action | Purpose |
599697| --- | --- | --- |
698+ | ` pkg/op/type_wrapper.go ` | Create | The wrapper codec (** landed** , green) |
600699| ` pkg/op/convert.go ` | Modify | Resolve an enveloped value at the ` any ` seam |
601700| ` pkg/op/truthiness.go ` | Modify | ` json.Number ` case in ` scalarTruthy ` as a guard rail |
602701| ` pkg/op/node.go ` | Modify | Envelope ` bindingData.Value ` |
@@ -608,6 +707,7 @@ change already read back wrong; Phase 4 makes them fail loudly instead of quietl
608707| ` pkg/op/method.go ` | Modify | Retire ` resolveDispatchResource ` 's URI lookup for slots |
609708| ` pkg/op/provider/*/resource*.go ` | Modify | Retire ` Discover(uri) ` on unmarshal for slot values |
610709| ` pkg/op/any_slot_types_test.go ` | Create | Phase 1: one failing test per finding (** landed** ) |
710+ | ` pkg/op/type_wrapper_test.go ` | Create | Wrapper round trips, both codecs (** landed** , green) |
611711| _ every float position_ | Modify | Non-finite floats envelope regardless of declaration (Requirement 2) |
612712
613713## Related Documents
@@ -623,6 +723,3 @@ change already read back wrong; Phase 4 makes them fail loudly instead of quietl
623723- Issue #443 -- Epic: Serialization and the single codec
624724
625725## Open Questions
626-
627- - [ ] Does Phase 3 change the * canonical* form used for checksums, or only the serialized bytes? #711 is
628- already answering an adjacent version of this and the answers should match.
0 commit comments