Skip to content

Seal json and yaml #643

Closed
Closed

Description

@David-Noble-at-work

Rescoped to json and yaml (USER, 2026-08-24). mem moves to #662, to be sealed alongside function.

Why mem cannot be sealed here

function.Resource embeds mem.Resource cross-package:

type Resource struct {
	mem.Resource
	invoker starlarkbridge.Invoker
	...
}

Sealing mem makes mem.Resource an interface and the struct unexported, and Go cannot embed an unexported type from another package. So mem and function are coupled at compile time and must move together.

Verified as an isolated case, not a pattern: function → mem.Resource is the only cross-package resource embed in the tree. json and yaml embed op.ResourceBase alone.

What remains here

Provider exported fields cross-package embed
json Data, Hash none
yaml Data, Hash none

Both implement Unpack, so this phase still carries the proof that phase 1's UnpackerByTypeID repair holds — it has been correct only by inspection since.

json.Resource and yaml.Resource are named by one file each outside their packages (yaml/resource.go and pkg/op/resource.go respectively), and both references are doc comments. As with every phase so far, no external consumer reads a field.

Watch here

Data and Hash carry json:"..." tags, but no resource overrides MarshalJSON, so the promoted base marshaler writes the URI alone and those tags are inert — the same latent asymmetry recorded for git in #661. Content survives through Pack/Unpack and the content section, not through the resource's own JSON. Preserve that; do not "fix" it here.

Template

  1. Sealed Resource interface over an unexported resource; exported constructors unchanged in signature.
  2. Two registrations from the provider's init — op.RegisterResourceImplementation and op.RegisterResourceMint (Seal service, and repair the two framework paths an interface-typed resource breaks #641).
  3. Exported fields the provider reads become interface accessors; check for out-of-package readers first (Seal git and appnet #642).
  4. The generated announcement needs no hand-editing (The generator must derive resource method metadata from the implementation, not the interface #658).
  5. Watch decode paths for the type alias Resource embed, which silently leaves unexported fields at zero (Seal git and appnet #642). Neither of these two uses it.
  6. Pin the content-section round trip, asserting the rebuilt value rather than that the call succeeded — UnpackerByTypeID fails silently.

Activity

  1. changed the title [-]Seal the Unpacker four: json, yaml, mem, function[/-] [+]Seal the Unpacker three: json, yaml, mem[/+] on Aug 25, 2026
  2. changed the title [-]Seal the Unpacker three: json, yaml, mem[/-] [+]Seal json and yaml[/+] on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions