spec: update constraint ID system#570
Conversation
ReviewThis PR adds stable, content-derived constraint IDs to the spec rendering pipeline: an FNV-1a hash of each constraint's structure is encoded into a short 4-char human-readable tag (e.g. The approach is sound. Three bugs found: Medium — Crash on empty variable groups (src.typ:191–197)
Low —
|
Codex Code ReviewNo actionable issues found in the PR diff. The changes are limited to the Typst spec rendering/tagging logic and chip metadata. I did not find security-relevant runtime changes, VM behavior changes, or significant performance concerns. I could not run a full Typst/shiroa render because neither |
Codex Code ReviewFindings:
No security issues found in the PR diff. I did not run a Typst render because |
Review: spec/constraint_idOverviewReplaces sequential constraint indices with content-derived IDs using FNV-1a hashing. Variables are identified by (chip, group, position, type) so renaming a variable doesn't change constraint IDs, but reordering does. The 4-character Base32 ID (20 bits of entropy) is stable across reorganisation and signals stale IDs when a constraint's semantics change. TOML chips all gain a Bugs[High] [Medium] [Low] Wrong variable in error message — FNV-1a implementationThe two-limb 64-bit multiplication is mathematically correct: carry propagation from Minor observations
|
RobinJadoul
left a comment
There was a problem hiding this comment.
Very brief look only, so far; haven't properly looked at the canonicalization/serialization of the constraints yet
99898d2 to
a27e78f
Compare
Co-authored-by: Erik <159244975+erik-3milabs@users.noreply.github.com>
|
/ai-review |
AI ReviewPR #570 · 23 changed files FindingsNo non-rejected structured findings were reported. Reviewer Lanes
Native Codex and Claude reviews run separately and post their own comments. They are not included in this structured provenance report. Raw lane outputs, candidates, final issues, and model metrics are uploaded as workflow artifacts. |
Codex Code Review
|
Review summaryScope: this PR is entirely spec/Typst rendering + Python tooling — no Rust/VM/executor/GPU code is touched, so the safety criteria around unsafe blocks, device memory, and instruction semantics don't apply here. The content-derived constraint ID design is sound and well thought out. A few notes: Correctness / design (all low severity)
Nits already fine
Nothing blocking. |
This is not correct; the last operation in the loop truncates
This is incorrect; |
This is an interesting observation. I don't think this is a problem, but it does go to show that FNV-1a is more finicky than I thought it would be... |
This PR introduces content-derived constraint IDs, i.e., the ID of a constraint is derived from its content, rather than its index in the constraint list. This
i.e., two constraints with the same ID are 100-ε% certain to be identical.
Note: the ID is derived in a way that updating a variable name does not lead to a name update. This is at the expense of an ID update when variables are reordered.
Before:

After:
