Skip to content

test(storage): re-arm stale global-first anti-vacuity VM-step canary - #3341

Merged
Sinity merged 1 commit into
masterfrom
fix/test/stale-vm-step-and-failed-list-assertions
Jul 27, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/test/stale-vm-step-and-failed-list-assertions

Conversation

@Sinity

@Sinity Sinity commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes a stale VM-step anti-vacuity mutation in two archive query tests (polylogue-1ldl) and verifies a previously-stale live-batch assertion (polylogue-5202) is already resolved on master by an unrelated prior PR.

Problem

polylogue-1ldl: test_exact_session_action_count_bounds_pairing_before_global_ranking (tests/unit/storage/test_archive_tiers_archive.py) and test_exact_session_multi_aggregate_work_is_not_amplified_by_irrelevant_growth (tests/unit/archive/query/test_execution_control.py) each monkeypatch _action_relation_for_query to fall back to the plain "actions" relation name, simulating pre-z9gh.2 "global-first" behavior, and assert the resulting query costs >= 50000 SQLite VM steps as an anti-vacuity control. Since PR #3018 (z9gh.2) replaced the old windowed-CTE actions compatibility view with one backed by the small, pre-materialized, session_id-indexed action_pairs table, renaming the relation to "actions" no longer forces any meaningfully different/expensive path — both tests measured 0/400 VM steps for the "mutant" query, well under the 50000 threshold. The canary had silently stopped discriminating the exact regression it exists to catch.

polylogue-5202: test_live_multi_session_divergence_reopens_raw_authority (tests/unit/sources/test_live_batch_support.py) was reported failing with a stale failed == [second] assertion predating PR #3129's deferred-membership semantics change. Investigation found the assertions were already updated to the current-correct failed == [] / succeeded == [second] shape by PR #3282 (commit 4120c40, merged 2026-07-26, Ref polylogue-6mvg) as part of unrelated FTS-repair-deferral work. The test already passes on current master with no further code change needed.

Solution

  • Replaced the now-inert lambda **_kwargs: ("", "actions", []) mutation at both polylogue-1ldl sites with one that forces the actually-expensive "global-first" branch that still exists in action_relation_select_sql(session_placeholders=None) — the unbounded windowed tool_use/tool_result pairing recomputation across every block in the archive, instead of a read against the materialized action_pairs table. Verified this reproduces genuinely archive-wide cost (measured 53500 VM steps for the count-only path vs 400 bounded).
  • Added inline comments at both mutation sites recording what changed (feat(query): bound agent-facing archive reads #3018) and why the old mutation stopped discriminating.
  • No code change for polylogue-5202 — verified its test and the broader raw_materialization/raw_authority selection are green on master, and closing the bead by reference to PR perf(storage): defer FTS repair off the live-ingest write path #3282.
  • Filed polylogue-0twa for an unrelated, pre-existing stale query_units vs api.query_units call-log naming assertion noticed in the same test file (out of scope for this PR).

Verification

  • devtools test tests/unit/storage/test_archive_tiers_archive.py tests/unit/archive/query/test_execution_control.py → 60 passed, 2 failed (pre-existing, out-of-scope polylogue-0twa naming mismatch; both polylogue-1ldl tests pass)
  • devtools test -k "raw_materialization or raw_authority" → 198 passed (includes polylogue-5202's test)
  • ruff check / ruff format --check on both changed files → clean
  • mypy --strict on both changed files → no issues
  • devtools render all --check → no drift
  • pre-push devtools verify --quick → all steps ok

Ref polylogue-1ldl, polylogue-5202

Problem:
polylogue-1ldl: test_exact_session_action_count_bounds_pairing_before_global_ranking
and test_exact_session_multi_aggregate_work_is_not_amplified_by_irrelevant_growth
each monkeypatch _action_relation_for_query to fall back to the plain
"actions" relation name, simulating pre-z9gh.2 "global-first" behavior, and
assert the resulting query costs >=50000 SQLite VM steps as an anti-vacuity
control against a mutation that removes the exact-session bound. Since PR
#3018 (z9gh.2) replaced the old windowed-CTE "actions" compatibility view
with one backed by the small, pre-materialized, session_id-indexed
action_pairs table, renaming the relation to "actions" no longer forces any
meaningfully different or expensive path -- both tests measured 0/400 VM
steps for the "mutant" query, well under the 50000 threshold, so the canary
had silently stopped discriminating the global-first regression it exists
to catch.

polylogue-5202: test_live_multi_session_divergence_reopens_raw_authority in
tests/unit/sources/test_live_batch_support.py was reported failing on an
older master with a stale `failed == [second]` assertion predating PR #3129's
deferred-membership semantics change. Investigation found this test's
assertions were already updated to the current-correct `failed == []` /
`succeeded == [second]` shape by PR #3282 (4120c40, merged 2026-07-26,
Ref polylogue-6mvg) as part of unrelated FTS-repair-deferral work -- the test
passes on this branch with no further change needed. Verified the broader
`-k "raw_materialization or raw_authority"` selection (198 tests) is all
green. No code change accompanies polylogue-5202 in this commit; it is
closed by reference to the PR that already fixed it.

What changed:
Replaced the now-inert `lambda **_kwargs: ("", "actions", [])` mutation in
both polylogue-1ldl tests with one that forces the actually-expensive
"global-first" branch that still exists in
`action_relation_select_sql(session_placeholders=None)` -- the unbounded
windowed tool_use/tool_result pairing recomputation across every block in
the archive, rather than a read of the materialized action_pairs table.
Verified this reproduces genuinely archive-wide cost (measured 53500 VM
steps for the count-only path vs 400 bounded, and correspondingly for the
multi-aggregate path), restoring the anti-vacuity control's discriminating
power. Added inline comments at both mutation sites explaining what changed
and why the old mutation stopped working.

Also discovered (not part of either bead's scope) that
test_api_query_units_routes_through_execution_control and
test_api_multi_aggregate_receipt_reports_real_work_selection_and_delivery in
the same execution-control test file fail on unmodified master with an
unrelated "query_units" vs "api.query_units" call-log naming mismatch,
exactly as polylogue-1ldl's own investigation notes aside. Filed as its own
tracked item, polylogue-0twa, rather than left as anonymous debt.

Verification:
- devtools test tests/unit/storage/test_archive_tiers_archive.py
  tests/unit/archive/query/test_execution_control.py -> 60 passed, 2 failed
  (the pre-existing, out-of-scope polylogue-0twa naming mismatch; both
  polylogue-1ldl tests pass)
- devtools test -k "raw_materialization or raw_authority" -> 198 passed
  (polylogue-5202's test included)
- ruff check / ruff format --check on both changed files -> clean
- mypy --strict on both changed files -> no issues
- devtools render all --check -> no drift

Ref polylogue-1ldl, polylogue-5202

Co-Authored-By: Claude <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 502b2e51-7ead-4105-a827-5d08820d0b35

📥 Commits

Reviewing files that changed from the base of the PR and between cd16172 and 31d191e.

📒 Files selected for processing (2)
  • tests/unit/archive/query/test_execution_control.py
  • tests/unit/storage/test_archive_tiers_archive.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/test/stale-vm-step-and-failed-list-assertions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Sinity
Sinity merged commit f03f309 into master Jul 27, 2026
3 checks passed
@Sinity
Sinity deleted the fix/test/stale-vm-step-and-failed-list-assertions branch July 27, 2026 17:38
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.

1 participant