Skip to content

Controls batch 15c: seeks anchored on the source-read clock, prime check and replay, seek contract docs, source-read clock, seqlock loom model (#1316, #1320, #1317, #1396, #1702) - #1703

Merged
tamashi095 merged 15 commits into
mainfrom
codex/controls-batch-15c
Oct 16, 2026

Conversation

@tamashi095

@tamashi095 tamashi095 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Controls batch 15c: the source and latency chain's second half. Every seek is anchored on the plan's source-read clock, and a host can read where each seek landed. A plan carries a source-read offset that a successor inherits and a declared discontinuity resets. A source consumer can check and replay its next blocks for a prime. The C header documents the seek contract and the ABI growth rule. The engine's one seqlock is modelled under loom. This PR sits on batch 15b and merges after it.

Closes #1316
Closes #1320
Closes #1317
Closes #1396
Closes #1702

What changed

Evidence

  • The full local CI-equivalent set (batch-gates.sh) passes at 8e73689 (the tree of ae580b0): fmt, bench and realtime policy (151 marked regions in 33 files), host-core feature matrix and loom, workspace clippy, the workspace tests, the doc job (cargo doc -D warnings), all 15 shell gates, the web build, check-sdk-headless (564 of 564), the 7 Python gates and the fuzz check. check-web-audioworklet failed there only because INDIRECT_SITES pins enter_block's mangled name, and Give a plan a source-read clock that leads its render clock #1396's impl PlanClocks moved it from Ms6 to Ms7; the site count stays 4 and the trap owners and panic entries are unchanged. The pin edit (c48cc38, owner-approved, made by root) renames the key; check-web-audioworklet passes at c48cc38. Later commits change comments and docs only (doc job and realtime policy re-run green).
  • Browser qualification passes at c48cc38 on Chromium 151.0.7922.34, Firefox 153.0 and WebKit 26.5 (--check-matrix --self-test-mutations); render-locked allocations are 0. Two earlier Firefox failures ("spectrum collection audio resume timed out") came from the local harness, not from 15c: its PulseAudio socket path was 119 bytes, over the 108-byte Unix limit, so the null sink never opened and Firefox's resume() waited for an audio server that did not exist (bisection: the result depended on time, not on the commit; with the socket up, 15c's head and its parents pass 2 of 2). The harness now uses a short path and stops if the socket is missing.
  • audit capi: 0 allocations, deallocations, locks and syscalls; pcm_digest 4f52089e4a8cf83c (unchanged from batch 15b).
  • Realtime policy: 151 marked regions in 33 files (the one new region is seqlock.rs's publish).
  • Loom: spsc_loom 15 of 15 (with the new peek model); seqlock_loom passes (4.3 s test time).

Re-pins (each from a measurement)

  • None. New report rows: seek_report_bytes (64 B per ring on 64-bit, 56 B on wasm32), prime_required_bytes (24 B / 12 B) and the clock record (32 B / 24 B); every host-web and C ABI ceiling holds (tightest: browser sourceOverheadBytes 2,474 of 2,496).

Review

  • Batch review (opus-high): PASS, no blocker or major. Five minors: four folded in 544da3b (policy-comment attribution, a doc that contradicted a literal mask pin, a clock-pair snapshot note, rewraps); the fifth (the seqlock had only an x86 stress test) became Model the engine seqlock under loom #1702, which root put inside this PR.
  • Root's question (are the two clocks read as a pair?): no reader needs them as a consistent pair; every planned caller reads one.
  • Model the engine seqlock under loom #1702 and fold verification: PASS; five mutants (each removed or weakened fence or ordering) all turn the loom model red. Three cosmetic minors folded in f0f10f8.

Issues to file from this batch's specs

Spec bodies to sync after merge

#1316, #1320, #1317, #1396, #1293 (D6 amendment), #1355 (note), #1702.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

tamashi095 and others added 15 commits October 16, 2026 04:16
…here it landed

- begin_block_at's anchor is the source-read sample (equal to the render clock in this version).
- Render publishes one seek report per ring through the engine's one single-writer seqlock
  (new crates/engine/src/realtime/seqlock.rs, B15-R1; watermark.rs moved onto it): generation in
  effect, source-read sample and source frame of its first block, cumulative underrun and held
  frames.
- C ABI: miso_engine_v1_source_seek_report (struct miso_engine_v1_seek_report, 64 bytes; feature
  bit 1 << 8, mask 0x1ff); frozen symbol list 18. Browser export is out of scope per the spec
  (#1332, #1293).
- seek_report_bytes resource row (64 B per ring on 64-bit, 56 on wasm32); no ceiling moved.
  realtime policy floors 32/150 -> 33/151. audit capi pcm_digest unchanged (4f52089e4a8cf83c).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndependent of #1332 (root ruling)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rime

- spsc Consumer::peek (shared read, changes nothing; unit and loom tests).
- source: prime_ready (read-only readiness walk) and prime_block_at (plays the blocks the
  consumer would have played, observing no command), PcmSourcePrimeFlag shared by the handle
  and the consumer, prime_required_bytes report row (24 B per ring on 64-bit, 12 on wasm32).
- 0 allocations for readiness and sixteen primes; realtime policy unchanged (151/33); audit capi
  unchanged (4f52089e4a8cf83c). Callers are #1355's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ader

Eleven seek paragraphs on the source-read clock (equal to the render clock in this version),
the ABI growth comment (B15-R3), the qualification record, and abi_smoke.c tests each defined
feature bit instead of the exact mask. #1355 note: amend the clock sentence and call prime_ready
on the source-read sample when the offset becomes nonzero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1323 keeps C feature bit 1 << 8 (lands first); #1316's FEATURE_SOURCE_SEEK_REPORT moves to
1 << 9; mask 0x3ff; frozen symbol list 19.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A plan carries a source-read offset: the source section reads at render sample + offset
(checked; overflow is TimeOverflow). The inventory records it; an ordinary successor inherits
it and a discontinuity successor resets it to 0 (runs_behind_natural_timing gains the offset
term). Render publishes the active plan's render and source-read clocks after each block (two
Release stores into a preallocated record, 32 B native / 24 B wasm32); PlanPublisher reads them.
In production the offset stays 0 until #1355; the header's "equal to the render clock in this
version" stays true. realtime policy 151/33; audit capi unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd redundant ffi pin, clock-pair snapshot note, rewraps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
seqlock.rs takes its atomics and fences from the realtime sync shim (spsc.rs's mod sync, now
visible inside crate::realtime), so loom models the protocol; a non-loom build resolves to the
same core items. Loom model seqlock_loom_a_read_is_one_whole_record_or_busy (one writer, two
records, one reader): a read is one whole record or Busy. Under cfg(loom) only, a read takes 2
attempts instead of 64 so loom can finish (4.3 s). Red with the reader's Acquire fence, the
second sequence compare or the writer's Release fence removed (torn records). CI: a seqlock
loom step next to the SPSC leg. No ordering changed; realtime policy 151/33.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…agraphs and the policy comment; the clock-pair doc says a reader needing both would need them published as one seqlock record

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l index (Ms6 -> Ms7, #1396 added impl PlanClocks above it; count unchanged; owner-approved)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tamashi095
tamashi095 merged commit 35ac175 into main Oct 16, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant