Repository navigation
fix: the job_row_decode bench feeds the fence epoch today's decoder reads - #619
Merged
Merged
Conversation
…eads _job_row_from_record has bound claim_epoch into every JobRow since 01.00.18_02_pre_claim_epoch.sql (#369), but the bench's FakeRecord was frozen the day before that landed and never grew the key, so every run_bench.py pass over the rows group died with KeyError: 'claim_epoch'. The fake record now carries claim_epoch=1 (a mid-claim running row, so the epoch the dispatch claim just bumped to), the B variant decodes the same fence field instead of silently skipping work A must do, and the correctness check compares it. FakeRecord's lookup type is fixed to match what it models (asyncpg.Record lookups are Any, not object), which drops the file's pyright noise from 73 to 32 errors, none on touched lines. No metric was renamed: the meaning of every number is unchanged.
ZEAZX26
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Red proof
python benchmarks/run_bench.pyonorigin/main@7a244081dies in therowsgroup:Broken surfaces, named:
run_bench.pyfull suite — hard crash (KeyError: 'claim_epoch'); therowsgroup never completes, so--json,--save-baseline,--checkare all unreachable on a real run.run_bench.py --only rows— same crash.--only di,--only jsonb,--only decode,--only cron,--only retry,--only evict,--stall,--check(gate renders and exits correctly against the committed baseline), standalonebench_hotspots.py, andprofile_hotspot.pyall ran clean pre-fix.benchmarks/results/are untouched and remain valid — this is runner rot only.Root cause
claim_epoch(the terminal-write fence column from01.00.18_02_pre_claim_epoch.sql, #369) was added to the jobs table,JobRow, and_job_row_from_recordon 2026-09-20. The bench'sFakeRecordinbench_job_row_decodewas last touched 2026-09-19 — one day before — and was never updated, so the fake record rows stopped satisfying the contract of the real decoder they are fed to. Classic instrumentation drift: the source of truth moved, the fixture didn't.Fix
benchmarks/bench_hotspots.pyonly:make_recordnow emitsclaim_epoch=1— honest for the fixture (statusrunning, attempt 1: the epoch the dispatch claim just bumped to), and the key_job_row_from_recordreads today.b_decode) now decodesclaim_epoch=rec["claim_epoch"]too. It previously builtJobRowwithout the field, meaning B was silently skipping decode work A must do — the speedup number would have been a lie once the crash was papered over.a.claim_epoch == b.claim_epoch.FakeRecord's lookup type corrected from-> objectto-> Anyon adict[str, Any]base — it modelsasyncpg.Record, whose lookups areAny. This is a type-level fix only and drops the file's pyright noise from 73 to 32 errors; no runtime meaning changes.No metric was renamed: no metric's meaning changed — every key the harness reads is a key the instrumentation still emits; the missing direction (fixture → decoder) was the rot. Baseline names are unchanged, so the committed
baseline.jsonstill merges.Proof: two green runs (full suite, final code state)
Run 1:
(all 19 benches OK — full table in the run history; every group completes, no KeyError)
Run 2:
Stable:
job_row_decodeA within 0.3% across runs; every verdict OK in both.Magnitude vs the committed
benchmarks/results/baseline.json(same machine class):job_row_decodebaseline 5.04 ms → now 6.6–6.8 ms — same order of magnitude, and A now legitimately decodes one more field (theclaim_epochfence) than when the baseline was captured.cron_next_fire541 µs → ~625 µs,evict_keyed74 µs → ~97 µs: comparable.--checkagainst the committed baseline runs end-to-end and renders the full verdict table.Also exercised:
--stall(probes captured and parsed), standalonebench_hotspots.py,profile_hotspot.py. The suite is in-process (no bench group opens a DSN); a PG18 container was up regardless to rule out hidden DB coupling.Gates
ruff check benchmarks/bench_hotspots.py— clean.ruff format --check benchmarks/bench_hotspots.py— clean.pyright benchmarks/bench_hotspots.py— 32 errors, down from 73 on main, and none on any line this PR touches; the residue is pre-existing typing noise in untouched benches (DI stubs, retry, evict). Note:benchmarks/is outside the project's pyright gate (include = ["src", "tests", "examples"]; CI runspyright src/taskq tests).src/ortests/files changed.