Problem or motivation
The instruction reference has a drift test that checks C++ opcodes and HIR operation types against docs/opcodes.json. Optimization pass documentation does not have an equivalent guard.
Pass metadata is registered in src/clifft/optimizer/pass_registry.h, while the docs metadata is manually mirrored in docs/macros.py. If a pass is added, removed, renamed, or has its default-enabled status changed, the docs can silently drift.
Proposed solution
Add a focused Python test, similar in spirit to tests/python/test_opcode_docs.py, that verifies pass documentation is complete relative to the C++ pass registry.
Suggested acceptance criteria:
- Parse
src/clifft/optimizer/pass_registry.h for registered pass names.
- Check that every registered pass appears in the pass metadata exposed from
docs/macros.py or an equivalent docs data source.
- Optionally also check kind/default-enabled metadata if that can be done without making the test brittle.
- The test should fail with an actionable message when docs metadata is missing or stale.
Alternatives considered
A future refactor could move pass docs metadata into a shared structured file, but a small drift test is likely the best first step. It keeps the issue approachable and matches the existing pattern used for opcode documentation.
Problem or motivation
The instruction reference has a drift test that checks C++ opcodes and HIR operation types against
docs/opcodes.json. Optimization pass documentation does not have an equivalent guard.Pass metadata is registered in
src/clifft/optimizer/pass_registry.h, while the docs metadata is manually mirrored indocs/macros.py. If a pass is added, removed, renamed, or has its default-enabled status changed, the docs can silently drift.Proposed solution
Add a focused Python test, similar in spirit to
tests/python/test_opcode_docs.py, that verifies pass documentation is complete relative to the C++ pass registry.Suggested acceptance criteria:
src/clifft/optimizer/pass_registry.hfor registered pass names.docs/macros.pyor an equivalent docs data source.Alternatives considered
A future refactor could move pass docs metadata into a shared structured file, but a small drift test is likely the best first step. It keeps the issue approachable and matches the existing pattern used for opcode documentation.