Summary
scripts/ci/check_calvin_determinism.sh skips test helpers by anchoring on ^#\[cfg(test)\] (no leading whitespace). An indented #[cfg(test)] on an item inside a scanned path — e.g. a test-only dummy task builder under nodedb/src/data/executor/handlers/transaction/ — is never recognised as a skip, so the gate flags Instant::now (or similar) even though the helper is test-only. Contributors see a generic FAIL: 1 non-deterministic site(s) with no hint that indentation is the cause.
Reproduction
In nodedb/src/data/executor/handlers/transaction/sub_plan.rs, the test helper build_dummy_task is indented inside impl:
#[cfg(test)]
pub(super) fn build_dummy_task(...) { /Instant::now()/ }
Run:
bash scripts/ci/check_calvin_determinism.sh
# → FAIL: 1 non-deterministic site(s) in Calvin write path: nodedb/src/data/executor/handlers/transaction/sub_plan.rs:122
The existing doc-block // no-determinism: ... six lines above is also ignored (gate requires same or directly preceding line).
Expected
The gate should recognise indented #[cfg(test)] (e.g. ^[[:space:]]*#\[cfg(test)\]) and handle it as a skip. When it still must flag a site, the error should direct the contributor to add a // no-determinism: <reason> marker on the same/preceding line.
Proposal
- Change the skip anchor from
^#\[cfg(test)\] to ^[[:space:]]*#\[cfg(test)\] in check_calvin_determinism.sh (and same for the closing } anchor).
- Keep the failure message focused on the
// no-determinism: <reason> marker for indented helpers.
Fact — verified
Unindenting #[cfg(test)] to #[cfg(test)] at column 0 inside an impl breaks cargo fmt. cargo fmt formats the attribute indented to match the item, and cargo fmt --check fails on the unindented form and re-indents it. Verified locally: moving the attribute to column 0 → cargo fmt --check reports Diff and rewrites it back. Therefore the gate must handle indented form itself; contributors should not be told to unindent indented helpers.
Impact
Without this, every test-only helper added under a scanned Calvin path trips the gate, as seen in PRs #270/284/288.
Area
CI / Calvin determinism
Before submitting
Summary
scripts/ci/check_calvin_determinism.shskips test helpers by anchoring on^#\[cfg(test)\](no leading whitespace). An indented#[cfg(test)]on an item inside a scanned path — e.g. a test-only dummy task builder undernodedb/src/data/executor/handlers/transaction/— is never recognised as a skip, so the gate flagsInstant::now(or similar) even though the helper is test-only. Contributors see a genericFAIL: 1 non-deterministic site(s)with no hint that indentation is the cause.Reproduction
In
nodedb/src/data/executor/handlers/transaction/sub_plan.rs, the test helperbuild_dummy_taskis indented insideimpl:Run:
bash scripts/ci/check_calvin_determinism.sh # → FAIL: 1 non-deterministic site(s) in Calvin write path: nodedb/src/data/executor/handlers/transaction/sub_plan.rs:122The existing doc-block
// no-determinism: ...six lines above is also ignored (gate requires same or directly preceding line).Expected
The gate should recognise indented
#[cfg(test)](e.g.^[[:space:]]*#\[cfg(test)\]) and handle it as a skip. When it still must flag a site, the error should direct the contributor to add a// no-determinism: <reason>marker on the same/preceding line.Proposal
^#\[cfg(test)\]to^[[:space:]]*#\[cfg(test)\]incheck_calvin_determinism.sh(and same for the closing}anchor).// no-determinism: <reason>marker for indented helpers.Fact — verified
Unindenting
#[cfg(test)]to#[cfg(test)]at column 0 inside animplbreakscargo fmt.cargo fmtformats the attribute indented to match the item, andcargo fmt --checkfails on the unindented form and re-indents it. Verified locally: moving the attribute to column 0 →cargo fmt --checkreportsDiffand rewrites it back. Therefore the gate must handle indented form itself; contributors should not be told to unindent indented helpers.Impact
Without this, every test-only helper added under a scanned Calvin path trips the gate, as seen in PRs #270/284/288.
Area
CI / Calvin determinism
Before submitting