Skip to content

Commit 5e09d98

Browse files
reid-spencerclaude
andcommitted
File [1.20]: publish resolve-before-you-match for AST consumers
riddlg surfaced this while confirming a rule we shipped. The same defect -- matching a field's WRITTEN type expression instead of its resolved one -- has now been written independently in two codebases twelve days apart, and riddl-models reported the riddlc instance of it back on 2026-08-14. It recurs because the alias IS the documented house style, so a model written idiomatically is exactly the one that breaks a consumer matching on node shape. The wrong instinct is also the natural one, which is what makes it worth writing down once rather than fixing case by case. Counting resolvePath's missing ClassTag, this is the third time the shape has cost someone a day. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 641b93e commit 5e09d98

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

BACKLOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,27 @@ verification is carried here so it is not repeated.**
11531153
than call sites -- a call-site census is what missed this twice, since the grep that finds
11541154
`addError(` does not find `check(`, and neither finds `messages.add(warning(...))`.
11551155

1156+
1157+
- **[1.20]** **Publish "resolve before you match" as guidance for AST consumers.**
1158+
**The same defect has now been written independently in two codebases.** riddl-models
1159+
reported it against riddlc on 2026-08-14 (`task/done/2026-08-14-instance-addressing-check-
1160+
does-not-resolve-id-aliases.md`): the instance-addressing check compared a field's *written*
1161+
type expression rather than its resolved one, so it saw the inline `Id(E)` spelling and
1162+
missed `campaignId: CampaignId` where `type CampaignId is Id(...)`. riddl fixed it.
1163+
**riddlg then carried the identical bug in its own copy of the same logic for another twelve
1164+
days**, finding it on 2026-08-26 while re-measuring: 80 sites it had reported as "not
1165+
derivable" were all its own defect, none the model's.
1166+
**Why it recurs**: the alias IS the documented house style, so a model written idiomatically
1167+
is exactly the one that breaks a consumer matching on `field.typeEx` shape. The wrong
1168+
instinct -- match the AST node you were handed -- is also the natural one.
1169+
**What to write**: guidance for anyone reading the riddl AST saying a type expression must be
1170+
RESOLVED before it is matched on, naming `refMap.definitionOf` as the way, and citing both
1171+
incidents so the advice carries its evidence. Candidate homes: a section in ossum.tech's riddl
1172+
docs, or a scaladoc note on `AliasedTypeExpression` itself, which is where a consumer is most
1173+
likely to be looking when they get it wrong.
1174+
**Not urgent, and not riddl code** -- but counting `resolvePath`'s missing `ClassTag`, this is
1175+
the third time the shape has cost someone a day.
1176+
11561177
### 2. Queued, needs a plan
11571178

11581179
#### Decided in `../RIDDL-Tools-To-Do-List.md` but never built

0 commit comments

Comments
 (0)