Skip to content

refactor(scripts): single harness-identity owner for harness vocabulary - #46

Merged
myagentdojo merged 8 commits into
mainfrom
refactor/harness-identity
Aug 14, 2026
Merged

refactor(scripts): single harness-identity owner for harness vocabulary#46
myagentdojo merged 8 commits into
mainfrom
refactor/harness-identity

Conversation

@myagentdojo

@myagentdojo myagentdojo commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

Harness knowledge in this repo was re-derived at roughly 70 sites across 12 script files, in three competing vocabularies — lowercase IDs, capitalized display names, and -cli qualification clients — with the same hooks-path pair written four independent times. Any change to a harness path or name meant finding every copy. Now one leaf module, scripts/harness-identity.ts, owns the vocabulary: canonical lowercase HarnessId, per-harness hooks/manifest paths, the plugin-root env vars (including the deliberate asymmetry — CLAUDE_PLUGIN_ROOT vs plain PLUGIN_ROOT), display names, and the qualification-client mapping. Every TypeScript branch site reads it; no script defines its own harness union, path template, or display mapping any more (verified by an orphan-union sweep).

The migration is behavior-preserving by construction and by proof: generated plugin/ output is byte-identical (generate:check clean), every asserted error message and persisted JSON shape is unchanged, and deliberate mutation checks were run — altering a registry value made generation checks and all four hooks-path assertion surfaces fail, then the module was restored byte-identically with a SHA-256 proof.

Two surfaces can never import TypeScript: the POSIX shell hook and the CI workflows. Instead of generating them, validation-only parity tests pin them — the hook's SessionStart:/Stop: case arms must cover exactly the module's harness IDs, and the bun add --global CLI-install line must be byte-identical across plugin-ci.yml, hosted-canary.yml, and release.yml (version-agnostic, so routine bumps of all three together pass). Sensitivity was proven in both directions for both tests.

The Claude install driver, previously inlined in prove-harness-install.ts, now sits behind ClaudeDriverDependencies in scripts/harness-install-claude.ts — the same DI pattern as CodexDriverDependencies but a Claude-shaped surface (three-scope loop), serving both the local and hosted proof callers; the 12-export test surface is stable.

This is PR 2 of 2 from the plan (stacked on the release-validation PR, its base branch); ADR 0009 and a CONTEXT.md glossary entry record the vocabulary decision, with doc-targets.yml rows binding both docs to the module.

Session-settled decisions carried from planning: lowercase canonical harness IDs (user-directed, over the -cli and capitalized vocabularies); two explicit per-harness records, never derivation templates (user-directed); validation-only parity for non-TypeScript surfaces (user-directed, over code generation); Claude-specific DI interface (user-directed, over leaving the driver inlined); persisted proof/receipt contracts frozen (user-directed).

