Skip to content

fix(session,configio): point at dotted-path in compound-error messages#24

Merged
ale-rinaldi merged 1 commit into
mainfrom
fix/issue-22-compound-error-message
May 15, 2026
Merged

fix(session,configio): point at dotted-path in compound-error messages#24
ale-rinaldi merged 1 commit into
mainfrom
fix/issue-22-compound-error-message

Conversation

@ale-rinaldi

Copy link
Copy Markdown
Contributor

Follow-up to the discussion on #22.

The compound-write error used to read:

set RELE_K1: compound TIPO=RELE needs map[string]any, got string

Two papercuts:

  1. It leaks the Go-internal map[string]any type, which is unactionable from a CLI — there's no way to pass a literal Go map as an argv string. A reader trying to take the message literally hunts for an inline-map syntax that doesn't exist.
  2. It doesn't mention the supported dotted-path form, so the user has to dig through mythy set --help to find it. That's exactly what led to set CLI: inline compound syntax not accepted, only via import YAML #22 being filed in the first place.

New wording:

set RELE_K1: this is a compound (TIPO=RELE); set sub-fields with dotted-path, e.g. RELE_K1.<subfield>=<value> (see `mythy set --help`)

Same idea on pkg/configio/valuefmt.go's YAMLToCodec compound fallthrough so the YAML-import path stops emitting the generic "unsupported tipo" and instead surfaces the actual constraint ("nested map of sub-field values").

TestSetCompoundWithScalarValuePointsToDottedPath pins the new shape so a future refactor that drops the hint surfaces in CI.

🤖 Generated with Claude Code

mythy set against a compound DATA with a scalar RHS used to error
with

  set RELE_K1: compound TIPO=RELE needs map[string]any, got string

Two papercuts in that line:

  1. It leaks the Go-internal `map[string]any` type, which is
     unactionable from the CLI — there is no way to pass a literal
     Go map as an argv string.
  2. It doesn't mention the actually-supported dotted-path syntax
     (`mythy set RELE_K1.Logica=ECCITATO`), so a reader who takes
     the message literally goes hunting for an inline-map feature
     that doesn't exist (this is what led to the original duplicate
     issue #22 being filed).

Rewrite to surface the supported syntax with a concrete example
and a pointer at `mythy set --help`. Symmetric refresh on the
configio.YAMLToCodec compound fallthrough so the YAML-import path
emits a useful diagnostic when a compound DATA is given a scalar
value in the YAML.

Test in pkg/session pins the new wording so a future refactor that
quietly drops the hint surfaces in CI.

Follow-up to #22.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ale-rinaldi ale-rinaldi merged commit ee40be4 into main May 15, 2026
2 checks passed
@ale-rinaldi ale-rinaldi deleted the fix/issue-22-compound-error-message branch May 15, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant