Skip to content

Matcher has no UnmarshalYAML — yaml.v3 silently drops the authored operator-map form #457

Done

Description

@aitrawog

Category

category:runtime

Type

type:fix

Remedy / files the remedy will touch

spec/union_types.go: add UnmarshalYAML to Matcher mirroring UnmarshalJSON (operator-map {equals: X}, scalar, null), plus a YAML round-trip test

Cited design decision or org-rulebook rule (or none)

DESIGN.md D-FLOW-3; spec/schema/00_common.cue #Matcher; spec/schema/stage.cue #Answer

Classification

Blocking — it blocks the filer's own progress, so the filer claims it at filing and fixes it.

Evidence (verified: commands with output, file:line, measurements)

spec.Matcher has no UnmarshalYAML, so yaml.v3 decodes its op/value struct fields and
DROPS the authored operator-map form {equals: X}. Measured with the two decoders:

$ grep -n "type Matcher struct" -A 4 spec/union_types.go
type Matcher struct {
	Op    string `json:"op"`
	Value any    `json:"value,omitempty"`
}
$ grep -c "UnmarshalYAML" spec/union_types.go
0

$ go test -run TestZZMatcherDecodeSpike -v .
YAML operator-map: err=<nil> Op="" Value=<nil>            # expect: {equals: yes} — DROPPED
JSON operator-map: err=<nil> Op="equals" Value="yes"
JSON scalar:       err=<nil> Op="equals" Value="yes"

The drop reaches the pipeline lowering: #Answer.expect (spec/schema/stage.cue) arrives
zero, so lowerAsk's refusal never fires and the lowered artifact loses the response contract:

$ CHARLY_PLUGIN_DIR=/tmp/plugs charly -C /tmp/pl-debt pipeline run expect-plan --dry-run
pipeline expect-plan: dry-run OK — lowered 1 stage: ask ...          # rc=0
$ cat /tmp/pl-debt/.opencharly/pipelines/expect-plan/workflow.lobster
steps:
    - id: ask
      on_error: stop
      approval: proceed?
    # the authored `expect: {equals: "yes"}` is absent

The CUE corpus test accepts the value (spec/schema validates the operator-map), so the
schema gate is green while the Go decode is lossy — the two halves never meet in a test.

Mechanism

Matcher carries only json tags; yaml.v3 decodes fields op/value, so the authored #Matcher operator-map {equals: X} decodes to the zero Matcher. #Answer.expect (D-FLOW-3) therefore arrives empty and the pipeline lowering's refusal never fires.

Missed control

The CUE corpus validates the operator-map; no test decodes an authored #Matcher through YAML into spec.Matcher and asserts Op/Value, so the YAML path is unmeasured.

Blast radius

Every authored #Matcher decoded from YAML via yaml.v3 (ask.answer.expect and any other matcher-shaped CUE field decoded through the Go types) silently loses its operator/value — a silent drop, never an error.

Root fix

Add Matcher.UnmarshalYAML mirroring UnmarshalJSON (operator-map, scalar, null); a YAML round-trip test. The JSON decoder already accepts all three forms (measured).

Spike (its result, or none with the reason)

(a) add UnmarshalYAML mirroring UnmarshalJSON — WORKS: the JSON decoder the YAML fix mirrors decodes the operator-map and the scalar to Op=equals/Value=yes; (b) decode the raw YAML node into a local matcher in the consumer — rejected as a consumer-side workaround for a shared type (R3); (c) make #Answer.expect a string — rejected, loses the matcher vocabulary. Winner: (a).

Agent: pr-sweep · Claude Code session 8df24173-9dbe-4357-a454-8faee0703dea
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

Activity

  1. aitrawog commented on Nov 30, 2026

    @aitrawog
    ContributorAuthor

    CLAIM

    Filed as blocking: it blocks this session's own progress, so this session claims it at filing and fixes it.

    Agent: pr-sweep · Claude Code session 8df24173-9dbe-4357-a454-8faee0703dea
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

  2. added
    category:runtime
    type:fix
    on Nov 30, 2026
  3. self-assigned this
    on Nov 30, 2026
  4. aitrawog commented on Nov 30, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    STATUS — fix implemented on fix/matcher-unmarshal-yaml (head c6967fd5cca92eb0d6373f271eb4fb35e1e69dfd): Matcher.UnmarshalYAML mirrors UnmarshalJSON (canonical mapping, operator-map, bare scalar, null), and a regression test decodes the authored #Answer shape from YAML and fails on the unmodified tree. The module gate (build, vet, gofmt, full test, golangci-lint) is green on the committed tree. Next: open the PR for this issue; the consumer's end-to-end bed remains opencharly/plugin-pipeline#69's. A second, narrower finding — MatcherList lacks the same YAML read path — is filed as #458 (non-blocking, unclaimed).

    Agent: pr-sweep · Claude Code session 8df24173-9dbe-4357-a454-8faee0703dea
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

  5. added a commit that references this issue on Nov 30, 2026
    f1e7f5f
  6. aitrawog commented on Nov 30, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED

    RESOLVED — #459 merged as f1e7f5f704a6a22aaac0b7ebea7eb9a416b9e56e and tagged v0.2026334.805 (tag-on-merge, at the merge commit). Matcher.UnmarshalYAML now mirrors UnmarshalJSON (canonical mapping, operator-map, bare scalar, null), and the regression test decodes the authored #Answer shape from YAML. The consumer's end-to-end lowering proof remains opencharly/plugin-pipeline#69's bed; the adjacent, narrower finding is #458, left unclaimed.

    Agent: pr-sweep · Claude Code session 8df24173-9dbe-4357-a454-8faee0703dea
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

category:runtimetype:fix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions