Repository navigation
feat(op): json and yaml resources are sealed; the Unpacker repair gets a pin - #667
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 4 of #625. Closes #643.
The mechanical pass the plan kept predicting and had not yet got. Both providers took the template
unchanged — sealed interface, unexported struct, accessors for
Data/Hash/Parsed, two registrationsfrom init — with no framework repair and no surprise.
make test103 ok on the first run after theconsumers were updated.
memmoved out before this startedfunction.Resourceembedsmem.Resourcecross-package:Go cannot embed an unexported type from another package, so sealing
membreaksfunctionat compiletime — the two are coupled and cannot land separately.
memmoved to #662 to be sealed alongsidefunction, wherefunction.resourcewill embed themem.Resourceinterface instead.Found by surveying before transforming rather than by the compiler afterwards. Verified isolated rather
than a pattern: it is the only cross-package resource embed in the tree.
The
Unpackerrepair finally has a pinPhase 1 routed
UnpackerByTypeID's reflective probe to the implementation. Nothing asserted it since — ithas been correct by inspection for four phases, and the failure mode is silent:
ok=falsereads as "thistype has no unpacker," so content rehydration would simply stop.
The first version of the pin was not worth having, and I nearly kept it. It derived its expected set
from
ProviderType()— the very value a regression corrupts. Revert the repair and the type stopsimplementing
op.Unpacker, the derived loop skips it, and the test passes green while content rehydrationis broken. The set is now named explicitly (
function,json,mem,yaml), so a fifth unpacker hasto be added here deliberately, and a vanished one fails rather than disappears.
Verification
make test103 ok / 0 fail ·make build·make vetdarwin/linux/windows ·test-scenario·complexity·shell-lint·gofmt -l— all clean.Metadata preserved without hand-editing:
json2 entries,yaml2 — #658's generator fix holding on twomore providers it had never seen.
Note preserved, not fixed
DataandHashcarryjson:"..."tags, but no resource overridesMarshalJSON, so the promoted basemarshaler writes the URI alone and those tags are inert — the same latent asymmetry recorded for
gitin#661. Content survives through
Pack/Unpackand the content section, not through the resource's ownJSON. Left exactly as found.