Skip to content

Domain-specific physical constraints (absolute zero, non-negative frequency, etc.) not enforced #51

@matt-edmondson

Description

@matt-edmondson

Summary

CLAUDE.md lists the following invariants as part of the project's validation rules:

  • Temperature values cannot be below absolute zero (0 K)
  • Frequency values cannot be negative
  • Throw DivideByZeroException when dividing by zero in DivideToStorage

None of these are enforced in the current generated quantity types.

Evidence

Semantics.Quantities/Generated/.../Temperature.g.cs accepts any value via Create/From*. No < 0 K guard.

grep -E "absolute zero|cannot be negative" Semantics.Quantities/Generated/**/*.g.cs returns nothing.

Semantics.Quantities/PhysicalQuantity.cs does not implement per-dimension validation hooks.

Suggested next step

Extend dimensions.json (or a sibling metadata file) with optional physicalConstraints per dimension (e.g. { "minValue": "0", "minValueUnit": "Kelvin" }) and have the generator emit factory-level guards that throw ArgumentException when violated. Cover with tests for at minimum: Temperature absolute zero, Frequency >= 0, Wavelength > 0, Mass > 0, Pressure (absolute) >= 0.

Area / Severity

SourceGenerators / Metadata · incomplete

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions