Skip to content

feat(generator): emit SEM001 diagnostic for unknown dimension references#65

Merged
matt-edmondson merged 1 commit intovectorsfrom
work/issue-56
May 9, 2026
Merged

feat(generator): emit SEM001 diagnostic for unknown dimension references#65
matt-edmondson merged 1 commit intovectorsfrom
work/issue-56

Conversation

@matt-edmondson
Copy link
Copy Markdown
Contributor

Summary

Closes #56.

When dimensions.json declares an integral / derivative / dotProduct / crossProduct that targets a dimension that doesn't exist (typo, stale name after a rename), QuantitiesGenerator silently dropped the operator. Typos were invisible until someone noticed the missing operator at the call site.

This PR makes those failures visible:

warning SEM001: Dimension 'Force' references unknown dimension 'Lengt'
in integrals[Lengt -> Energy].other; the operator will not be generated.
Check spelling and that the referenced dimension exists in
dimensions.json.

The diagnostic is Warning severity — the build doesn't fail, the operator is still skipped, so existing valid metadata keeps generating identically. The change just surfaces typos in build output where they're visible.

All eight dimMap.TryGetValue(...) sites in CollectAllOperators and CollectAllProducts now emit SEM001 on miss with the owning dimension, the unresolved name, and the metadata field path (e.g. integrals[Force -> Energy].other).

Test plan

  • CI runs and reports no warnings against the current dimensions.json (it's clean).
  • Optional manual test: introduce a typo in dimensions.json (e.g. "other": "Lengt" instead of "Length"), build, observe a SEM001 warning. Revert.

🤖 Generated by Claude Code


Generated by Claude Code

…ension

When dimensions.json declares an integral / derivative / dotProduct /
crossProduct that targets a dimension that doesn't exist (typo, stale name
after a rename), QuantitiesGenerator silently dropped the operator. Typos
were invisible until someone noticed the missing operator at the call site.

Now: emit a Warning-severity SEM001 diagnostic naming the owning dimension,
the unresolved reference, and the metadata path, e.g.

  warning SEM001: Dimension 'Force' references unknown dimension 'Lengt'
  in integrals[Lengt -> Energy].other; the operator will not be generated.
  Check spelling and that the referenced dimension exists in
  dimensions.json.

The operator is still skipped (build doesn't fail) so existing valid trees
keep working, but typos surface in build output where they're noticeable.

Closes #56.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 9, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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.

2 participants