eda: yaml.Node decoding so playbook findings carry line numbers #444

Closed
opened 2026-10-27 13:36:21 +00:00 by sam · 0 comments
Owner

Prerequisite for the LSP serve mode (archie-core-t2db.28, split out of this
bead on 2026-09-21). Useful on its own: it upgrades the lint tool from
file-granular findings to compiler-style file:line diagnostics.

The loaders decode with yaml.Unmarshal into a plain map, which discards
positions. Verified 2026-09-21: internal/domain/workflow/routing.go has three
such sites, each raw := map[string]string{} followed by yaml.Unmarshal.

gopkg.in/yaml.v3's Node carries Line and Column populated by the decoder. For
a MappingNode, Content is a flat []*Node alternating key, value, so decoding
into a *yaml.Node instead of the map gives Content[i].Line for the i-th key
directly -- no manual line counting, no new dependency.

Design

Replace the decode representation only. Do NOT change collision-detection
logic: walk node.Content in pairs, extract key.Value and value.Value (the same
strings as today) plus key.Line (new).

Existing collision error MESSAGES stay byte-identical wherever line
information is not yet surfaced in them. Add line numbers to the error format
only once they are available, as a deliberate second step, so a regression in
the messages is visible as a message change rather than hidden in a rewrite.

This is a pure additive capability. Every existing test over the three loaders
must pass unchanged.

SCOPED GATE COMMAND
go test ./internal/domain/workflow/... ./cmd/archie-playbooks/... -count=1
&& go vet ./internal/domain/workflow/... ./cmd/archie-playbooks/...

NO OVERLAP with .24 or .25: this bead touches internal/domain/workflow's
routing loaders, they touch internal/domain/eda/playbook. Safe to run in the
same wave as either.

Acceptance criteria

The three yaml.Unmarshal-into-map sites in internal/domain/workflow/routing.go decode through *yaml.Node and retain key line numbers; collision detection behaviour and its error messages are unchanged; a test asserts a reported line number for a known collision.

Notes

The LSP vetting record and the jsonrpc2-versus-hand-roll decision moved to archie-core-t2db.28 when this bead was narrowed to the yaml.Node decoding upgrade. Nothing in this bead needs a new dependency.

Close reason

Loaders decode via yaml.Node; key-level findings lead with file:line (75454d22)


Imported from beads archie-core-t2db.20 · GitHub #736 · type task · priority P2 · created 2026-09-02 · closed 2026-09-23

Prerequisite for the LSP serve mode (archie-core-t2db.28, split out of this bead on 2026-09-21). Useful on its own: it upgrades the lint tool from file-granular findings to compiler-style file:line diagnostics. The loaders decode with yaml.Unmarshal into a plain map, which discards positions. Verified 2026-09-21: internal/domain/workflow/routing.go has three such sites, each `raw := map[string]string{}` followed by yaml.Unmarshal. gopkg.in/yaml.v3's Node carries Line and Column populated by the decoder. For a MappingNode, Content is a flat []*Node alternating key, value, so decoding into a *yaml.Node instead of the map gives Content[i].Line for the i-th key directly -- no manual line counting, no new dependency. ### Design Replace the decode representation only. Do NOT change collision-detection logic: walk node.Content in pairs, extract key.Value and value.Value (the same strings as today) plus key.Line (new). Existing collision error MESSAGES stay byte-identical wherever line information is not yet surfaced in them. Add line numbers to the error format only once they are available, as a deliberate second step, so a regression in the messages is visible as a message change rather than hidden in a rewrite. This is a pure additive capability. Every existing test over the three loaders must pass unchanged. SCOPED GATE COMMAND go test ./internal/domain/workflow/... ./cmd/archie-playbooks/... -count=1 \ && go vet ./internal/domain/workflow/... ./cmd/archie-playbooks/... NO OVERLAP with .24 or .25: this bead touches internal/domain/workflow's routing loaders, they touch internal/domain/eda/playbook. Safe to run in the same wave as either. ### Acceptance criteria The three yaml.Unmarshal-into-map sites in internal/domain/workflow/routing.go decode through *yaml.Node and retain key line numbers; collision detection behaviour and its error messages are unchanged; a test asserts a reported line number for a known collision. ### Notes The LSP vetting record and the jsonrpc2-versus-hand-roll decision moved to archie-core-t2db.28 when this bead was narrowed to the yaml.Node decoding upgrade. Nothing in this bead needs a new dependency. ### Close reason Loaders decode via yaml.Node; key-level findings lead with file:line (75454d22) --- _Imported from beads `archie-core-t2db.20` · GitHub #736 · type task · priority P2 · created 2026-09-02 · closed 2026-09-23_
sam added the mediumtask labels 2026-10-27 13:36:21 +00:00
sam self-assigned this 2026-10-27 13:36:21 +00:00
sam closed this issue 2026-10-27 13:36:21 +00:00
sam added a new dependency 2026-10-27 13:42:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#444