You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This content was written by an AI agent and must be verified by a human developer. After human verification, this alert may be removed.
Summary
validate_attributes returns UnsupportedLazybefore it ever constructs a ValidatedAttribute, so a ValidatedAttribute can never report name() == AttributeName::Lazy. Both consumers nevertheless still match on that variant, and so does the producing module itself.
crates/graphcal-eval/src/project_compiler/imports.rs:347-352 — same
crates/graphcal-compiler/src/ir/resolve/attribute_validation.rs:135 — AttributeName::Hidden | AttributeName::Lazy => Vec::new() mentions a variant this arm can never take
Why it is unreachable
crates/graphcal-compiler/src/ir/resolve/attribute_validation.rs:112-116, inside the per-attribute closure and ahead of every ValidatedAttribute construction:
Dead code, plus a missed opportunity to encode the invariant. Per AGENTS.md:
The compiler is the language's first user — its own implementation must hold itself to the same explicitness standard the language enforces on graphcal programs.
The invariant "a validated attribute is never Lazy" is currently enforced by an early return that nothing downstream can see, rather than by a type.
Suggested fix
Have ValidatedAttribute::name() return a narrower SupportedAttributeName covering only the three variants that can survive validation. The compiler then deletes the dead arms for you and makes the invariant unforgettable for future consumers.
Worth doing before the related attribute-validation cleanups, because it turns those arm deletions into compile errors rather than judgement calls.
Provenance
Found during a full-workspace code review at 6e462341a (v0.0.1-alpha.27). Baseline at that commit: cargo clippy --workspace --all-targets clean, cargo test --workspace 2926 passed / 0 failed, cargo deny check advisories ok.
Warning
This content was written by an AI agent and must be verified by a human developer. After human verification, this alert may be removed.
Summary
validate_attributesreturnsUnsupportedLazybefore it ever constructs aValidatedAttribute, so aValidatedAttributecan never reportname() == AttributeName::Lazy. Both consumers nevertheless still match on that variant, and so does the producing module itself.Dead sites
crates/graphcal-compiler/src/ir/resolve/mod.rs:730-734—AttributeName::Lazy => return Err(LazyNotSupported)crates/graphcal-eval/src/project_compiler/imports.rs:347-352— samecrates/graphcal-compiler/src/ir/resolve/attribute_validation.rs:135—AttributeName::Hidden | AttributeName::Lazy => Vec::new()mentions a variant this arm can never takeWhy it is unreachable
crates/graphcal-compiler/src/ir/resolve/attribute_validation.rs:112-116, inside the per-attribute closure and ahead of everyValidatedAttributeconstruction:Impact
Dead code, plus a missed opportunity to encode the invariant. Per
AGENTS.md:The invariant "a validated attribute is never
Lazy" is currently enforced by an earlyreturnthat nothing downstream can see, rather than by a type.Suggested fix
Have
ValidatedAttribute::name()return a narrowerSupportedAttributeNamecovering only the three variants that can survive validation. The compiler then deletes the dead arms for you and makes the invariant unforgettable for future consumers.Worth doing before the related attribute-validation cleanups, because it turns those arm deletions into compile errors rather than judgement calls.
Provenance
Found during a full-workspace code review at
6e462341a(v0.0.1-alpha.27). Baseline at that commit:cargo clippy --workspace --all-targetsclean,cargo test --workspace2926 passed / 0 failed,cargo deny check advisoriesok.