Skip to content

feat(op): git and appnet resources are sealed; identity governs the registry name - #660

Merged
David-Noble-at-work merged 1 commit into
developfrom
seal-git-and-appnet
Aug 25, 2026
Merged

David-Noble-at-work merged 1 commit into
developfrom
seal-git-and-appnet

Conversation

@David-Noble-at-work

Copy link
Copy Markdown
Contributor

Phase 3 of #625. Closes #642.

The plan expected a mechanical pass. It was not, and the most important finding is one that sealing a
single provider could never have surfaced
.

The registry name collided

receiverName special-cases the type named Resource into <pkg>.Resource — that is what keeps providers
distinct in the registry. A sealed implementation is named resource, falls through to the default arm, and
yields the bare resource for every provider. So the second one announced panics at init:

panic: op.AnnounceResource: AnnounceResource(service.Resource): "resource" already announced

service alone was fine. git beside it was not.

Fixed at the framework layer, extending the split phase 1 established: identity governs the type id AND the
registry name; the implementation governs only reflection.
One line, in NewResourceReceiverType.

Open question 2, answered here rather than at pkg

Both resources carry exported fields the provider reads — git: SourcePath, Ref, HEAD; appnet:
SourceURL — so the sealed interfaces gain accessors and the struct fields go unexported.

No external consumer needed them: every real read is in-package, and the only two out-of-package mentions of
git.Resource / appnet.Resource are doc comments. Checked before transforming rather than after.

A codec cannot set unexported fields

git decoded through a type alias Resource embed. Once the fields are unexported that silently leaves ref
and head at zero — encoding/json and the YAML codec can only set exported fields. Both paths now decode
into an explicit local struct: same keys, same shape, no alias.

This is a trap for the remaining phases. It fails silently rather than at compile time, and the next
provider using the alias trick will hit it.

Phase 2 proved out

All three sealed providers keep their full method metadata — git 3 entries, appnet 3, service 3. The
generator fix from #658 carried them across without hand-editing, on two providers it had never seen.

Not fixed here

git has no MarshalJSON, so the promoted base marshaler writes the URI alone — nothing ever writes the
ref/head keys its unmarshaler carefully preserves.
Behavior is preserved exactly; the asymmetry predates
this feature and wants its own issue rather than a change to a document format inside a sealing phase.

Verification

make test 103 ok / 0 fail · make build · make vet darwin/linux/windows · test-scenario · complexity
· shell-lint · gofmt -l — all clean.

@David-Noble-at-work David-Noble-at-work self-assigned this Aug 25, 2026
@David-Noble-at-work

Copy link
Copy Markdown
Contributor Author

The marshal/unmarshal asymmetry noted under "Not fixed here" is now tracked as #661, to land on its own PR rather than in this phase.

Investigating it for the issue turned up that it is more than adding two methods. git returns receipts (Provider.Clone → NewReceipt), and a receipt's result marshals through the resource. Today that is a URI string, and resolveRecordedResource depends on it:

uri, isString := result.(string)
if !isString {
	return nil, false
}

An object-form marshaler on git would break that assertion, and the miss is silent — retypeStampedResult swallows it with a bare return. Same failure mode #641 fixed on the id side, arriving on the shape side. So #661 carries the framework half too.

Also recorded there: op.ResourceBase.MarshalJSON's doc comment invites concrete resources to "override with their own representation," and zero resources across all nine providers do. git's decoder is the only one written as though that contract were real.

@David-Noble-at-work
David-Noble-at-work merged commit 1954c95 into develop Aug 25, 2026
8 checks passed
@David-Noble-at-work
David-Noble-at-work deleted the seal-git-and-appnet branch August 25, 2026 04:50
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.

Seal git and appnet

1 participant