Testing

  • New scripts/harness-identity.test.ts pins the registry with golden values, including the env-var asymmetry, and asserts the client-to-harness mapping exhaustively in both directions.
  • New parity tests: hook case-arm coverage and three-workflow pin-line identity, with add/remove/rename and single-file-drift mutations all observed failing.
  • Full suite 675 tests / 0 fail; generate:check clean; release:validate exit 0; prove:all green at head.
  • Reviewed by a multi-reviewer pass plus an independent cross-model adversarial review; two validated findings applied on this branch (recovery-test literals canonicalized so the casing-launder shim could be removed; journey client type narrowed to exclude codex-desktop, matching ADR 0009's frozen CLI vocabulary). One cross-model finding was rejected at validation — the pin-parity extractor already fails closed on anything but exactly one match — and is recorded as a hardening note.
  • Known limitations: the repo has no tsc gate, so type-level guarantees rest on the suite; the extracted Claude driver runs natively only when a Claude CLI is present (fixture fallback otherwise); binding the pin-parity match to the named install step is deferred hardening.

Post-Deploy Monitoring & Validation

Repo-internal refactor of authoring/proof scripts; the generated plugin/ payload is byte-identical (payloadHash unchanged 0070438f...), so there is no production/runtime impact beyond CI.

  • Healthy signal: plugin-ci and hosted-canary green; generate:check clean in CI.
  • Failure signal: generated-output drift or a proof script failing on an unchanged surface — mitigation: revert this PR.
  • Validation window: first CI run after merge. Owner: repo maintainer.

Compound Engineering

Summary by CodeRabbit

  • New Features

    • Added standardized identity and configuration coverage for Claude and Codex, including installation paths, hooks, environment settings, and display names.
    • Added native Claude installation verification across supported scopes, including upgrades, rollbacks, persistence, and recovery.
    • Added support for mapping CLI and desktop qualification flows to their corresponding harnesses.
  • Documentation

    • Documented canonical harness terminology and configuration decisions.
  • Tests

    • Expanded validation for lifecycle hooks, recovery, workflow version parity, and harness identity consistency.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 34609160-924d-4909-b0f3-ed5520c3d200

📥 Commits

Reviewing files that changed from the base of the PR and between 521644e and 0aa1006.

📒 Files selected for processing (20)
  • CONTEXT.md
  • docs/adr/0009-canonical-harness-identity.md
  • docs/agents/doc-targets.yml
  • scripts/build.ts
  • scripts/codex-production-update.ts
  • scripts/dev.ts
  • scripts/harness-identity.test.ts
  • scripts/harness-identity.ts
  • scripts/harness-install-claude.ts
  • scripts/harness-install-codex.ts
  • scripts/harness-install-recovery.test.ts
  • scripts/harness-install-recovery.ts
  • scripts/native-capability-hook.test.ts
  • scripts/plugin-config.ts
  • scripts/prove-distribution.ts
  • scripts/prove-dx.ts
  • scripts/prove-harness-install.ts
  • scripts/release-validate.ts
  • scripts/update.ts
  • scripts/workflow-pin-parity.test.ts

📝 Walkthrough

Walkthrough

The change defines canonical Claude and Codex harness identities, maps qualification clients to those identities, and applies the shared metadata across plugin configuration, build validation, installation proofs, recovery, runtime scripts, documentation, and tests.

Changes

Canonical harness identity

Layer / File(s) Summary
Identity contract and vocabulary
CONTEXT.md, docs/adr/..., docs/agents/doc-targets.yml, scripts/harness-identity.ts, scripts/harness-identity.test.ts
Defines canonical harness metadata, qualification-client mappings, terminology, documentation targets, and exact-coverage tests.
Identity-driven configuration and validation
scripts/plugin-config.ts, scripts/build.ts, scripts/prove-dx.ts, scripts/release-validate.ts, scripts/native-capability-hook.test.ts
Derives manifest and hook paths from shared identities and validates lifecycle-hook parity.
Claude native proof extraction
scripts/harness-install-claude.ts, scripts/prove-harness-install.ts
Moves Claude native installation proof logic behind injected dependencies and wires installation, mutation, recovery, and proof aggregation.
Shared identity runtime propagation
scripts/dev.ts, scripts/codex-production-update.ts, scripts/harness-install-codex.ts, scripts/harness-install-recovery.ts, scripts/prove-distribution.ts, scripts/update.ts, scripts/prove-harness-install.ts, scripts/harness-install-recovery.test.ts
Replaces local harness literals with shared HarnessId and qualification-client mappings across runtime flows and recovery validation.
Workflow pin parity validation
scripts/workflow-pin-parity.test.ts
Checks that native CLI pins remain unique and byte-identical across the configured workflows.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 0aa10

This refactor centralizes harness metadata without changing generated output or persisted behavior; normal checks are passing, and no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant proveHarnessInstall
  participant HarnessIdentity
  participant NativeProof
  participant Recovery
  CLI->>proveHarnessInstall: request harness proof
  proveHarnessInstall->>HarnessIdentity: resolve harness metadata
  proveHarnessInstall->>NativeProof: run harness-specific proof
  NativeProof->>Recovery: validate post-mutation recovery
  Recovery-->>NativeProof: recovery result
  NativeProof-->>proveHarnessInstall: proof metadata
Loading

Possibly related PRs

Suggested reviewers: nathanvale

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.63% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: centralizing harness vocabulary under a single harness-identity owner.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/harness-identity

Comment @coderabbitai help to get the list of available commands.

@myagentdojo
myagentdojo deployed to hosted-canary-qualification August 14, 2026 04:42 — with GitHub Actions Active
Base automatically changed from refactor/parsed-release-validation to main August 14, 2026 07:12
@myagentdojo
myagentdojo force-pushed the refactor/harness-identity branch from 7fddff6 to 0aa1006 Compare August 14, 2026 07:12
@myagentdojo
myagentdojo deployed to hosted-canary-qualification August 14, 2026 07:12 — with GitHub Actions Active
@myagentdojo
myagentdojo merged commit 2f55212 into main Aug 14, 2026
20 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

Development

Successfully merging this pull request may close these issues.

2 participants