Skip to content

refactor(layout): move the harnesses context into src/main (#1357 step 10) - #1366

Open
devsuitup wants to merge 4 commits into
mainfrom
refactor/1357-harnesses
Open

devsuitup wants to merge 4 commits into
mainfrom
refactor/1357-harnesses

Conversation

@devsuitup

@devsuitup devsuitup commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Board card: #1357

Step 10 of ADR 0005: move the harnesses context (the CLI harness contract and its adapters) into src/main/harnesses/. Paths only, no behaviour change. Merge with a merge commit so the pure-move commit stays in history.

Moved files

  • harnesses/claude.js -> src/main/harnesses/claude.js
  • harnesses/codex.js -> src/main/harnesses/codex.js
  • harnesses/contract.js -> src/main/harnesses/contract.js
  • harnesses/index.js -> src/main/harnesses/index.js

The ADR's harnesses/claude/ subdirectory is not created here. The Claude adapter is still one file. Claude-only root modules (claude-binary.js, claude-auth.js, bridge-session-id.js) have consumers in terminals, usage, bg-agents and session state, so they are not moved in this step.

Commits

  1. b2b2b8a2f4c1e1383c7c88b8284cbb3d6ed8944b: pure git mv, four R100 renames, 0 insertions and 0 deletions.
  2. 2f6d7f549f1859ea85dd28c35c77431a9dbff1bc: reference updates, plus the commit 1 SHA in .git-blame-ignore-revs.
  3. 06ffcbc4: merge of origin/main after (docs): tie each doc to the code it covers and require it in PRs that change that code (#1353) #1364; its covers: paths moved to src/main/harnesses/ (.ai/contexts/cli-harnesses.md, docs/launching-sessions.md) and harnesses/ dropped from the app-path lists in docs/changelog.md. After the merge: check-docs 99/99, check-doc-refs 16/16, module-layout 7/7, move-modules 59/59, harness-contract 10/10, check-changelog 21/21; check-docs.js --validate and check-doc-refs.js pass.

References updated

  • Requires: the codemod (scripts/move-modules.js) rewrote every file specifier. It does not map directory-index specifiers, so I rewrote require('./harnesses') and its ../ and ../../ forms by hand in main.js, session-cache.js, session-index-commands.js, session-transitions.js, src/main/session-index/full-read-state.js, workers/scan-projects.js, workers/session-index-writer.js, test/fixtures/trigger-main-open.cjs and 20 test files.
  • Path configuration: dropped harnesses/** from package.json build.files (covered by src/**/*). Dropped harnesses/**/*.js from the ESLint main-process block (covered by src/main/**/*.js). Dropped the harnesses walk root from scripts/module-paths.js and the harnesses/ prefix from scripts/check-changelog.js isAppPath, since src/ covers both.
  • Tests: test/harness-contract.test.js now asserts that build.files ships src/**/*. In test/module-layout.test.js, the codemod had rewritten a synthetic harnesses/claude.js fixture into src/, which broke the walk(root, 'src') expectation. That test went red locally. I removed the fixture, because the walk root it exercised no longer exists.
  • Docs: .ai/contexts/{cli-harnesses,build-release,session-cache,session-index-writer,managed-browser,trigger-watcher}.md, docs/changelog.md, docs/development.md and docs/launching-sessions.md.
  • scripts/doc-refs-allow.json: removed the harnesses/claude/ entry for ADR 0005. check-doc-refs reported it as unused once the harnesses directory was gone.

Worker entry paths are unchanged: no new Worker or utilityProcess path moved. Only the requires inside workers/scan-projects.js and workers/session-index-writer.js changed. build.files did change (an entry was removed), so per ADR 0005 a packaged build needs to be checked before merge.

Verification (Node 22, local, worktree)

  • node scripts/move-modules.js --check with the source map present: exit 0 after the rewrite. The warnings left are the pre-existing excerpt and index.js segment warnings. I reviewed them and none involves the harness registry.
  • node --check on 46 changed or moved JS files: 0 failures.
  • ESLint on the same files, run from the worktree root: 0 errors, 5 warnings, all pre-existing unused vars in main.js.
  • node scripts/check-doc-refs.js: 0 failures, 0 allow-list errors.
  • git diff --check: clean.
  • task check:fast with SKIP_TESTS=1 before each commit: exit 0.
  • 25 test files, one process at a time: all pass. They were harness-contract, harness-codex, harness-activity, harness-codex-launch, harness-launch, harness-settings, harness-worktree-grouping, module-layout, move-modules, check-changelog, check-docs, codex-index, codex-launch-ownership, codex-viewer-and-guard, dom-resume-runtime, restore-fresh-runtime, delete-session-guard, open-terminal-attach, session-cache-warm-start, read-session-file-golden, search-refs-1255, isolated-codex-home, sandbox-control-launch, scheduled-run-liveness-814 and working-set-schedules-migration.

Not verified

  • These changed tests were not run locally and are left to CI: child-session-env (excluded by policy), delete-session-guard-r3, session-status-main, read-session-file-streaming-1180, plus the consumers of test/fixtures/trigger-main-open.cjs and test/fixtures/warm-start-1152.cjs.
  • Not run: the full suite, coverage, e2e and any Electron launch.
  • No packaged build.
  • Packaged build: build.files lost harnesses/** (now covered by src/**/*); to be checked on a packaged build before merge (ADR 0005).

Docs

Updated .ai/contexts/cli-harnesses.md, build-release.md, session-cache.md, session-index-writer.md, managed-browser.md, trigger-watcher.md, docs/changelog.md, docs/development.md and docs/launching-sessions.md. No user docs needed changes, because nothing users see changes.

No changelog entry: nothing users see changes (no-changelog).

  • no docs: the other app files change only their require paths to the moved modules; the contexts that name those paths are updated above.

Rewrite requires, tests, docs and path configuration for the move of
harnesses/ into src/main/harnesses. Directory-index requires of the
registry were rewritten by hand: the codemod only maps file specifiers.
The build.files, ESLint, module-paths and changelog-path entries for
harnesses/ are dropped, since src/** already covers the new location.
Record the pure-move commit in .git-blame-ignore-revs.
@devsuitup devsuitup added the no-changelog The PR changes nothing a user sees; the CHANGELOG.md check is waived label Nov 29, 2026
@devsuitup devsuitup added the no-docs PR changes code but no user or agent doc needs an update label Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog The PR changes nothing a user sees; the CHANGELOG.md check is waived no-docs PR changes code but no user or agent doc needs an update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant