Repository navigation
test(app-route-trust-gate): seed transcripts off the event loop - #19711
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] df027d6 Description read[DESCRIPTION-READ] 55ae0d8bb60b839e2db8b833408ae4dca3e60d41249202d42b786063a4635cbf 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: |
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: |
|
Backend Tests (Windows) (6) failure is not caused by this PR. The one failing test is Evidence:
Re-ran the failed jobs. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (1 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: test-only change that seeds transcripts on a worker thread and adds a test that pins the atomic replace off the event loop.
Problem / Motivation
Goal: The app-route trust-gate tests stop going red on Windows when a scanner briefly holds a freshly written transcript temp file.
test_app_catalog_does_not_return_metadata_from_a_foreign_incarnation[query1]failed on Windows shard 4 on a PR that touched none of its code: its seed write failed withPermissionError: [WinError 5] Access is denied: '...\tmp….tmp' -> '...\dashboard_plain-chat.jsonl'insidereplace_with_retry.Why it matters
Each red lands on whichever PR shares the shard and costs a rerun. Most async tests in this file seed the same way, so any of them can take the same hit.
Not a goal
replace_with_retrykeeps re-raising on the event-loop thread on purpose (it must not sleep the gateway loop).test/off_loop_helpers.off_loop.What changed (motivation → approach → change)
Symptom → cause. The test's
_transcriptseed helper ran on the event-loop thread of an async test. There,replace_with_retryre-raises a Windows sharing violation on the first attempt instead of retrying, so a scanner touching the new temp file for an instant failed the seed. This is the same class #17828 fixed intest_telegram_sessions.py.Change.
_transcriptintest/test_app_route_trust_gate.pynow runs its writes on a worker thread throughoff_loop, like the dashboard handlers reach the store. Every caller in the file gets the bounded Windows retry, including the ones already wrapped inasyncio.to_thread. A new test pins that the seed's atomic replaces never run on the loop thread.Backwards compatibility
Compatible: test-only change; no production code or contract is touched.
Removes nothing: the seed helper writes the same transcript, only from another thread.
Tests
test_transcript_seed_replaces_files_off_the_event_loop: records whether eachos.replacethe seed makes runs with a running event loop, and asserts at least one replace happened and none was on the loop. Red with_transcriptcalling the writer directly (the parent's shape), green withoff_loop.-n0; the whole file passed 10/10 at-n 4and once in a shuffled order (seed 19561), 68 passed.Manual verification
N/A — unit coverage sufficient: the Windows sharing violation itself cannot be reproduced on Linux, so the pin asserts the property that gives the retry (the write runs off the loop).
Related Issues
Fixes #19561
Pattern harvest
Rule candidate: semgrep
Pattern: an
async deftest calling a sync store writer that ends inreplace_with_retrydirectly on the loop thread.Checklist