Skip to content

Retire the providers' resource Unmarshal* constructors now that slots record catalog ids #854

Open

Description

@David-Noble-at-work

Why now

#712 phase 3 (e54e416, 312f4fb) changed what a document holds for a resource: a declared resource slot records the catalog id and reloads the catalog entry by Lookup(id); an any slot carries a $resource envelope holding the id; dispatch resolves a Resource or a recorded id by id and a run-time string by key. No slot path reaches a provider's resource unmarshaler any more. The catalog's own rows rebuild through Unpack(uri, content), not through a codec unmarshaler.

That leaves the providers' Unmarshal* constructors — methods that construct a resource from a URI string — as code with no slot caller. Their removal is the shape #649's ConvertFrom sweep took: one method family, every provider, one sweep.

Enumeration (2026-09-07, grep -rn '^func (.*) Unmarshal[A-Za-z]*(' pkg/op/provider --include='*.go', tests excluded)

Provider Resource types UnmarshalJSON UnmarshalYAML UnmarshalText
appnet 1 1 1 1
file 5 5 5 5
git 1 1 1 1
json 1 1 1 1
mem 1 1 1 1
pkg 1 1 1 1
service 1 1 1 1
yaml 1 1 1 1
total 12 12 12 12

Thirty-six methods. Twenty-four (UnmarshalJSON, UnmarshalYAML) have no caller left in pkg/op. Twelve (UnmarshalText) are still reached, all from the plan-time / immediate-mode conversion of an authored string:

  • pkg/op/convert.go:647 — [Convert]'s text step
  • pkg/op/env_value.go:171 — an environment-sourced value
  • pkg/op/parameter.go:188 — a parameter default

Those are the two places 4-resource-management.md §5.6 sanctions construction from a string (plan time and immediate mode), so they are not dead — they are the text-conversion seam wearing a codec interface.

Work

  1. Delete the 24 UnmarshalJSON / UnmarshalYAML resource methods and the tests that pin them. A resource is never decoded from a codec: a slot holds an id, a catalog row goes through Unpack.
  2. Rule on the 12 UnmarshalText: keep them as the text-conversion step, or route the three callers through the receiver registry's constructor path (ConstructorForSource for string) so no resource type implements encoding.TextUnmarshaler at all. The plan for this task records the ruling before code.
  3. Close the A value in an any-typed slot loses its concrete type at save; the document must carry it #712 plan's phase 3 bullet "retire Discover(uri) on unmarshal" by removal rather than by unreachability.

Evidence of completion

  • grep -rn 'func (.*) UnmarshalJSON\|func (.*) UnmarshalYAML' pkg/op/provider lists no resource type
  • UnmarshalText either gone from every resource type or kept under a recorded ruling, with the three callers named
  • No slot, receipt, trace, or catalog path constructs a resource from a string (a test pins each seam)
  • make check green; the sealed-resources plan (docs/plans/feature/625-sealed-provider-resources.md) gains this as a phase

Plan and design documents

Kind Document
Plan no branch has opened; the plan arrives with it
Design docs/architecture/4-resource-management.md
Design docs/plans/feature/625-sealed-provider-resources.md (the feature's plan)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions