Skip to content

fix(bb): repair acir components debug regression test - #24979

Draft
AztecBot wants to merge 1 commit into
nextfrom
cb/fix-bb-debug-acir-components-test
Draft

fix(bb): repair acir components debug regression test#24979
AztecBot wants to merge 1 commit into
nextfrom
cb/fix-bb-debug-acir-components-test

Conversation

@AztecBot

@AztecBot AztecBot commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes the canonical nightly debug failure in run 30190406234, where AcirComponentsCheckTest.DetectsUnconstrainedWitnesses aborted under _GLIBCXX_DEBUG with an out-of-bounds std::vector access.
  • The root cause was the regression test corrupting UltraCircuitBuilder::real_variable_index with resize(9). That violates builder invariants, so the static analyzer aborted before ComponentsChecker could report the intended UNCONSTRAINED error.
  • Reworks the fixture to compare the full ACIR circuit against a valid synthesized circuit that omits the ACIR witnesses, and adds the checker message to the expected-type assertion for easier future diagnosis.

Notes

The linked aztec-claude run 30190267425 is a separate stale scheduled workflow copy; aztec-claude#2041 already carries that schedule guard. The real current debug-build failure is the canonical aztec-packages run above.

Testing

  • cmake --preset debug
  • cmake --build --preset debug --target acir_components_check_tests -j$(nproc)
  • ./build-debug/bin/acir_components_check_tests --gtest_filter=AcirComponentsCheckTest.DetectsUnconstrainedWitnesses
  • ./build-debug/bin/acir_components_check_tests
  • NATIVE_PRESET=debug barretenberg/cpp/scripts/run_test.sh acir_components_check_tests AcirComponentsCheckTest.DetectsUnconstrainedWitnesses

Created by claudebox · group: slackbot · Slack thread

@AztecBot AztecBot added ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR. labels Jul 25, 2026
@AztecBot
AztecBot force-pushed the cb/fix-bb-debug-acir-components-test branch from 611e51c to aca63f7 Compare July 26, 2026 06:16
@AztecBot

Copy link
Copy Markdown
Collaborator Author

Independently reproduced and verified this fix from tonight's nightly dispatch (aztec-claude run 30333107696). This PR is correct and ready to land — it just needs a human to mark it ready and merge.

Posting the verification because the PR did not yet carry test evidence, and because this is the blocker for a failure that has now recurred every night since 2026-07-16.

Verified locally against the nightly's exact preset

Built cmake --preset debug (which sets -D_GLIBCXX_DEBUG — the only preset that catches this) on next @ 63e8535ef93:

  • Red (base next, unpatched): AcirComponentsCheckTest.DetectsUnconstrainedWitnesses aborts with exactly the CI message — attempt to subscript container with out-of-bounds index 10, but container only holds 9 elements.
  • Green (this PR's components_check.test.cpp applied): acir_components_check_tests 10/10 pass.

Confirmed root cause via debugger

The stack confirms the diagnosis in the description — the abort is inside the analyzer, before the checker's own bounds guard:

components_check.test.cpp:566  checker.check()
components_check.cpp:31        build_circuit_component_map() -> StaticAnalyzer_ ctor
graph.cpp:394                  process_execution_trace()
graph.cpp:84                   extract_gate_variables()
graph.hpp:105                  to_real() -> real_variable_index[10]   // size 9

CircuitBuilderBase::add_variable appends to variables and real_variable_index in lockstep, so real_variable_index.size() == variables.size() is a builder invariant that nothing in production ever breaks. resize(9) broke it, and to_real maps every gate wire through that vector.

The replacement test still covers the intended guard

Worth stating explicitly, since a rewritten fixture can easily end up passing vacuously: I temporarily deleted the

if (witness >= builder_.real_variable_index.size()) { ... }

guard in components_check.cpp and re-ran this PR's version of the test — it fails (out-of-bounds index 1001, but container only holds 11 elements). So the fixture genuinely still exercises that branch.

No regressions

  • Release preset (--preset default): acir_components_check_tests 10/10, boomerang_value_detection_tests 96/96.
  • Debug preset: boomerang_value_detection_tests 96/96 (the main StaticAnalyzer_ consumer).

Why this keeps recurring

This is the 11th ClaudeBox branch opened for this same failure since 2026-07-16. They are opened as drafts, never reviewed, and auto-close-stale-drafts.yml closes them after 5 days — #24783 was closed that way on 2026-07-23 with no human ever looking at it. Each night then re-dispatches and a new duplicate branch appears. I deliberately did not open a 12th; merging this one breaks the loop.

Optional follow-up (not needed to land this)

To stop the failure mode recurring silently, a one-line invariant check in the StaticAnalyzer_ constructor turns a future opaque OOB abort into a clear message at zero release cost:

BB_ASSERT_EQ(circuit_builder.real_variable_index.size(),
             circuit_builder.get_num_variables(),
             "real_variable_index and variables must be the same length");

I verified this compiles and passes both suites in debug and release. Happy to push it here or open it separately — say the word.


Created by claudebox · group: slackbot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant