Skip to content

docs(plan): sealed resources split in two parts; the fragment names the interface - #648

Merged
David-Noble-at-work merged 1 commit into
developfrom
sealed-provider-resources
Aug 24, 2026
Merged

David-Noble-at-work merged 1 commit into
developfrom
sealed-provider-resources

Conversation

@David-Noble-at-work

Copy link
Copy Markdown
Contributor

Rewrites the #625 plan after investigating phase 1. One fact the original asserted is false, and the
investigation turned up a silent failure the change would have converted from latent to live.

The enabling fact was false

The plan claimed — and #625 repeated as "verified 2026-08-23" — that pkg/op/provider/<p>/gen/*.gen.go
declares the provider's own package, so generated announcements could name unexported types. go list
says otherwise:

github.com/NobleFactor/devlore-cli/pkg/op/provider/service       name=service
github.com/NobleFactor/devlore-cli/pkg/op/provider/service/gen   name=service

Two import paths, the same package name, different packages. The gen file imports the provider as
provider and can name only its exported identifiers.

Ruling 4 — the URI fragment names the interface

Holding to the original ruling that the fragment names the struct would have required an exported
ResourceType() reflect.Type seam per provider — and reflect.New on that seam forges a resource,
reopening the door the feature exists to close. Giving the fragment to the interface dissolves it: ruling
3 already hands the interface the name the struct gives up, so typeIDOf is byte-identical and the
generated files do not change at all
.

The receipt-retyping failure this surfaced

Ruling 4 covers the URI. It does not cover the receipt's product-type id — and that turned out to be
a latent fragility rather than a clean invariant.

ReceiptBase.Commit records canonicalIDOf(result), the produced value's dynamic type.
ProductTypeByID resolves it against an index built from every action method's declared result
type. The two need not agree, and today they agree only by coincidence: file.Move, Remove,
RemoveAll, and Backup already return the Resource interface, so they record a concrete id such as
*…/file.Regular — which resolves only because file.Copy independently declares *Regular and
contributes the key.

Sealing removes the coincidence. The dynamic type becomes *…/file.regular, an unexported struct no
method declares, so the lookup misses — and the miss is silent, because retypeStampedResult
(pkg/op/recovery_stack.go:647) is if !ok { return }. A resumed run leaves the result as its raw
decoded value, the bare URI string, instead of a resource. No error, no log.

So the change converts a latent fragility into a live silent failure across every provider. Phase 1 fixes
both sides to record the announced identity, and the plan pins it with a resume that asserts the
retyped result — asserting that resume merely succeeds proves nothing against a bare return.

The delta is narrow: ResultType is omitempty and canonicalIDOf returns "" for nil, so a method
with no result omits the field. file.WalkTree returns any, and a reducer returning an int records
int before and after. Only receipts whose result is a provider resource move, and they move by exactly
one character — result_type loses the leading * that a pointer return produced.

The acceptance criterion is narrowed accordingly: the resources section and URIs stay byte-identical;
resource-bearing receipt ids change deliberately and are pinned to their new value.

What the receiver machinery needs

The original plan said "filter on PkgPath()". That was wrong-headed — enumeration is not the problem.
NewMethod cannot consume an interface method at all: reflect gives an interface method a nil
Func and a Type with no receiver, so do.Type.In(0) returns the first parameter for
Equal(other any) and panics for a no-arg method like Etag().

The change is to split the one field doing two jobs: receiverType stores the concrete type (method
enumeration, dispatch, and the byType key, which must match reflect.TypeOf(value)) plus a stored
type-id string
computed once from the interface (the two typeIDOf(ProviderType()) == typeID
comparisons that match against an id lifted from a URI). Those consumers sit on adjacent lines and want
opposite things. With the concrete type restored, the promotion and unexported-method problems evaporate
on their own, and UnpackerByTypeID starts working again for function, json, mem, and yaml.

Dividend: the type id becomes a declared identity instead of one re-derived at each site. Today any Go
rename silently invalidates every saved document.

Ruling 5 — two parts, so the goal is actually reached

Part 1 seals the eight single-resource providers; part 2 converts file's four variants. The original
would have left file a permanent exception in a new direction. It is not merely aesthetic: file's
variants carry zero exported fields, so the forging path fills nothing yet still mints an identity-less
*Regular.

Ruling 6 — kind() <Interface> discriminates the variants

Regular and Directory have identical exported method sets, so as bare interfaces they would be
structurally interchangeable — r.(Directory) would succeed for a regular file and every kind-honesty
guarantee from #616 would evaporate without a single test failing. kind() Regular and kind() Directory
are different signatures, and a type may declare only one method named kind, so exclusivity is
structural rather than conventional.

Recorded as open for phase 5: the Any struct cannot be named any — that shadows the predeclared
identifier for the whole package.

The correctness case is now concrete

The plan previously argued from a struct literal someone might write. No such literal exists outside its
own package anywhere in the tree — checked across all eight. The plan now names the live path:
tryHydrateStruct (pkg/op/convert.go:441) reflectively mints a resource from a dict, producing a value
with an empty URI that reaches sm.Disable(name.Name) against the host. Phase 1 pins it red before the
seal and green after, so the claim is demonstrated rather than argued.

Housekeeping

Refs #625.

@David-Noble-at-work David-Noble-at-work self-assigned this Aug 24, 2026
@David-Noble-at-work
David-Noble-at-work merged commit 20a6ebb into develop Aug 24, 2026
8 checks passed
@David-Noble-at-work
David-Noble-at-work deleted the sealed-provider-resources branch August 24, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant