Skip to content

feat(browser): move PCM feed ownership into the SDK - #398

Open
tamashi095 wants to merge 16 commits into
codex/dx-host-controlfrom
codex/dx-browser-control
Open

feat(browser): move PCM feed ownership into the SDK#398
tamashi095 wants to merge 16 commits into
codex/dx-host-controlfrom
codex/dx-browser-control

Conversation

@tamashi095

@tamashi095 tamashi095 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Moves the codec-neutral browser PCM ring, writer, feed lifecycle and worklet prelude into the SDK. FLAC delivery, verification, storage and pump scheduling remain adapter-owned. Attachment failures release resources before rejection, and closing a pending feed settles readiness promptly.

Dedicated Astra medium review PASS at a049302; issue #405 is closed. Focused lifecycle/layout regressions, all five known faulty variants, strict DOM consumers, headless tests and packed package checks pass. The six generated engine artifacts are unchanged. Review evidence is attached to this PR.

Stacked on #413 (host-owned request IDs). No progressive playback or new backend. Downstream app integration uses exact reviewed vendored archives; this PR does not claim npm publication.

@tamashi095

Copy link
Copy Markdown
Contributor Author

Astra adversarial review — issue #393, PR #398

Verdict: FAIL (attempt 1). Reviewed commit f21c426e against 0e248bb0, repository AGENTS.md, and the approved issue #393 spec. Read-only review; no repository edits or Cargo builds.

Concrete findings

  1. P1 — Shipped public declaration contradicts runtime. hosts/host-web/web/miso-engine-v1-audio-worklet-host.d.ts:326 still requires requestId on MisoCommandRequest; the same defect exists for observation (444), source (598), seek (609), meters (639), and telemetry (643). Runtime now rejects that field. A direct typed consumer therefore cannot express the newly valid payload and is steered toward runtime-invalid requests. Only sdk/src/browser/shipped-host.d.ts was updated. Root’s check-sdk-generated.log confirms mandatory mirror comparison failure. Correct the authoritative declaration and keep the SDK copy identical.

  2. P1 — Required AudioWorklet gate fails on the changed request contract. scripts/check-command-reason-vocabulary.py:223 and :229 still assert the old observation field set. Root’s full AudioWorklet log reaches this check after successful WebDriver tests, then exits with Invalid: observe() no longer accepts exactly requestId/subscriptions: ['subscriptions']. The previous localhost restriction is no longer the blocker. This existing validator must follow the approved hard break, preserving its other receipt/observation discriminators. That script is outside the current allowed paths, so amend the spec before changing it.

Missing mandatory evidence (separate from production findings)

  • Gate 1: the added type probe covers command only. There are no all-six request-shape and readonly-response probes. Runtime extra-ID rejection covers command only, and errorResult checks key presence/result but not requestId === 0.
  • Gate 2: no 200-call mixed-host regression exists. The console test still uses a fake object whose command always reports ID 2; it cannot reproduce createBrowserConsole(realHost) -> direct meters -> console.submit, both meter/command orderings, or mixed source/control correlation.
  • Gate 3: existing source/seek/command saturation tests remain useful, but do not establish the specified zero-ID/no-send/no-burn contract for every bounded class (status, sessionMap, meter lease, telemetry lease included), plus requests after disposal. Source/seek settled IDs now demonstrate one subset of no-burn behavior.
  • Gate 4: shared-buffer transfer-once and source backpressure ownership are covered by existing tests, but malformed-source caller ownership and the full mixed source/seek/control ID contract need the specified evidence.
  • Gate 5: no safe-integer boundary test exists. Independently copied the production host to /private/tmp/dx-393-unchecked-host.mjs, removed exactly if (this.#lastRequestId >= Number.MAX_SAFE_INTEGER) return null;, and ran MISO_ENGINE_WEB_HOST_TEST_MODULE=/private/tmp/dx-393-unchecked-host.mjs node scripts/test-web-audioworklet.mjs. Exit 0, web AudioWorklet hermetic tests passed. The required unchecked-increment red mutation currently stays green.
  • Gates 8–9: packed payload-only browser consumer and focused browser qualification success have not been established by this review. Root owns remaining package/browser checks. Generated and full AudioWorklet checks are conclusively failing as above, regardless of remaining results.

Verified scope and preserved behavior

Actual diff is within currently allowed paths; raw worklet, Rust, Wasm, wire handlers, and render code are unchanged. Production host has a single increment site, guarded by MAX_SAFE_INTEGER; disposed/saturation checks precede it; malformed requests reject before the common allocator. observe() delegates once to command(). The SDK counter is removed. The command encoder, receive validator, atomic acknowledgement fields, and SDK typed report mapping are unchanged. Existing runtime receipt tests still check admitted count, reason/index, applied sample, and returned records. No additional production defect in these unchanged contracts was established.

The artifact hash mismatch under investigation by root is not classified as a regression without baseline evidence. This verdict does not widen scope into existing raw-worklet/Rust/ABI behavior. No success is inferred for unexecuted gates.

@tamashi095

Copy link
Copy Markdown
Contributor Author

Astra adversarial re-review — issue #393, attempt 2

Verdict: FAIL — remaining mandatory regression evidence only; no production defect found. Reviewed beeb8557 against attempt 1 f21c426e, baseline 0e248bb0, and the approved attempt 2 addendum. No repository edits or Cargo builds.

Attempt 1 production findings are fixed

The authoritative host declaration and SDK mirror now both omit IDs in all six request categories. Response declarations retain their existing readonly IDs. Observation vocabulary comparison now expects subscriptions alone and includes red mutations restoring the old declaration and runtime guard. Generated and full AudioWorklet gate logs pass. Raw worklet, Rust, Wasm, ABI and artifact pin remain unchanged. Meter/telemetry callback assignment precedes admission exactly as in baseline; no new callback regression.

Remaining mandatory evidence findings

  1. P2 — Committed public-type probes still do not cover the frozen contract in full. sdk/test/console-types.ts:16–31 adds old-shape compile errors for command, observation, source and seek, but no old-shaped meter/telemetry probes. Readonly mutation probes cover command and status only, omitting acknowledgement/source/seek/lease, observation, session-map and error response types. Packed smoke lines 102–111 positively checks all six payload-only calls, but a future optional caller ID or writable response ID would still pass those tests. Add the missing negative/type assertions; do not rely on the evidence paragraph's claim of all-six type probes.

  2. P2 — Persistent source transfer coverage never represents a successful source admission. scripts/test-web-audioworklet.mjs:110 always returns result 6 for non-error source replies. Thus the new loop at lines 469 onward contains 250 resolved calls, of which 225 are result-zero successes and 25 are source backpressure replies. Existing shared-buffer tests prove transfer/return under backpressure and errors, and malformed/saturated source ownership is now checked; none proves result-zero source success with its transfer/return assertions. Freeze a source success fixture result for the mixed loop or one focused transfer test, assert result zero, and verify buffer detach/returned planes on that path. Retain the separate backpressure/error ownership tests. Correct the current evidence wording accordingly.

These are bounded test corrections, not authorization to change host behavior or weaken the frozen gates. The user/root requires persistent regressions; temporary reviewer evidence below does not substitute for those missing committed cases.

Independent supplemental evidence

  • /private/tmp/dx-393-astra-types.mts passed strict TypeScript compilation against the actual SDK declaration. It checks all six request parameter types exclude requestId, negative meter/telemetry old shapes, and readonly assignment errors for MisoAck, MisoCommandAck, MisoObservationAck, MisoStatus, MisoSessionMap and MisoError. Command: ./sdk/node_modules/.bin/tsc --noEmit --strict --target ES2022 --module NodeNext --lib ES2022,DOM /private/tmp/dx-393-astra-types.mts.
  • /private/tmp/dx-393-astra-mixed.mjs uses the real current host and SDK console, modifying only the copied test fixture to return result zero for sources during the mixed loop. It also compares acknowledgements directly to recorded send order and verifies adjacent IDs differ by one. Output: Supplemental: 250 result-zero calls, actual send IDs 2..251, observe single allocation; then web AudioWorklet hermetic tests passed.

Other gates assessed

The committed mixed-call loop covers every host class plus real SDK-console/direct-meter interleave without a caller counter. Its sorted unique IDs and sequential awaits establish ordering; the supplemental consecutive/send comparison strengthens the one-allocation proof but is not a separate new blocker.

The capacity tests cover source, seek, command/observe, status, sessionMap and both leases, asserting local ID zero/no message and subsequent no-burn behavior. Disposal exercises all eight request methods. Old-shaped runtime refusal covers all six categories; malformed source retains its caller buffer. The private safe-integer transformed module proves MAX_SAFE_INTEGER once and repeated local exhaustion, with an unchecked-guard mutation required red by the shell gate. The implementation has one increment site and observe delegates only once. Encoder, atomic command receipt semantics and SDK typed receipt mapping are unchanged.

Root-provided logs establish full AudioWorklet, generated surface, SDK types, headless (133 pass/one platform skip), and packed consumer success. Root owns final actual Chromium qualification; this report does not assume a pending browser result. The verified baseline CI artifact workaround is documented, with unchanged-base Darwin digest mismatch separately established; no repin or unsupported regression finding is requested.

Scope remains within the amended allowlist. Attempt 3, if authorized, needs only the missing persistent evidence and truthful final record, followed by the required verdict; no fourth attempt is permitted.

@tamashi095

Copy link
Copy Markdown
Contributor Author

Astra final adversarial review — issue #393, PR #398

PASS — attempt 3. Reviewed exact commit bed7634c7bb86ede24b577dc09ab9895208d803f. Independently verified origin branch refs/heads/codex/dx-browser-control points to that commit using git ls-remote. Worktree is clean.

Attempt 3 changes only the issue evidence, scripts/test-web-audioworklet.mjs, and sdk/test/console-types.ts. Production source and declarations are byte-identical to reviewed attempt 2 beeb8557. No new production findings and no remaining mandatory evidence gap identified.

Corrections verified

  • All six request categories now have persistent caller-ID exclusion probes, including negative meter/telemetry calls and keyof assertions. Readonly requestId assignment probes cover every affected response interface: MisoAck, command, observation, status, sessionMap, and error.
  • The real-host mixed fixture now returns result zero for source admission and asserts that result. It verifies successful shared-buffer transfer once, caller detachment, returned plane count/offsets, shared backing identity and backing length. Existing result-6 and error transfer/return cases remain separate earlier in the suite.
  • The 250 mixed calls are compared directly with actual send order, occupy IDs 2 through 251, are adjacent and unique, and demonstrate observe consumes one ID. The real SDK-console/direct-meter reproducer remains covered.

Independent executions

  • node scripts/test-web-audioworklet.mjs — PASS: Issue393 mixed calls: 250 result-zero, send IDs 2..251, adjacent, observe single allocation; hermetic suite passed.
  • bash scripts/check-sdk-types.sh — PASS.
  • Source-success red mutation in /private/tmp/dx-393-attempt3-source-red.mjs: restored source fake result 6 instead of 0; suite failed at mixed source admission succeeds, actual 6 versus expected 0. This directly discriminates the prior missing success path.
  • Type red mutation in /private/tmp/dx-393-attempt3-host-red.d.ts: restored optional caller IDs for meter/telemetry. Compiling the copied actual type test fails with two unused expect-error directives and two failed NoCallerId assertions. The new guards reject optional compatibility leakage as well as required IDs.

Retained qualification and scope evidence

Reviewed attempt-3 full AudioWorklet log, including safe-integer boundary and unchecked-increment red mutation PASS. Attempt-2 generated/type/headless/packed logs remain applicable to identical production; headless has 133 passes and one documented platform skip. Actual browser logs report all qualification gates passed in Chromium 151.0.7922.34, Firefox 153.0 and WebKit 26.5.

Earlier review verified all bounded response classes refuse locally with ID zero/no send/no burn, all post-disposal request methods refuse locally, all six old runtime request shapes reject, malformed/saturated source storage remains caller-owned, the host has one safe-integer allocation point, observe delegates once, and SDK counter removal preserves typed command receipts. Those production paths are unchanged in attempt 3.

The CI artifact closure workaround remains truthful: pinned baseline Wasm/raw worklet/metadata reused, with only reviewed host JS/declaration overlaid; unchanged-base Darwin reproduction limitation is separately documented and no artifact is repinned. Raw worklet, Rust, ABI, Wasm, session behavior and realtime callback remain outside and unchanged by this issue. Meter callback timing matches baseline, with no unrelated lifecycle redesign.

This PASS covers the reviewed implementation and attached qualification. Root still owns final PR evidence and GitHub issue synchronization/closure; this review does not itself merge, publish, or close anything.

@tamashi095 tamashi095 changed the title fix(browser): let the host own request IDs feat(browser): centralize SDK control and PCM ownership Sep 5, 2026
@tamashi095

Copy link
Copy Markdown
Contributor Author

Issue #405 — Astra attempt 1 review: FAIL

Reviewed clean a86f3cf4 (source 5a717d7b, tests a86f3cf4) against approved daf0d134 / issue #405 and preflight. No repository source edits. The authority move stays within allowed paths and preserves generated assets, but two public product defects and missing frozen proof prevent PASS. This is one adversarial verdict for attempt 1.

Blocking findings

  1. P1 — close does not settle pending ready calls. sdk/src/browser/pcm-feed.ts:14 only checks closed state after await wait(0) returns. With two callers whose injected waits remain blocked, close sets state closed and detaches/disconnects once but neither promise settles. Independent /private/tmp/dx-405-astra-repro.mjs reports waited:2, state:"closed", results:[] after close and a 30 ms observation; expected two closed rejections. A timeout closing the feed likewise cannot settle another blocked caller. Implement internal terminal notification for every pending call and commit the required blocked-wait regression. The committed test calls ready only after close, so it cannot catch this defect. Also restore the baseline monotonic performance.now() default: the unrequested Date.now() replacement makes the timeout depend on wall-clock changes.

  2. P1 — the public feed types reject existing browser consumers. sdk/src/browser/pcm-feed.ts:11 requires sources: Msb1RingLayout[], forcing callers to supply frameCapacity and capacity even though attach overrides both; the frozen source input is ID/channels. The same line fixes factory context to structural FeedContext, so an existing (BaseAudioContext, string, AudioWorkletNodeOptions) => AudioWorkletNode factory fails strict parameter variance. /private/tmp/dx-405-astra-dom.ts compiled against emitted declarations gives TS2739 for a normal source and TS2322 for that real DOM factory; /private/tmp/dx-405-astra-dom.log records both. The SDK-wide typecheck passes because no committed PCM DOM-consumer fixture exists. Preserve real context inference and the original source shape, without adding DOM globals to SDK configuration.

  3. P2 — the frozen ring/writer/lifecycle regressions are absent or vacuous. sdk/test/browser-pcm-evals.mjs:8 asserts plane count/initial zeros/release and rejects capacity 3; it does not assert byte lengths, control/header offsets and words, source UTF-8 boundaries, actual slot/header generation and seek contents, counters, full-ring retention, wrap/reuse zero-fill, malformed layouts or odd-source behavior. Merely calling commit/seek proves none of their outputs. Lines 25–43 omit successful and empty readiness, exact ring identity, injected factory precedence over a available default, explicit module URL, moduleLoad/nodeCreate operations, multiple pending close, and timeout release/detach/disconnect exactly once. The attach-failure test's unused ring variable never observes writer state. Use observable nonzero states on all captured rings before throwing and assert cleanup before rejection, including cleanup exceptions. Independent review confirmed this cleanup implementation works on three engaged rings even when detach/disconnect throw; the missing proof does not imply that cleanup code is broken.

  4. P2 — the actual moved prelude oracle and runtime allocation discriminator are missing. sdk/test/browser-pcm-evals.mjs:46 only reads text and checks two regexes/token presence. It never registers or runs the processor, submits PCM, retries result 6, rejects a stale generation, or detaches. Inserting new Float32Array(4) into drain still passes this policy. The existing Rust realtime policy does not scan this SDK JS asset. Port the adapter behavioral oracle and add runtime typed-array constructor/subview instrumentation around first and steady successful drain, including partial tails; a narrow source check is complementary. Independent review script /private/tmp/dx-405-astra-prelude.mjs verifies the current copied asset's positive behavior and zero tracked allocations, so no prelude rewrite is warranted.

  5. P2 — packed PCM consumer gate is not exercised. sdk/test/package-tarball-smoke.mjs only adds PCM export existence, URL/file existence, and NOTICE substring assertions. Its fresh TypeScript consumer does not import/call the PCM API, and its runtime consumer does not prepare/attach with packaged defaults and the injected node/module seams. Add the frozen packed-consumer calls and strict DOM factory fixture; checking exported function names cannot qualify this product contract.

  6. P2 — moved-source earlier provenance is not preserved in NOTICE. NOTICE:5 records only adapter commit 63b4ee6. The authorized adapter NOTICE separately attributes the MSB1 writer to misofm/engine bd7f330a9773ce43bb077f0e6d5c8fc30fe9e27c, allocation/reader contract to misofm/app 7485693e9bbcf2f65a91a4e5950e22d678d99062, and feed prelude/attach mechanism to that app commit. Preserve those relevant earlier attributions in repository/staged NOTICE, as expressly frozen by the spec. The prelude's retained app header does not attribute the TypeScript ring/feed and refers readers to NOTICE. No earlier implementation source was inspected.

Verified positive evidence

  • bash scripts/check-sdk-types.sh: PASS.
  • bash scripts/check-sdk-generated.sh: PASS (its normal metadata checks only; no WASM rebuild/repin).
  • bash scripts/check-sdk-headless.sh /private/tmp/dx-393-current-artifacts: PASS, 137 pass / 1 skip / 0 fail; log /private/tmp/dx-405-astra-headless.log.
  • npm run check:package -- /private/tmp/dx-393-current-artifacts in sdk (invokes scripts/sdk-package.sh check): PASS, fresh tarball smoke passed; log /private/tmp/dx-405-astra-package.log.
  • All six generated artifacts in sdk/dist/assets are byte-identical to the authorized Give the browser host sole ownership of its request-id ledger #393 artifact directory; each manifest byte count/digest agrees. The Move the existing browser PCM feed into the TypeScript SDK #405 diff changes no hosts, SDK generated source, or SDK ABI/parameter JSON.
  • Prelude SHA-256 is d81c2159b6ca088df97e76f09c4803540e6451920cc3af1b091336fa1bdba58d, identical to current authorized adapter 63b4ee6:src/internal/engine-web-feed-worklet.js.
  • Reviewer runtime prelude oracle independently passed three mono/stereo rings, first partial-tail PCM, submit backpressure retention, seek retry on result 6, stale-generation rejection, underrun, attachment/detachment and zero instrumented typed-array constructors/subarray/slice calls during first/steady processing. It also demonstrates the committed static policy accepting a Float32Array allocation mutation.
  • Independent attach-post failure reproduction engages all three rings before throwing and proves [0,0,0] writer states before disconnect and typed attachPost rejection, surviving detach/disconnect throws.
  • Working tree remains clean. Reviewer artifacts live only under /private/tmp and do not replace committed regression evidence.

Separate PR #398 CI merge blockers (not #405 implementation scope)

Root reports qualification run 33935625430 fails lint on undocumented MISO_ENGINE_WEB_HOST_MAX_SAFE_TEST and AudioWorklet test line 1502 on Node 22.23.2 (deadlineMisses actual 1, expected 0); SDK/package/browser jobs pass. I did not independently rerun that CI environment. Local blame confirms the undocumented seam at scripts/test-web-audioworklet.mjs:221 was introduced by #393 commit beeb8557a; the telemetry assertion at line 1502 predates #393/#405 in 1f8d3f0df (#137). Its real-clock zero-miss assumption is consistent with scheduling sensitivity, not established Node-version causality. Root will brief a separate bounded harness/vocabulary correction. Previously recorded #393 product review PASS does not make the combined PR mergeable while required CI is failing.

The next #405 attempt should remain this bounded authority move: fix lifecycle/type defects and complete the already-frozen proof/provenance, without progressive playback, boot defaults, adapter edits, generated artifact changes, or unrelated CI repair.

@tamashi095

Copy link
Copy Markdown
Contributor Author

Issue #409 attempt 1 — dedicated Astra review: PASS

Reviewed 04bbf4e5eccbc2c141ed7ead44629edfd0aefde3 against brief baseline f1bb9dd5 in /private/tmp/miso-dx-ci. No blocking findings. This verdict covers the independent tooling correction, not a fourth attempt or new product qualification for closed #393.

The diff contains exactly the three allowed paths: issue #409, the environment vocabulary, and scripts/test-web-audioworklet.mjs. No host, worklet, SDK, generated artifact, workflow, checker or Rust source changed; git diff --check passes and the worktree is clean.

The existing private safe-integer selector is documented without aliases or exemptions. The deterministic fixture installs globalThis.performance before normal makeProcessor() construction, allowing the unchanged renderClock() selection and reported resolution to use that clock naturally. Two fresh processors each render exactly 128 blocks: 0.5 ms per block produces exactly zero misses; replacing block 64 with 2 ms produces exactly one miss against the unchanged 64-frame/48-kHz budget. The fixture retains frame count, sequence, budget, resolution, and below-resolution assertions, strengthens finite/nonnegative CPU-field checks, asserts 256 reads, and verifies no reads or posts after release. Descriptor restoration is in finally.

Independent evidence on Node v22.23.2:

  • Focused hermetic suite passed once; an enclosing assertion verified the original global performance descriptor was restored.
  • Temporary worklet mutations using the existing module override were rejected at the telemetry fixture: force misses to zero (0 !== 1); count every block (128 !== 0); read the clock after release (fixture exhaustion at the released-process loop). Logs: /private/tmp/dx-409-astra-{clamp-misses-zero,count-every-block,read-after-release}.log.
  • The exact helper source, evaluated in isolated VM contexts, restored data-property, getter-property, and absent-property states after an intentional callback exception.
  • check-env-vocabulary.sh passed with 99 names; unchanged test-env-vocabulary.sh mutation tests passed.
  • Full unchanged test-web-audioworklet.sh passed, including transformed safe-integer exhaustion and unchecked-increment red mutation. Node 22.23.2 and GNU sed were selected in PATH. Log: /private/tmp/dx-409-astra-wrapper-unsandboxed.log. The first sandboxed wrapper invocation stopped only at the WebDriver fixture's forbidden loopback bind; an approved execution outside the sandbox passed. This was an execution-permission correction, not a timing retry.

These are the proportional failing qualification steps (environment vocabulary and hermetic browser wrapper); no unrelated broad Rust/build matrix was rerun. The prior real-clock zero-miss assertion was scheduler-sensitive. The exact one-miss mutation discriminator preserves the behavioral claim without alleging a Node engine bug.

Root retains integration, required remote qualification, evidence synchronization, and issue closure ownership. No source edits, commits, pushes, or merges were made by this reviewer.

@tamashi095

Copy link
Copy Markdown
Contributor Author

Issue #405 — Astra attempt 2 review: FAIL

Reviewed clean pushed c3c2c972, exact attempt-2 diff dd34233b..c3c2c972, against the original contract and frozen attempt-2 brief. This is one adversarial verdict for attempt 2. No repository edits, legacy-engine inspection, generated-artifact rebuild or repin occurred.

The two attempt-1 product defects are corrected: independent blocked-ready and real-DOM reproductions now pass. The production cleanup and copied prelude also pass independent adversarial execution. Remaining blockers are specific missing or ineffective regressions expressly required by the frozen brief, not newly requested architecture or qualification scope.

Blocking findings

  1. P2 — the committed allocation gate does not cover later populated drains. sdk/test/browser-pcm-evals.mjs:237 checks run.allocations immediately after the first populated process and an empty process. The subsequent submit/backpressure/seek paths at lines 239–245 execute with tracking armed but never check the resulting events. A reviewer mutation inserting if (control[CONTROL_WROTE] > 1) new Float32Array(4) before const staging = this.sourcePcm passes all four committed PCM tests. This is a real allocation on the later populated drain, precisely the frozen steady-drain requirement. Check the tracker after the complete first/steady/partial scenario and arm it only around processing; retain the existing unconditional-allocation red discriminator. The prelude's behavioral fixture should also assert captured generation/start/seek arguments, successful later submission and absence of submission for the stale slot, rather than infer these only from occupancy/counters. No prelude production change is warranted.

  2. P2 — full-ring retention is not proved, and several frozen ring-boundary cases remain absent. sdk/test/browser-pcm-evals.mjs:80 snapshots headers before overflow but not queued PCM or the write index. A reviewer mutation that zeroes the first queued PCM plane when a full-ring reserve() returns null passes all four committed tests. Snapshot and compare the queued data plus write index at this boundary. Complete the small already-frozen cases in this same fixture: literal layout constants/initialized control area including the final four words; actual multibyte ID bytes rather than merely accepting their length; signed generation-tag versus full-generation publication; malformed writer-buffer magic/zero or non-power-of-two shape; and index wrap/occupancy. Current generation values 1/7/8 cannot distinguish the signed/full-generation contract; current wrap exercise only reuses a capacity-two slot. These are the existing public wire/writer contract, not corrupt-buffer fuzzing or a new matrix.

  3. P2 — lifecycle cleanup ordering and timeout proof remain weaker than the brief. The attach-failure fixture at sdk/test/browser-pcm-evals.mjs:170 disconnects without observing writer states and checks them only afterward at line 175. Moving release(rings) until after disconnect still passes all four committed tests. Capture and assert all three engaged writer states at disconnect time; count detach once and preserve the original attach failure under both cleanup exceptions. The timeout fixture at lines 143–151 never engages its ring, uses immediately resolved waits for both callers and sorts the results, so it does not prove release of an active writer, interruption of an independently blocked caller, or which caller owns readyTimeout. Use the already-frozen deterministic two-wait setup with an explicit deadline owner and a second never-resolving wait, and assert the ordered results. Add the required typed nodeCreate failure case, currently absent. The close fixture correctly exercises two blocked callers, but should bound its observation as briefed. These are focused additions to the existing lifecycle tests.

The three demonstrated escaping mutations are reproducible with /private/tmp/dx-405-astra-mutations-attempt2.mjs; their passing test logs and isolated mutated copies are under /private/tmp/dx-405-mutations-iyma5B/. They do not alter the checkout. They show why passing test counts do not yet qualify the frozen claims.

Independently verified positive evidence

  • node /private/tmp/dx-405-astra-repro.mjs: two genuinely blocked ready callers both reject closed; one detach/disconnect; engaged three-ring attach cleanup produces [0,0,0] before disconnect even when detach/disconnect throw.
  • Additional deterministic timeout reproduction: explicitly entered owner wait plus independently never-resolving second wait; advance the owner's clock and resolve only its wait. Ordered results are readyTimeout, closed within a 50 ms observation bound; an engaged writer is released, detach/disconnect each occur once, repeated close does nothing.
  • node /private/tmp/dx-405-astra-prelude.mjs: copied prelude passes odd mono/stereo rings, nonzero partial-tail PCM, submit result-6 retention/retry, seek result-6 retry, stale-drop/no-submit, underrun, attach/detach, and zero tracked typed-array/subview allocations over the full first/steady scenario.
  • bash scripts/check-sdk-types.sh: PASS; /private/tmp/dx-405-astra-types-attempt2.log.
  • Strict real-DOM reviewer consumer: no diagnostics. The exact committed tarball TypeScript fixture was also rerun through public package exports against emitted declarations with an in-memory compiler-host mutation. Restoring the old source layout gives TS2739; restoring the fixed structural factory context gives TS2322. Script: /private/tmp/dx-405-astra-types-red-attempt2.mjs. No declarations were edited.
  • bash scripts/check-sdk-generated.sh: PASS; /private/tmp/dx-405-astra-generated-attempt2.log.
  • bash scripts/check-sdk-headless.sh /private/tmp/dx-393-current-artifacts: PASS, 137 pass / 1 skip / 0 fail; /private/tmp/dx-405-astra-headless-attempt2.log. The four focused PCM subtests run in that wrapper.
  • From sdk, npm run check:package -- /private/tmp/dx-393-current-artifacts: PASS; fresh tarball strict DOM and runtime PCM consumers execute, packaged asset URLs are read, and all three NOTICE lineage commits are asserted. Log: /private/tmp/dx-405-astra-package-attempt2.log.
  • All six sdk/dist/assets generated Engine artifacts are byte-identical to /private/tmp/dx-393-current-artifacts. Prelude SHA-256 remains d81c2159b6ca088df97e76f09c4803540e6451920cc3af1b091336fa1bdba58d. NOTICE preserves the relevant earlier Engine/app attribution recorded by authorized adapter 63b4ee6; no earlier implementation source was inspected.
  • git diff --check dd34233b..c3c2c972: PASS. Exact-path audit shows only the five authorized paths: issue evidence, NOTICE, feed source, PCM evals and tarball smoke. Working tree remains clean.

Delivery consequence

Attempt 2 is not PASS; adapter migration must remain paused. A third attempt can remain a bounded test correction in the existing PCM fixture, with truthful issue evidence. Preserve the working production fixes, the package/type/provenance coverage and all six generated artifact bytes. The independent PR #398 CI blockers assigned to issue #409 remain outside this verdict and must not be folded into #405. Root owns issue/PR synchronization and the next authorization under the three-attempt rule.

@tamashi095 tamashi095 changed the title feat(browser): centralize SDK control and PCM ownership feat(browser): move PCM feed ownership into the SDK Sep 5, 2026
@tamashi095
tamashi095 changed the base branch from main to codex/dx-host-control September 5, 2026 02:01
@tamashi095

Copy link
Copy Markdown
Contributor Author

Issue #405 — Astra attempt 3 review: FAIL

Reviewed clean pushed 2473cfdf9eb9f04c6de94be8aa6e8ca340a044fb, exact diff 543c3e43..2473cfdf, against the frozen final test-only brief. Only the authorized issue spec and sdk/test/browser-pcm-evals.mjs changed. No repository edits, legacy inspection, Wasm rebuild, artifact repin or #409 revision occurred.

All three previously escaping mutations now fail for the intended reasons. Two expressly frozen regression obligations remain ineffective; these are test-evidence findings, not defects discovered in the unchanged production implementation.

Blocking findings

  1. P2 — successful submit retry can silently drop the slot and still pass. At sdk/test/browser-pcm-evals.mjs:347, the successful retry checks occupancy and then repeats the identical submissions.at(-1) assertion used for the refused call. It never proves another submission occurred. An isolated mutation records a retry flag on result 6 and subsequently treats that retry as RESULT_OK without invoking miso_engine_web_v1_source_submit. All four committed tests still pass: the slot drains, but the last captured submission is still the refused attempt. This directly violates the final brief's requirement for captured successful retry evidence. A reviewer-only direct assertion that the captured call count becomes five fails with 4 !== 5 under this mutation and passes with the unchanged prelude. This is the silent-drop case the frozen retention/retry contract must discriminate.

  2. P2 — malformed non-power-of-two writer buffers are not tested. At sdk/test/browser-pcm-evals.mjs:140, the non-power-of-two case invokes createMsb1Ring; the malformed-buffer constructor cases above it cover magic/version and zero shape only. Replacing the writer binder's !power(capacity) with !positive(capacity) still passes all four tests. Independently, a capacity-four buffer with its capacity control word changed to three is rejected by the unchanged writer and accepted by the mutant. The final brief explicitly requires the existing malformed writer-buffer zero/non-power-of-two refusal, so the creator's assertion does not cover this boundary. No new validation semantics or fuzzing is needed to describe this missing evidence.

Isolated mutated source/test copies and logs: /private/tmp/dx-405-final-boundaries-1DjM6m/. Reproduce the escapes with node --test on retry-drop-escapes.mjs and writer-nonpower-escapes.mjs. retry-drop-direct-proof.mjs fails the direct call-count assertion; retry-original-direct-proof.mjs passes it. None imports or edits legacy source.

Independently verified positive evidence

  • Focused PCM suite: 4 pass / 0 fail; /private/tmp/dx-405-astra-focused-attempt3.log.
  • Exact /private/tmp/dx-405-astra-mutations-attempt2.mjs rerun: all three mutants exit 1. Later populated-drain allocation fails the final empty-tracker assertion with four Float32Array events; full-ring corruption fails the queued-PCM snapshot; release-after-disconnect fails with observed [1,1,1] against [0,0,0]. Logs: /private/tmp/dx-405-mutations-ohV7d4/.
  • Deterministic timeout fixture now enters the deadline owner's controlled wait and its peer's never-resolving wait, engages the writer, and asserts ordered readyTimeout/closed results with bounded observation and idempotent cleanup. Blocked close is bounded; typed nodeCreate and disconnect-time three-ring release under both cleanup exceptions are covered.
  • Literal initialized controls, full-ring headers/PCM/write-index retention, multibyte ID decoding, distinct full generations, explicit index wrap, captured seek retry and stale-slot no-submit assertions are present. Allocation tracking is checked after the full scenario.
  • Fresh existing package gate: PASS, including strict DOM and runtime PCM tarball consumers; /private/tmp/dx-405-astra-package-attempt3.log. Previously reviewed production, package and provenance fixes remain unchanged. Luna's full headless result remains 137 pass / 1 skip; I did not repeat that broader unchanged gate.
  • git diff --check 543c3e43..2473cfdf: PASS. Working tree remains clean and the exact-path audit contains only the two authorized paths.

Delivery consequence

This is the third final attempt: stop and preserve the evidence under the three-attempt rule. Do not perform another revision under this attempt, close #405 as PASS, or start the dependent adapter migration. Root owns the required rescope/rebrief and GitHub synchronization. The unchanged product corrections and independent #409 PASS are not invalidated by these two remaining regression gaps.

@tamashi095
tamashi095 marked this pull request as draft September 5, 2026 02:02
@tamashi095

Copy link
Copy Markdown
Contributor Author

Issue #405 renewed completion — independent Astra review: PASS

Reviewed clean pushed 783b4266931bc73c243a04efe67b54e237949de9 against the renewed user-confirmed boundary. The renewal preserves the historical FAIL records and authorizes completing their two remaining test discriminators. No blocking finding remains for the frozen SDK PCM authority contract.

The exact renewed implementation diff b6fc913c..783b4266 contains only five focused test lines and eighteen issue-record lines. The new submit-call counts prove an actual second invocation after backpressure, followed by exact retained-slot metadata/PCM assertions. A separately supplied malformed capacity-four buffer changed to capacity three proves writer constructor refusal directly. These address the two prior escaping defects without new validation semantics or production changes.

Independent verification:

  • Focused PCM suite: 4 pass / 0 fail.
  • Exact three earlier reviewer mutations rerun against current tests: all exit 1 at the intended allocation tracker, queued PCM snapshot and disconnect-time writer-state assertions. Logs: /private/tmp/dx-405-mutations-CFU6OX/.
  • Reviewer retry-drop and malformed-writer sources rerun through current renewed test copies in /private/tmp/dx-405-final-boundaries-1DjM6m/: retry fails with 4 !== 5; malformed writer fails with Missing expected exception. Both failures occur at the new discriminators, not setup failures.
  • Fresh package gate: PASS, including packed strict DOM and runtime consumers. Log: /private/tmp/dx-405-astra-medium-package.log.
  • Independently compared all six staged generated artifacts to /private/tmp/dx-393-current-artifacts: byte-identical. Prelude source and staged bytes agree; SHA-256 remains d81c2159b6ca088df97e76f09c4803540e6451920cc3af1b091336fa1bdba58d. Staged NOTICE equals repository NOTICE.
  • Reviewed existing renewed type/generated PASS logs and headless evidence (137 pass / 1 platform skip / 0 fail); no need to repeat the unchanged broad suite.
  • Existing focused fixtures and previously independent review cover the remaining frozen layout, full-ring retention, generation/seek/stale-slot, allocation, bounded readiness, timeout ownership and cleanup contract. Production, package and generated asset paths remain unchanged since the preceding review; intervening isolation changes only issue records.
  • git diff --check b6fc913c..HEAD passes; HEAD equals upstream and worktree is clean.

No repository source edits, legacy inspection, Wasm rebuild, artifact repin, merge or publication occurred. This PASS qualifies the SDK boundary and permits its dependent adapter work. It does not establish registry publication or actual misofm/app integration; those remain downstream deliverables. Root owns evidence synchronization and remote issue closure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant