You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(op): git and appnet resources are sealed; identity governs the registry name - #660
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.
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:
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
receiverNamespecial-cases the type namedResourceinto<pkg>.Resource— that is what keeps providersdistinct in the registry. A sealed implementation is named
resource, falls through to the default arm, andyields the bare
resourcefor every provider. So the second one announced panics at init:servicealone was fine.gitbeside 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
pkgBoth 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.Resourceare doc comments. Checked before transforming rather than after.A codec cannot set unexported fields
gitdecoded through atype alias Resourceembed. Once the fields are unexported that silently leavesrefand
headat zero —encoding/jsonand the YAML codec can only set exported fields. Both paths now decodeinto 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 —
git3 entries,appnet3,service3. Thegenerator fix from #658 carried them across without hand-editing, on two providers it had never seen.
Not fixed here
githas noMarshalJSON, so the promoted base marshaler writes the URI alone — nothing ever writes theref/headkeys its unmarshaler carefully preserves. Behavior is preserved exactly; the asymmetry predatesthis feature and wants its own issue rather than a change to a document format inside a sealing phase.
Verification
make test103 ok / 0 fail ·make build·make vetdarwin/linux/windows ·test-scenario·complexity·
shell-lint·gofmt -l— all clean.