Remove the remaining wall-clock flakes from the peer evidence tests #172
Labels
No labels
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/mail-mind-mcp#172
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
tests/test_peer_evidence.pyhas more wall-clock bounds of 1 s or less than the two that #165 fixed. Each one can fail CI under load on the shared Woodpecker runner, as the old:831and:423bounds did on pipelines 22 and 27. None of the sites below has failed CI yet, so this change is preventive. The #165 gate kept them out of scope (#165 spec, Agent Adjustments item 1).Line numbers are at
mainfebfb55, after #173::354(test_real_lock_contention_is_busy_in_50_ms):assert 0.035 <= elapsed < 0.5.:402,:409,:410(test_sql_progress_cancellation_closes_connection):in_sql.wait(1),future.result(timeout=1)andtime.monotonic() - started < 1.:501,:502,:514,:516(test_two_slots_timeout_cancellation_and_shutdown):started[0].waitandstarted[1].waitwith 1 s,stopped[0].waitwith 1 s, andtime.monotonic() - at < 1.:547(test_cancel_before_worker_start_releases_exactly_once):future.result(timeout=1).:751,:754,:755(test_served_slow_peer_does_not_block_status_or_people):entered.waitwith 1 s,asyncio.wait_for(..., 1)andtime.monotonic() - started < 1.:932,:939,:944,:946(test_running_job_cleanup_during_extraction_and_encoding):entered.waitwith 1 s,asyncio.wait_for(task, 1),stopped.waitwith 1 s, andtime.monotonic() - at < 1.:978,:982(test_parent_cancellation_records_outcome_once):entered.waitandstopped.waitwith 1 s.Change
Apply the #165 rule to each site.
BOUNDED_WORK_SECONDS = 5(tests/test_peer_evidence.py:33) is the shared margin.BOUNDED_WORK_SECONDS.event.wait(1)orfuture.result(timeout=1)) usesBOUNDED_WORK_SECONDS.:354guards a contract value: the 50 ms busy timeout of ADR 0008 (docs/adr/0008-evidence-scope.md:51). Keep the0.035lower bound, which proves that SQLite waited. Change the upper bound toBOUNDED_WORK_SECONDS. Add a direct assertion that the peer read connection opens withbusy_timeout_ms=50, so the 50 ms value stays guarded exactly.Acceptance
BOUNDED_WORK_SECONDSor is removed with a stated reason in the PR.:354keeps the0.035lower bound and gains a directbusy_timeout_ms=50assertion that fails if the value changes.make checkpasses.Blocked by
None. #165 is closed (PR #173,
febfb55).Filed under: operator word "yes. proceed" sha256:8b8e998d2a5b
Agent Brief
Category: bug
Summary: Give every remaining wall-clock bound in
tests/test_peer_evidence.pythe #165 margin, and guard the 50 ms busy timeout by value, not by wall clock.Current behavior:
tests/test_peer_evidence.pyuse a hard-coded 1 s or 0.5 s. The issue body lists every site atmainfebfb55.test_real_lock_contention_is_busy_in_50_ms(:354) proves the ADR 0008 50 ms busy timeout only through0.035 <= elapsed < 0.5. A slow runner can fail it, and that failure is not a regression.BOUNDED_WORK_SECONDS = 5at:33and used it intest_full_cap_pathological_bodies_finish_and_cancel_boundedonly.Desired behavior:
BOUNDED_WORK_SECONDS, or the PR states why the bound was removed (a latency-only bound, per ADR 0012 rule 14).:354keeps0.035 <=and uses< BOUNDED_WORK_SECONDSfor the upper bound. A new assertion in that test, or in a sibling test, proves that the peer read connection opens withbusy_timeout_ms=50. One way is to capture thebusy_timeout_mskeyword ofstorage._connect(the test importsmail_mind_mcp.store as storage) throughmonkeypatch, as:397already patches it. The assertion must fail if any peer reader passes another value.Already decided (cite, do not re-open):
tests/test_peer_evidence.py:33.docs/adr/0012-mail-peer-feed-implementation.md, rule 14.docs/adr/0008-evidence-scope.md:51. The peer readers pass it atsrc/mail_mind_mcp/store.py:2686,:2753,:2860and:2995.Key interfaces:
BOUNDED_WORK_SECONDSintests/test_peer_evidence.py.storage._connect(path, *, read_only, busy_timeout_ms)(src/mail_mind_mcp/store.py:3542, default 30,000 ms), the seam for the direct assertion.peer.PeerErrorwithmatch="busy", which:354already uses.Acceptance criteria:
grep -nE 'wait\(1\)|wait, 1\)|wait_for\(.*, 1\)|timeout=1\b|< 1\b|< 0\.5' tests/test_peer_evidence.pyprints no output. Atfebfb55it prints the 18 listed sites. If a line stays, the PR names it and gives the reason.:354keeps the0.035lower bound.busy_timeout_ms=50on the peer read connection, and it fails when the value is changed. Check this by hand once and say so in the PR.uv run python3 -m pytest -q tests/test_peer_evidence.pyis unchanged, plus any new test.make checkpasses.Out of scope:
src/.BOUNDED_WORK_SECONDS.