ci(calvin): handle indented #[cfg(test)] and improve error message (#290) - #291
Closed
EnRaiha wants to merge 1 commit into
Closed
ci(calvin): handle indented #[cfg(test)] and improve error message (#290)#291EnRaiha wants to merge 1 commit into
EnRaiha wants to merge 1 commit into
Conversation
Gate previously anchored on ^#\[cfg(test)\] (no leading space), so an indented ' #[cfg(test)]' inside an impl was never recognised as a skip and flagged Instant::now even though helper is test-only. Change anchor to ^[[:space:]]*#\[cfg(test)\] (and same for closing brace) so indented test helpers are skipped like top-level mods. Also improve failure message to tell contributors to unindent the #[cfg(...)] to column 0 as per cargo fmt (or add // no-determinism marker), per NodeDB-Lab#290 extended proposal. Without this, every test-only helper added under a scanned Calvin path trips the gate. Fixes NodeDB-Lab#290
EnRaiha
force-pushed
the
fix/calvin-gate-indented-cfg
branch
from
September 5, 2026 06:37
dd9cd8c to
a4a4cbb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
check_calvin_determinism.shanchored its#[cfg(test)]skip on^#\[cfg(test)\](no leading whitespace). An indented#[cfg(test)]inside animpl— e.g.sub_plan.rs:build_dummy_task— was never recognised, soInstant::nowwas flagged even though the helper is test-only. Unindenting the attribute to column 0 breakscargo fmt(which keeps#[cfg(test)]indented insideimpl), so the gate must handle indented form itself.Fix
^[[:space:]]*#\[cfg(test)\](and same for closing}) so indented test helpers are skipped like top-levelmod tests.cargo fmt(for top-level mods wherefmtkeeps it at 0) or add// no-determinism: <reason>on the same/preceding line. This matches the extended proposal in Calvin determinism gate misses indented #[cfg(test)] — confusing error for contributors #290.Verification
Fixes #290.