← Back to Pull requests

feat(creator): re-land COUNT-IN with the click loop armed at the planned S #2479

Closed
unknown closed this pull request without merging on Oct 23, 2026 08:15 UTC
View on GitHub
unknown unknown commented on Oct 23, 2026 06:21 UTC
Author

Summary

Item 13 of the "Next" plan in #2422: repair the beat-1 defect of #2394 before COUNT-IN re-lands. The Owner chose on 2026-10-23 to re-land COUNT-IN together with the fix (option A).

COUNT-IN (#2359) was withdrawn from the 2.0 candidate by #2396 because of two latency defects. #2395 (post-Record-off publication blocking the Control worker) was fixed separately by #2466/#2467. #2394 is fixed here: the JS metronome started its click loop only after a polled pattern.transport.inspect reported playing, so a Control-worker stall right after S lost beat 1.

Change

  • Reverts #2396 on current main, restoring the count-in controller, readout, Sequence SETUP choice, Record/Play-Stop cancellation, docs and the unit and Playwright proofs. Conflicts with later main were resolved by keeping main's structure: the count-in joins sequenceWorkspaceLocked, so settings and Pattern selection lock together; main's output meter test, Perform keyboard test and docs rows (A→B→A recording switch, SEQ SNAP) stay beside the restored count-in ones; perform_surface.tsx keeps main's version, which already has the prop the revert would have duplicated.

  • countInMetronomeArm (apps/creator-web/src/runtime/count_in_controller.ts): while a count-in has a planned S and is neither refused nor cancelled, the metronome effect is armed at S without waiting for any poll. Native keeps beat 0 at S (the downbeat JS never replays); JS schedules beat 1 at S + one beat on the AudioContext clock. An Applied start keeps the same origin and downbeat, so the armed loop is not rebuilt at S. A refusal or cancellation disarms it, which cancels every unsounded click.

  • The browser assertion JS begins at beat 1 and never duplicates native S (creator_web_metronome.spec.mjs) is restored unchanged. The global COUNT-IN journey reaches Slice through the shared openCreatorSlice helper, because #2462 moved Slice onto the Sample page's Pad layer.

  • apps/docs-site/docs/hosts/creator-web.mdx documents the pre-arm.
  • Residual risk, stated in the code comment and docs: only an Applied receipt proves the start. A refusal observed later than S + one beat minus the 120 ms lookahead cannot recall an already scheduled beat 1.

    Related Issue

    Related issue: #2422
    Relates to #2394 (closes once a complete candidate-host batch is green, under the feature admission rule of #2476).

    Premise refresh (issue-done §0)

    Base: origin/main at 5e6c95bf7 (after #2476). #2394 is open with no branch or PR; #2395 is closed by #2466/#2467; #2396 removed every count-in entry point from main, so the fix could only land with the feature. The Owner decided the scope on 2026-10-23.

    Verification

  • apps/creator-web/test/count_in_metronome_arm.test.ts was written first and failed on the re-land (countInMetronomeArm is not a function). After the change it passes. Mutation (the arm always null): two of its three tests fail; restored: OK.

  • Creator unit suite: 87 files, 2026 tests pass on 2366821; tsc --noEmit clean; the arm, controller and workspace suites (250 tests) rerun on 11a968f after the disarm change.

  • scripts/docs-site.sh check: 51 routes and internal links valid (132 s).

  • Complete creator lane run locally (on edc1e8b; the later disarm change only stops scheduling clicks during a requested cancellation and is covered by the unit tests) with scripts/local-ci.sh --profile full --lanes creator on the M1 at edc1e8b2fd37934e158554e3d6bb5c23724fcc75:

  • - All restored COUNT-IN UI and metronome journeys pass, including the JS begins at beat 1 and never duplicates native S case and the global COUNT-IN journey on every page.
    - The lane still fails on 10 journeys that already fail on main, in the main batch executor run 39884244371 at 86ad15ed2 on netcup, with the same errors: six packaged native count-in journeys in creator_web_count_in.spec.mjs (HostProtocolError: Host request was rejected; that spec stayed on main through #2396 and is not changed here beyond the one line the revert restores), two creator_web_recording_switch.spec.mjs A-B-A journeys, the Sequence creator_web_touch_fit row-fit journey and the Sound Set colour journey. They are pre-existing main defects outside this Task and are reported separately, not hidden: no assertion, timeout or lane selection changed.
    - The first local run also showed the global COUNT-IN journey timing out on the old Slice click; that is fixed in edc1e8b and passes in the rerun.

    PR Review

    Head SHA: 2366821e61bd0b20e470af012ae7741193576ae8. Review of edc1e8b raised four findings on the re-landed controller: the requested-cancellation window let the new pre-armed metronome stay armed (fixed in 11a968f: the arm drops on cancelling/settling, unit-tested and mutation-proven); controller disposal on Session replacement, a refused metronome write and a pre-admission cancel were answered as the deliberate fail-closed behaviour of #2359, each with the test that pins it. Review of 11a968f raised six more: a refusal that stayed on screen after choosing Off (fixed in 2366821, refusal tests extended and mutation-proven); the retained downbeat filter, the epoch fallback, Record-cancels-only, the retained unknown caller and the 48 kHz readout basis were answered with the engine-frame and fail-closed reasons and the tests that pin them. All threads resolved. Current-head review evidence is checked with scripts/ci/review_wait.py before merge; findings and dispositions are recorded in the thread.

    CI Scope

    Expected mode: focused
    Expected selected lanes: creator portal
    Expected skipped lanes: ci_contract core_asan core_coverage core_macos core_ubuntu deploy_contract docs_static package web_runtime_host web_runtime_lab web_toolchain
    ci:full required: no
    Reason: Creator source, its tests and Playwright journeys, and one Host docs page.

    Batch-only Lanes

    creator: run locally as described in Verification. All COUNT-IN and metronome journeys pass; the 10 failures listed there also fail on main's batch run 39884244371 and are not introduced here. Under the feature admission rule (#2476), COUNT-IN is in release scope only after two consecutive green automatic main batches on the candidate hosts.

    Version Management

    Version impact: none
    Reason: Creator Host source; no Product Build allocation, Module, Contract or Provider version change.

    Documentation Impact

    Documentation impact: required
    Affected portal pages: /hosts/creator-web /hosts/creator-interactions /platform/input
    Reason: the restored COUNT-IN behaviour and the click-loop pre-arm are documented on these pages.

    Pitfall Impact

    Pitfall impact: none — reason: the defect is fixed in code with a gate (gate:apps/creator-web/test/count_in_metronome_arm.test.ts and the restored browser assertion); the cut-day merge that let it reach a candidate is covered by the feature admission rule (#2476).

    Merge Danger

    Door: two-way
    Blast Radius: Creator Record with COUNT-IN set to 1 or 2 bars (default Off) and the metronome while counting in; ordinary Record and playback paths are unchanged.

    Release Impact

    Release impact: none
    Candidate tag: none
    Profile: none
    Channel: none
    Intent disposition: none
    Release assets: none
    Release gates: none
    Reason: no release is active; COUNT-IN enters a cut only after two green main batches on the candidate hosts.

    Transition authority

    Authorized transitions: push | PR | merge (standing Task authorization in CLAUDE.md`; cleanup not requested)
    No tag, Release, deploy, publication, or Channel promotion is implied.

    🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: endaye Review duration: 113m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2479"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository