Repository navigation
test(wakatime): start the read-audit cache cold so the status load count is exact - #37726
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 blocks. This is a test-only change: it pins the process-wide cache state the count depends on, and the assertion stays an exact sequence. [DESIGN-REVIEWED] a0d12de Description read[DESCRIPTION-READ] 8c02c93fb46129c2a4c4bd2733464f407d88088dbc0a99e138c4eb0017a52d8e 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: |
…unt is exact The status route reads the OAuth client secret beside the client id. That secret read asks the vault's read audit whether it is on, and with no live snapshot `secrets.read_audit._enabled` loads config.json once per TTL and caches the answer process-wide. So the route loads config twice on a cold cache and once on a warm one, and the test's exact `[False]` pin passed or failed depending on which test ran before it. Pin both inputs: no live snapshot and an empty audit cache. The test now asserts the exact cold-cache sequence `[False, False]`, both loads off the event loop, whatever ran first.
feae664 to
a0d12de
Compare
Code change approver recommendation: ApproveWhy: the decider estimates a 5% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. Test-only fix, and it is correct. The status route loads config twice, both off the event loop inside 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 |
…7659 testing-conventions §4 already says a new process-global ships its floor entry. #37659's secrets.read_audit._loaded did not, and made test_status_loads_config_off_the_event_loop red by order (fixed in #37726, floor entry in #37754). Record why the rule did not stop it and add a pre-push grep that flags new module-level state, plus a writing-tests pointer and checklist item. Part of #37737
…7659 (#37750) testing-conventions §4 already says a new process-global ships its floor entry. #37659's secrets.read_audit._loaded did not, and made test_status_loads_config_off_the_event_loop red by order (fixed in #37726, floor entry in #37754). Record why the rule did not stop it and add a pre-push grep that flags new module-level state, plus a writing-tests pointer and checklist item. Part of #37737
Problem / Motivation
Goal:
test_status_loads_config_off_the_event_loopstops failing on main whenever it runs in a shard without the tests that warm its caches.The test asserts
on_loop == [False]: exactly oneKiroCrewConfig.load, off the loop. The status route now loads config twice, both off the loop: once inoauth._client_credentialsfor the client id, and once more when the vault's read audit (secrets.read_audit._enabled) runs on the secret read beside it. Run alone, the test sees[False, False]and fails. It fails on maince18586acbrun by itself, and it reddened Backend Tests (3.12, 1) on #37698 and #37646, whose shards put it first.Why it matters
Unrelated PRs go red on backend shard 1 and on Coverage Gate, which fails closed on it.
Not a goal
What changed (motivation -> approach -> change)
The count depends on hidden process-wide state (the live snapshot and the read-audit cache), so pin that state instead of loosening the count -> the test sets
live.snapshotto return None andread_audit._loadedto None -> it asserts the exact cold-cache sequenceon_loop == [False, False]: one load for the client id, one for the audit switch, both off the loop.Backwards compatibility
Compatible: test-only.
Removes nothing: the assertion stays an exact sequence. A load on the loop, or an extra or missing load, still fails it.
Tests
test/test_wakatime_handlers.py: the test passes alone, and withtest/test_vault_read_audit.pyrun before and after it (68 passed each order).Proof: not provable -- test-only change
Manual verification
N/A: test-only. The two loads were confirmed with a stack probe:
oauth.py:_client_credentialsandvault.py:get -> read_audit.py:_enabled.Screenshots / video
N/A: no user-visible UI change.
Related Issues
Seen on #37698 and #37646.