Skip to content

refactor: dissolve caller-side src/replay into command and CLI owners - #2151

Open
thymikee wants to merge 3 commits into
mainfrom
refactor/dissolve-caller-side-replay-2127
Open

refactor: dissolve caller-side src/replay into command and CLI owners#2151
thymikee wants to merge 3 commits into
mainfrom
refactor/dissolve-caller-side-replay-2127

Conversation

@thymikee

@thymikee thymikee commented Aug 28, 2026

Copy link
Copy Markdown
Member

Closes #2127

Summary

  • Deleted caller-side src/replay; source acquisition now belongs to src/commands/replay, replay-test presentation to src/cli/replay-test, and the bundled-file reader to a daemon-local adapter.
  • Preserved source ordering, env expansion, exact errors/reports, 2 MiB cap, Node/MCP command routes, and flow-only lazy Maestro loading.
  • Added the R71 no-regrowth rule and flow-specific eager-closure guard, with observed planted-red proofs.
  • Rebased onto current main at ed26b31c94; resolved the genuine shared-tooling conflict in scripts/layering/check.ts by retaining retired-platforms-zone and adding replay-ownership.
  • Removed the PR-owned test-only readAdScriptSourceBundle export after the post-rebase production-export audit; the production loader remains Promise-only, while the synchronous native one-entry fixture is test support only.
  • Touched diff entries: 54 (24 detected renames, 20 pure moves; 78 old/new path endpoints without rename detection).
  • Gross rename-aware diff: +233/-233 lines; endpoint churn without rename detection: +4,341/-4,341.
  • Move-adjusted production LOC: -58 lines (tracked production TypeScript in src/** and packages/*/src/**, tests excluded).

Validation

  • pnpm install --frozen-lockfile — pass on the fresh worktree.
  • Focused replay/CLI/startup/client/MCP suite — 13 files, 109 tests passed.
  • pnpm check:quick — pass.
  • pnpm format:check — pass.
  • pnpm build — pass.
  • pnpm check:layering — 163 structural tests passed; live guard passed.
  • pnpm check:affected --run — pass; all runnable checks passed (full fail-open selection, 517 related test files / 4,359 tests; integration-node 90 passed / 9 expected skips; GitHub-authoritative lanes skipped by declaration).
  • Post-rebase production-export audit — no PR-owned unused export remains; 27 unrelated current-main findings remain outside this change.
  • Static Maestro plant failed the startup guards with the named commands/replay/script-source-bundle.ts path; removed afterward.
  • R71 production-file plant failed by name with [R71 replay-ownership]; removed afterward.
  • git ls-files 'src/replay/**' — empty.
  • git diff --check origin/main...HEAD — pass.

Residual risks

  • Native/device/provider/live-web proof remains GitHub-authoritative; the PR is not being merged.
  • Exact-head iOS Smoke Tests have exposed native runner instability on two runs: the old caaf758867 head failed live simulator form input with TEXT_INPUT_COMMIT_NOT_OBSERVED, and 129c387c1d timed out opening gesture-pan-duration.ad while rebuilding the xctestrun cache for 49.9 seconds and never reaching runner readiness. The corresponding main workflow passed the replay in 39 seconds, so no timeout or replay behavior was changed; the failure remains a GitHub-authoritative native/device risk.

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 2.53 MB 2.53 MB -101 B
JS gzip 847.4 kB 847.3 kB -61 B
npm tarball 973.6 kB 973.7 kB +135 B
npm unpacked 3.36 MB 3.36 MB -101 B

npm unpacked components

Component Base Current Diff
JS / dist source 2.68 MB 2.68 MB -101 B
Apple runner source/project 581.1 kB 581.1 kB 0 B
macOS helper source 54.8 kB 54.8 kB 0 B
Android helper artifacts 0 B 0 B 0 B
Other package files 45.6 kB 45.6 kB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.8 ms 28.2 ms +0.4 ms
CLI --help 78.9 ms 78.6 ms -0.3 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/registry.js +1.0 kB +410 B
dist/src/perf-runtime-plan.js +423 B +168 B
dist/src/internal/daemon.js +7 B +12 B
dist/src/session2.js -5 B +1 B

Top changed packed files

Packed file Base Current Diff
dist/src/script-source-bundle.js 8.8 kB 0 B -8.8 kB
dist/src/doctor-output.js 0 B 7.2 kB +7.2 kB
dist/src/registry.js 156.0 kB 157.1 kB +1.0 kB
dist/src/perf-runtime-plan.js 64.3 kB 64.8 kB +423 B
dist/src/agent-device-client.js 18.5 kB 18.5 kB -7 B
dist/src/command-tools.js 21.6 kB 21.6 kB -7 B
dist/src/internal/daemon.js 111.2 kB 111.2 kB +7 B
dist/src/session2.js 216.4 kB 216.4 kB -5 B

@thymikee

Copy link
Copy Markdown
Member Author

Independent review found no blocker on exact head b330aca2fbf2ca209ac2d144b2d588c9448eb916. #2151 cleanly closes #2127: caller-owned replay acquisition and CLI-only presentation moved to their existing owners; the daemon retains only a neutral bundled-source reader and sole replay-coordinator construction. There are no compatibility shims or stale src/replay/** source paths, R71 is live and planted-red, and moved tests preserve source ordering, environment-expanded Maestro closure, byte/error behavior, remote-host independence, and reporter output. The gross diff is move-dominated and Size CI is slightly net-negative. Exact-head CI is fully green; ready for human review.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Aug 28, 2026
@thymikee
thymikee force-pushed the refactor/dissolve-caller-side-replay-2127 branch from b330aca to caaf758 Compare August 29, 2026 12:00
@thymikee

Copy link
Copy Markdown
Member Author

Re-review of exact head caaf7588675504685163a10051a8228a0234cb98 found one P2 design regression in the post-rebase fix. Removing readAdScriptSourceBundle changed the shipping loadReplayScriptSourceBundle interface from always-Promise<ReplayScriptSourceBundle> to ReplayScriptSourceBundle | Promise<ReplayScriptSourceBundle>, plus a try/catch -> Promise.reject bridge and a format-dependent instanceof Promise branch in test code. Current production callers all await it, so this does not presently break replay, but execution timing is now a caller-visible input-format detail solely to preserve synchronous fixture convenience. Keep the production loader Promise-only; build the native synchronous fixture inside test support (loader-specific tests already cover production acquisition), without adding a test-only production export. The rebase itself is sound: it retains current main's retired-platforms-zone and R71, the ownership move remains clean, and Size is net-negative. Do not treat this head as ready until the interface regression is removed and the still-running exact-head CI completes.

@thymikee thymikee removed the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Aug 29, 2026
@thymikee

Copy link
Copy Markdown
Member Author

Addressed review 5462317845 in 129c387: the production replay source loader is Promise-only again, the native one-entry bundle is constructed only in test support, and no test-only production export was restored. Focused replay coverage (13 files, 109 tests), check:quick, and the full affected gate pass. The prior Smoke Tests failure was on the old caaf758 head at live iOS form input; the new exact-head lanes are running.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Aug 29, 2026
@thymikee

Copy link
Copy Markdown
Member Author

Re-review of exact head 129c387c1d1b33d49f509aa9343f0bdd23171d44 confirms the P2 is resolved. loadReplayScriptSourceBundle is Promise-only again; the union return, Promise.reject bridge, and format-dependent instanceof Promise branch are gone. The synchronous native one-entry fixture now lives only in test support, without restoring a test-only production export, while production acquisition retains its command-owner coverage for caller-CWD resolution, Maestro closure, exact errors, and the 2 MiB cap. No compatibility or routing regression found; Size is further reduced. All current exact-head checks are green, with only iOS Smoke still running. Code review is clean and the readiness label may be restored while that lane completes.

@thymikee

Copy link
Copy Markdown
Member Author

The remaining red check is native runner instability, not a replay regression: run 33253374301 timed out in open before the replay action, after a 49.9s xctestrun cache rebuild caused by cache_metadata_mismatch; readiness retries then exhausted at the 60s cooperative timeout. The corresponding main run 33249518974 passed gesture-pan-duration.ad in 39s. I left timeout and replay behavior unchanged and recorded this residual risk in the PR body.

@thymikee

Copy link
Copy Markdown
Member Author

Independent CI evidence check confirms the sole red iOS Smoke job is runner/cache infrastructure noise, not a replay-path regression. The artifact request log shows the test failed during step-1 open, before any replay action: runner_xctestrun_cache rebuilt for cache_metadata_mismatch, ios_runner_startup_ensure_xctestrun consumed 49,931 ms, and runner-connect readiness then ran out the enclosing 60 s cooperative budget. All other exact-head checks are green, and this PR does not change Apple runner/cache/startup code. No owner code action is indicated; ready-for-human remains appropriate with this residual flake recorded.

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

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: dissolve caller-side src/replay into command and CLI owners

1 participant