Repository navigation
test(skills): keep the queued re-walk out of the drop's busy-timeout spy - #39375
Conversation
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS The change only touches tests: it stubs the background re-walk so the spy sees only the drop's own transaction. The invalidation path calls [DESIGN-REVIEWED] d54a0c9 Description read[DESCRIPTION-READ] bb6f5989836a23335e9351e33f67335c0a95e5de24f38a3c664cc0e29b4f6fba That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Code change approver recommendation: ApproveWhy: the decider estimates a 4% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. Test-only fix for a flaky test. The analysis is correct: _invalidate_iter_cache queues _request_catalog_refresh(scope) after the drop (catalog.py:1496-1497), and that background re-walk's store opens a second BEGIN IMMEDIATE on the spied _db() and can restore trust. The re-walk is stubbed on the instance, the same pattern other tests already use, while _land_invalidation_drop still runs against the spy. Shortening two lines is safe: the opened fixture keeps its own reference to the holder index until teardown, and a None connection would still fail the spy assertion. No product, state, limit or trust changes; backend shards and the flake ratchet are green. Tier: 1, every tier gate passed. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved automatically by the code change approver, not by a person. The decider estimates a 4% chance that this change introduces a defect, within the 12% limit for approving on its own, and the change has at most 400 changed lines.
Test-only fix for a flaky test. The analysis is correct: _invalidate_iter_cache queues _request_catalog_refresh(scope) after the drop (catalog.py:1496-1497), and that background re-walk's store opens a second BEGIN IMMEDIATE on the spied _db() and can restore trust. The re-walk is stubbed on the instance, the same pattern other tests already use, while _land_invalidation_drop still runs against the spy. Shortening two lines is safe: the opened fixture keeps its own reference to the holder index until teardown, and a None connection would still fail the spy assertion. No product, state, limit or trust changes; backend shards and the flake ratchet are green.
Tier: 1, every tier gate passed.
Criteria: no merge conflict, no owner block, no change request, the default branch, no security-sensitive path, no design document to agree on, the readiness status, the review lanes, the P0 history, the linked issues' tier, the review lessons, no concern label, the file count, a safe change category, not its own change, the decider, the security checklist, the change matches its title, no competing change.
Decider v3c (217fe607). To overrule it, request changes or dismiss this review.
Problem / Motivation
Goal: Make
TestInvalidation::test_a_mutation_s_drop_waits_no_longer_than_the_index_s_own_timeoutdeterministic.The test fails intermittently on main with
the drop waited with busy_timeout=[0, 0](expected[0]), seen on docs-only PR #33463, Backend Tests (3.12, 8), run 44421446325.Why it matters
A red Backend Tests shard and Coverage Gate on PRs that change nothing near the skill catalog cost every author a re-run and a triage.
Not a goal
test_a_later_successful_drop_restores_trustand thedrop_firsttests cover it).What changed (motivation → approach → change)
Symptom: the busy-timeout spy recorded two
BEGIN IMMEDIATEreads where the test pins one.Root cause:
_invalidate_iter_cacheends by queueing a re-walk throughloader._request_catalog_refresh(scope). With the drop refused by the held lock, the re-walk'sstore_catalog(drop_first=True)opens its ownBEGIN IMMEDIATEthrough the same spied_db(). When the worker thread gets there before the assertion, the spy holds[0, 0]. The same re-walk could also land the drop afterheld.rollback()and restore trust, flipping thenot _trusted(loader)assertion. The product is right: that read belongs to a different transaction, at the base timeout.Change: the test stubs
loader._request_catalog_refreshto a no-op, so the spy sees only the drop. The docstring says why. Two locals (conn,holder) are folded so the file stays at the 2,000-line cap.Backwards compatibility
Compatible: test-only change.
Removes nothing: no product code, key or record changes.
Tests
test_a_mutation_s_drop_waits_no_longer_than_the_index_s_own_timeout: still pins that the drop'sBEGIN IMMEDIATEruns at the base busy timeout and that a refused drop is not trusted, now without the background re-walk racing either assertion.Proof: not provable -- test-only change
Determinism proof:
busy_timeout=[0, 0]. With the fix the re-walk is never started, so that condition cannot arise.-n 4(xdist order).PRAGMA busy_timeout = 5000before itsBEGIN IMMEDIATEturns the test red (busy_timeout=[5000]).Manual verification
N/A — unit coverage sufficient; the change is test-only.
Real-machine verification
Machine: Linux cloud desktop, Amazon Linux 2023 (kernel 6.12), aarch64, 64 vCPU
Before (main f75e80b): forced condition (wait for the queued re-walk) ->
AssertionError: the drop waited with busy_timeout=[0, 0]After (head f5b34a7e86f5):
pytest -q test/test_skill_catalog_snapshot.py::TestInvalidation::test_a_mutation_s_drop_waits_no_longer_than_the_index_s_own_timeout-> 50/50 pass; file under-n 420/20 passCleanup: own computer
Related Issues
Fixes #39374
Sibling sweep
Swept: git grep -n "_BusyTimeoutAtBegin(" -- test/
Siblings: none -- the busy-timeout spy is used by this one test only
Pattern harvest
Not generalizable: the race came from this test spying on a connection that a background re-walk shares; no lint shape separates that from a legitimate spy.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commitsContribution License Agreement
Contributed under the project's Apache-2.0 license.