Skip to content

test(mask-risc): count only the measuring thread's allocations in no_alloc - #1333

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/elegant-clarke-r74l5r
Oct 5, 2026
Merged

AdaWorldAPI merged 1 commit into
mainfrom
claude/elegant-clarke-r74l5r

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Problem

six_plane_recognition_allocates_nothing in crates/lance-graph-mask-risc/tests/no_alloc.rs failed once with "six-plane recognition allocated 790 bytes over 100 runs", then passed 9 of 9 reruns. This was seen on the branch for #1332, which does not touch the recognition path.

Cause: the counting #[global_allocator] counted every allocation in the process. libtest's own threads (result reporting, output capture) don't take the SERIAL lock, so they could allocate inside a measured window, for example when the sibling test finished and its result was printed.

Fix

  • The allocator now counts only allocations made while a thread-local MEASURING: Cell<bool> is set on the current thread. It is const-initialised and has no destructor, so reading it from inside alloc neither allocates nor recurses. It uses try_with so thread teardown is safe.
  • measure(f) -> usize sets the flag around the window. Both zero-allocation assertions still use == 0. The existing can-it-fire probe is kept, and now runs inside measure.
  • New test allocations_on_other_threads_are_not_counted: another thread allocates 4096 bytes strictly inside the window (two barrier rendezvous). The window must read 0, and the other thread returns its Vec length to prove the allocation happened.

Verification

  • Falsifier: with the thread filter replaced by true, the new test fails with "a foreign thread's 4096 bytes were counted". The file was restored afterwards.
  • cargo test -p lance-graph-mask-risc --test no_alloc (with CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 CARGO_INCREMENTAL=0): 50/50 passed with default threads and 50/50 passed with --test-threads=1.
  • cargo clippy -p lance-graph-mask-risc --test no_alloc -- -D warnings: clean. rustfmt --check: clean.

https://claude.ai/code/session_01EwBQ2F8SxVoVB9qwhtg3zo


Generated by Claude Code

…alloc

six_plane_recognition_allocates_nothing failed once with 790 bytes and
then passed 9/9 reruns. The counting global allocator was process-wide,
and libtest's own threads (result reporting, output capture) sit outside
the SERIAL lock, so they could allocate inside a measured window.

The allocator now counts only allocations made while a const-initialised,
Drop-free thread-local MEASURING flag is set; `measure(f)` sets it around
the window. The zero-allocation assertions and the can-it-fire probe are
unchanged in strength (the probe now runs inside `measure`).

New test allocations_on_other_threads_are_not_counted: a foreign thread
allocates 4096 bytes strictly inside the window (barrier rendezvous) and
the window must read 0. It fails with the filter disabled.

Verified: 50/50 parallel and 50/50 --test-threads=1 runs green.

Claude-Session: https://claude.ai/code/session_01EwBQ2F8SxVoVB9qwhtg3zo
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 55 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 53e3bbc8-7f3e-43e5-95a0-edc2851d30e1
📥 Commits

Reviewing files that changed from the base of the PR and between 97a3610 and 18c05d8.

📒 Files selected for processing (1)
  • crates/lance-graph-mask-risc/tests/no_alloc.rs
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Oct 5, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 59c7c17a-8548-4541-a95b-eeeb1acaefe4)

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 5, 2026 10:18
@AdaWorldAPI
AdaWorldAPI merged commit 540874d into main Oct 5, 2026
9 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Oct 5, 2026
…te index

Wording only, after rebasing onto main (#1331, #1333):
- entries/README.md regenerated from the rebased tree (218 rows).
- Fold-contract OPEN splits the old "destination resolution" item into
  A. destination binding / coordinate resolution (frontend / binder; lowers
  to the existing Local / Via fold; not a missing ndarray primitive) and
  B. functional route composition beyond depth 2 (substrate / R2IL; chain vs
  precomposed lane unmeasured).
- TD-KEYED-SINK-MERGE-IDENTITY-1 states exactly what merge_group_sink checks
  (supported keyed i64 terminal, equal length) and adds binding identity,
  contribution-population identity, and the working law that an ordinal has
  meaning only inside its destination-space / codebook identity.
- merge_group_sink precondition 5 names the binding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCEP2fZdHYdMCtcEVcTpS2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants