From 16607d7662be482ce95b18b02e233d17e681fa30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 25 Nov 2026 11:59:11 +0100 Subject: [PATCH 1/6] docs(agents): hand worker validation to CI --- AGENTS.md | 33 ++++++++------- docs/agents/code-ownership.md | 2 +- docs/agents/device-verification.md | 5 ++- docs/agents/gates.md | 4 +- docs/agents/pull-requests.md | 32 ++++++++------- docs/agents/test-authoring.md | 13 +++--- docs/agents/testing.md | 65 +++++++++++++----------------- 7 files changed, 77 insertions(+), 77 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index a56e0a2d28..9baf8396c6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,11 +1,21 @@ # AGENTS.md -`agent-device` is a CLI and daemon that automates devices and web targets. -The daemon owns sessions. Registry declarations route commands to platform runtimes. +The daemon owns sessions. The registry routes commands to platform runtimes. + +## Worker handoff + +A worker is an agent with a delegated task. +For worker changes, CI owns validation. +Do not run local gates, check scripts, lint or typecheck sweeps, coverage, or project-wide test runs. +If you need local feedback to write a test, run only the test file you changed. +If authorized, push the change and report the head SHA with checks pending. +Do not wait for CI. +The coordinator reads CI, assigns fixes, and arranges review. ## Task routing -Read each applicable row. Follow other links only as needed. +If the task names the owning file, start there. +For each question that remains, use the matching row. | When the task involves | Read | | --- | --- | @@ -13,7 +23,7 @@ Read each applicable row. Follow other links only as needed. | Architecture decisions | `docs/adr/README.md` | | Write or amend an ADR | `docs/adr/FORMAT.md` | | Source, package boundaries, routing, diagnostics, CI | `docs/agents/code-ownership.md` | -| Checks or a failed gate | `docs/agents/testing.md` | +| A CI failure to fix or local validation for maintainers | `docs/agents/testing.md` | | New or changed tests | `docs/agents/test-authoring.md` | | Test audits or deletions | `docs/agents/test-audit.md` | | Mutation experiments or base comparisons | `docs/agents/test-experiments.md` | @@ -23,13 +33,10 @@ Read each applicable row. Follow other links only as needed. | A PR to open or update | `docs/agents/pull-requests.md` | | A change to review | `docs/agents/review.md` | | Trust boundaries, untrusted paths, security review | `docs/agents/security.md` | -| Device-facing changes or manual device verification | `docs/agents/device-verification.md` | +| Manual device verification | `docs/agents/device-verification.md` | | Issues, PRDs, or triage labels | `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md` | | Web backend setup or diagnostics | `docs/agents/web-backend.md` | -A device-facing change affects live device behavior: dispatch, capture, interaction, app lifecycle, or native execution. -A daemon edit that changes none of these needs no device run. - The versioned CLI help owns command semantics. To drive an app, start with the skill's routing card. ## Working rules @@ -45,17 +52,13 @@ The versioned CLI help owns command semantics. To drive an app, start with the s ## Worktree setup -- Use `pnpm`. Use OXC to lint and format. Run `pnpm format` on the full repository. -- In a new worktree, run `pnpm install --frozen-lockfile && pnpm build` before testing. +- Use `pnpm`. Use OXC to format the files you change. +- If a requested reproduction or a permitted test needs setup, prepare only what it needs. - Do not change other worktrees, devices, sessions, dirty files, or experiments. Do not use `git stash`; all worktrees share it. - Do not copy `.env` into a worktree. For host credentials, source the main checkout's file by absolute path. -- Give each parallel worker different files and devices. `pnpm check:affected --run`, `pnpm check`, and heavy `pnpm gate` ids share one lock. -- The layering scan reads only tracked files. Stage new modules before you trust its result. +- Give each parallel worker different files and devices. - When you rename a file, move its Fallow baseline entry. Do not regenerate unrelated baselines. -The validation lock reclaims provably dead owners. An unknown owner blocks. -If the wait times out, report the printed owner and lock state. Do not remove the lock manually. - ## Agent docs Write agent docs in ASD-STE100. Write one instruction per sentence. diff --git a/docs/agents/code-ownership.md b/docs/agents/code-ownership.md index e9b65ea372..f6b399979c 100644 --- a/docs/agents/code-ownership.md +++ b/docs/agents/code-ownership.md @@ -1,6 +1,6 @@ # Code ownership -Before you edit a module with many callers, run `pnpm depgraph affected `. +If direct callers do not show the affected boundary, use `pnpm depgraph affected ` when it is available. ## Declarations diff --git a/docs/agents/device-verification.md b/docs/agents/device-verification.md index 886cf62bad..5ad3c304df 100644 --- a/docs/agents/device-verification.md +++ b/docs/agents/device-verification.md @@ -1,6 +1,7 @@ # Verify on a device -Use this for Apple runner changes or manual device runs. For foldables, also read [foldable verification](device-foldable.md). +For a requested manual device run, use this guide. +For foldables, also read [foldable verification](device-foldable.md). ## Prepare @@ -47,7 +48,7 @@ The physical runner handoff checklist is in `docs/evidence/ios-physical-runner-h ## Platform policy -For Apple runner changes, run `pnpm check:xctest-selection` and build the affected target. +For Apple runner changes, CI runs `pnpm check:xctest-selection`. Swift `#if` guards own the XCTest classification. Do not keep a second list of test names. Use macOS host lanes for pure decisions. Use simulator lanes for iOS and XCTest semantics. If system policy rejects an unsigned host bundle, rebuild with `CODE_SIGN_IDENTITY="Apple Development"` diff --git a/docs/agents/gates.md b/docs/agents/gates.md index 15e57188db..b0efc5be5f 100644 --- a/docs/agents/gates.md +++ b/docs/agents/gates.md @@ -3,7 +3,7 @@ `CHECK_CATALOG` in `scripts/check-affected/checks.ts` owns checks and commands. CI declares ownership through the shared `run-gate` action with a literal gate id. For a new check, update the catalog and executable model. -To verify ownership and reachability, run `pnpm check:gate-manifest`. +When a maintainer verifies ownership and reachability locally, run `pnpm check:gate-manifest`. For parser and geometry changes, extend shared fast-check arbitraries and properties. Use `PROPERTY_RUNS` budgets. Keep examples for past bugs or named decisions. @@ -17,7 +17,7 @@ Dispatch with `--with-dependencies` adds `LANE_DEPENDENCIES`. Scores are advisory. Incomplete sweeps fail. Before a pilot, read `pnpm mutation:run --help`. Concurrency torture uses production lock decisions. -Run `pnpm test:concurrency-torture`. +When a maintainer runs concurrency torture locally, use `pnpm test:concurrency-torture`. To replay, use the printed `TORTURE_SEED`. Do not commit output stamped with a run or commit under `scripts/`. diff --git a/docs/agents/pull-requests.md b/docs/agents/pull-requests.md index b45736e0f5..62c3731bdd 100644 --- a/docs/agents/pull-requests.md +++ b/docs/agents/pull-requests.md @@ -1,21 +1,24 @@ # Open or update a PR -After validation, a request to open or ship a PR authorizes branch creation, commits, push, and PR creation. Merging and releasing need separate authorization. +A request to open or ship a PR authorizes branch creation, commits, push, and PR creation. +Before you merge or release, get separate authorization. ## Validate -Follow [validation](testing.md). -A serialized gate stage can validate the pushed head instead. -An authorized incomplete draft can record a blocker. A blocker is not a pass. -Push once per review round. Each push restarts CI. Drafts skip device lanes. +If you are a worker, publish the change with CI pending. +For maintainer validation, follow [validation](testing.md). +If you have authorization to open an incomplete draft, record its blocker. +For each review round, push once. +Each push restarts CI. Drafts skip device lanes. -For device-facing changes, follow [device verification](device-verification.md). -Report missing devices or commands. +If the task includes manual device verification, follow the [device guide](device-verification.md). +If a device or command blocks that run, report it. - Published: the branch is pushed, the PR is open, and validation status is recorded at a named commit. - Merge-ready: required checks pass at the head, with live evidence for device-facing changes. -Do not wait for CI merely to report publication. +A device-facing change affects live dispatch, capture, interaction, app lifecycle, or native execution. + Do not report skipped integration or coverage as passed. ## New public package @@ -25,9 +28,9 @@ First, the maintainer publishes an empty placeholder version, for example `0.0.0 Then the maintainer configures the npm trusted publisher for the release workflow. Only after these steps does the PR remove `"private": true`. -## Self-review +## Coordinator review -Give an independent reviewer the worktree, the merge-base SHA, the head SHA, and the task requirements. +Give the reviewer the worktree, merge-base SHA, head SHA, and task requirements. In the first review, do not supply an implementation summary. Review that SHA range with AGENTS.md and [review guidance](review.md). @@ -35,7 +38,6 @@ In later rounds, supply the SHA reviewed before, its findings, and their disposi Review the changes since that SHA and the interactions that they affect. After a rebase, compare the branch ranges with `git range-diff .. ..`. Fix accepted findings with the smallest change. Prefer configuration or deletion to new code. -Rerun affected checks. For rejected findings, record a reason. If no independent reviewer is available, read the full diff again cold. Report that limitation. At the [review](review.md) growth thresholds, this fallback is not enough. @@ -50,17 +52,19 @@ Never push tags. Put enforcement edits in a final `chore(gates): ` commit. For conflicts or relevant upstream changes, rebase. Disjoint changes alone do not require rebase. -After a rebase, validate the new head. Keep old evidence attributed to its original SHA. +After a rebase, keep old evidence attributed to its original SHA. ## PR body The `pr-body` gate enforces the sections and the 250-word limit. -Update the body after each push. Open as draft only when requested or incomplete. +If the scope or evidence changes, update the body. +If the task requests a draft or the implementation is incomplete, open as draft. - `## Summary`: the invariant and behavior, the reason, the linked issue, and scope expansion. - `## Before / after`: for `feat` and `fix`, up to 3 calls at base and head, with the output that differs. Or state `No observable change` with a reason. - `## Value`: for a refactor, 2–4 numbers measured at base and head. -- `## Validation`: the tested SHA and receipt, command results, CI obligations, and unresolved risks. +- `## Validation`: validation status at the head SHA, available evidence, and unresolved risks. Use evidence accessible remotely. + If CI is pending, record `CI pending`. For docs-only changes, explain why runtime tests do not apply. diff --git a/docs/agents/test-authoring.md b/docs/agents/test-authoring.md index 245a45583a..099756042b 100644 --- a/docs/agents/test-authoring.md +++ b/docs/agents/test-authoring.md @@ -15,15 +15,15 @@ For native behavior, use the owning E2E lane. For pure logic, types, or exhaustive cases, use focused tests. If an existing scenario covers the regression, extend it. Do not add test-only production exports or dependency injection. -Without the fix, a regression test must fail for the intended reason. -Use [isolated experiments](test-experiments.md). -Pure moves retain their tests. Verify discovery at the new path. +Write the regression test so that it fails for the intended reason without the fix. +For a requested experiment, use [isolated experiments](test-experiments.md). +For a pure move, retain the tests and their runner coverage. Pair classifier positives with the closest negative. Prove identical error text without the typed reason cannot trigger recovery. For callback canaries, assert semantic success. Automatic replay coverage requires a PR or scheduled lane that runs the scenario at the actual head. -Reject assertion-free probes, self-comparisons, subject-derived expectations, duplicate cases, and mocks that assert their own inputs. +Reject assertion-free probes, self-comparisons, assertions about prose, subject-derived expectations, duplicate cases, and mocks that assert their own inputs. Match test names to exercised inputs. Type-only checks do not prove runtime behavior. @@ -55,12 +55,11 @@ Import the subject module, not a platform barrel. ## Run a focused test -Use `pnpm exec vitest run --project unit-core `. +For a focused test, run `pnpm exec vitest run --project unit-core `. For `packages/apple-runner/src/**`, use `--project apple-runner`. Local runs default to four workers. For a different host share, set `AGENT_DEVICE_VITEST_MAX_WORKERS=`. CI ignores it. -The root tsconfig includes scripts TypeScript. -Verify runner inclusion; typechecking does not prove collection. +Verify runner inclusion separately from typechecking. For a provider scenario, use `pnpm exec vitest run --project provider-integration `. For device smoke, use the owning checked-in harness. diff --git a/docs/agents/testing.md b/docs/agents/testing.md index 485e2667a9..2dc39da05f 100644 --- a/docs/agents/testing.md +++ b/docs/agents/testing.md @@ -1,22 +1,24 @@ # Validate a change -## Run checks +If you are a worker, use the CI log from the coordinator. -1. During edits, run the focused test or `pnpm check:quick`. -2. Before you push, commit the change. - Run `pnpm check:affected --run --head `. -3. For a broad refactor or an explicitly requested full gate, run `pnpm check`. +## Run local checks as a maintainer + +Before testing in a new worktree, run `pnpm install --frozen-lockfile && pnpm build`. + +1. During edits, run a focused test or `pnpm check:quick`. +2. Before you push, run `pnpm check:affected --run --head ` on the committed change. +3. For a broad refactor or a requested full gate, run `pnpm check`. Serialized validation requires macOS or Linux. +`pnpm check:affected --run`, `pnpm check`, and heavy `pnpm gate` ids share one lock. On Windows, use plan mode or focused checks. -Wait for the owner to finish. -Do not add lock wrappers. -A wait ends after two hours. +The lock reclaims provably dead owners. An unknown owner blocks. +If the two-hour wait ends, report the printed owner and lock state. +Do not add lock wrappers or remove the lock manually. Focused tests do not lock. Avoid subprocess-heavy tests beside a broad gate. - -The runner stops at failure. -Its receipt records refs, checkout state, commands, exits, skips, and results. +Before you run the layering scan, stage new modules. For a plan, run `pnpm check:affected`. For reasons, add `--verbose`. @@ -24,15 +26,13 @@ For JSON, run `pnpm --silent check:affected --json`. With `--run --json`, stdout contains the receipt and stderr contains progress. When head is `HEAD`, planning and execution include working-tree changes. -`pnpm check` runs every `localRunnable` catalog check except `vitest-related`. -It skips each non-`localRunnable` check, naming its CI lane. +`pnpm check` runs every `localRunnable` check except `vitest-related`. +For each CI-only check, it names the CI lane. -Only a passed receipt with `exactCommit: true` proves validation at the named commit. -A dirty-tree pass is local feedback. -Detected checkout changes invalidate the run. -Initial/final checks detect persistent changes. -They do not sandbox the checkout. +Only a passed receipt with `exactCommit: true` proves a local pass at its named commit. +Checkout changes invalidate the run. During validation, stop all edits. +The runner records the results in a receipt and stops at failure. ## Interpret selection @@ -41,31 +41,24 @@ For package manifest or TypeScript config changes, retain full selection. Read `failOpenReasons` in plan JSON or `plan.failOpenReasons` in a receipt. Do not reduce selection to get a pass. -Read required-check status on the PR. GitHub owns full coverage, native builds, device lanes, provider integration, and compatibility that uses history. -On a narrowed plan, related tests replace only provider integration. -For skipped-check owners, read `results[].reason`. -Until source-read ownership is complete, keep #4050's full-unit production fallback. -Do not add tests that assert prose. - -## A gate failed +In a narrowed plan, related tests replace only provider integration. +For skip reasons, read `results[].reason`. +Keep #4050's full-unit fallback until source-read ownership is complete. -Separate cause from validation status. -Never call a failing gate passed. +## Diagnose a gate failure as a maintainer | Evidence | Required action | | --- | --- | -| Failure caused by this change | Fix its owner and rerun. Until a run passes, report failed validation. | -| Suspected host or infrastructure fault | Save the log; compare the same command on the unchanged base without competing tests. Until compared, report cause unproven. | -| Matching failure on unchanged base | Report Base-blocked with SHAs, command, and logs. Name the blocker and owner or issue. For authorized publication, use a draft with remaining checks. Do not mark merge-ready. | -| Unavailable or inconclusive base comparison | Record the missing evidence and next action. Report blocked with cause unproven. | -| Repaired fault or upstream fix | Rerun the failed check and affected gate at head. Require new evidence to change blocked status. | +| Failure from the change | Fix its owner and rerun. | +| Suspected infrastructure fault | Save the log. Run the same command at base without competing tests. | +| Matching failure at base | Report Base-blocked with SHAs, command, logs, and the owner or issue. If authorized to publish, open a draft with the remaining checks. | +| Missing or inconclusive base result | Report blocked with cause unproven. Give the missing evidence and next action. | +| Repaired fault or upstream fix | Rerun the failed check and affected gate at head. Change status only with new evidence. | Match failures by check, location, diagnostic code, and assertion. -Until a named owner or issue accepts the blocker, the implementing agent owns diagnosis. -Do not loop on an unchanged failure. +The coordinator owns diagnosis until a named owner or issue accepts it. Do not widen timeouts. Do not mask exit codes. -Do not claim CI authority as a local pass. -Only if its log shows an infrastructure fault, rerun failed CI once. +If CI shows an infrastructure fault, rerun it once. If the same failure occurs twice, treat it as a finding. From 2ec83b0c3428e10bde28e48cf80911789dede396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 25 Nov 2026 12:02:47 +0100 Subject: [PATCH 2/6] docs(agents): keep the repo summary and the failing-gate rules Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 3 ++- docs/agents/testing.md | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 9baf8396c6..5ffe2caea2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,7 @@ # AGENTS.md -The daemon owns sessions. The registry routes commands to platform runtimes. +`agent-device` is a CLI and daemon that automates devices and web targets. +The daemon owns sessions. Registry declarations route commands to platform runtimes. ## Worker handoff diff --git a/docs/agents/testing.md b/docs/agents/testing.md index 2dc39da05f..6e3fac98d0 100644 --- a/docs/agents/testing.md +++ b/docs/agents/testing.md @@ -48,6 +48,9 @@ Keep #4050's full-unit fallback until source-read ownership is complete. ## Diagnose a gate failure as a maintainer +Separate cause from validation status. +Never call a failing gate passed. + | Evidence | Required action | | --- | --- | | Failure from the change | Fix its owner and rerun. | @@ -60,5 +63,6 @@ Match failures by check, location, diagnostic code, and assertion. The coordinator owns diagnosis until a named owner or issue accepts it. Do not widen timeouts. Do not mask exit codes. +Do not report a CI result as a local pass. If CI shows an infrastructure fault, rerun it once. If the same failure occurs twice, treat it as a finding. From 9d68ed9af546beaae7c195874b554a5e8325531f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 25 Nov 2026 12:05:55 +0100 Subject: [PATCH 3/6] docs(agents): fit the agent docs back under the context budget Co-Authored-By: Claude Opus 5.5 --- docs/agents/pull-requests.md | 2 +- docs/agents/testing.md | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/agents/pull-requests.md b/docs/agents/pull-requests.md index 62c3731bdd..89327e5f1a 100644 --- a/docs/agents/pull-requests.md +++ b/docs/agents/pull-requests.md @@ -12,7 +12,7 @@ For each review round, push once. Each push restarts CI. Drafts skip device lanes. If the task includes manual device verification, follow the [device guide](device-verification.md). -If a device or command blocks that run, report it. +Report a blocked device run. - Published: the branch is pushed, the PR is open, and validation status is recorded at a named commit. - Merge-ready: required checks pass at the head, with live evidence for device-facing changes. diff --git a/docs/agents/testing.md b/docs/agents/testing.md index 6e3fac98d0..136678d695 100644 --- a/docs/agents/testing.md +++ b/docs/agents/testing.md @@ -18,7 +18,7 @@ If the two-hour wait ends, report the printed owner and lock state. Do not add lock wrappers or remove the lock manually. Focused tests do not lock. Avoid subprocess-heavy tests beside a broad gate. -Before you run the layering scan, stage new modules. +Stage new modules before the layering scan. For a plan, run `pnpm check:affected`. For reasons, add `--verbose`. @@ -48,7 +48,6 @@ Keep #4050's full-unit fallback until source-read ownership is complete. ## Diagnose a gate failure as a maintainer -Separate cause from validation status. Never call a failing gate passed. | Evidence | Required action | @@ -63,6 +62,5 @@ Match failures by check, location, diagnostic code, and assertion. The coordinator owns diagnosis until a named owner or issue accepts it. Do not widen timeouts. Do not mask exit codes. -Do not report a CI result as a local pass. If CI shows an infrastructure fault, rerun it once. If the same failure occurs twice, treat it as a finding. From 05e71091abe0a541f974e60926d5385dcd77e147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 25 Nov 2026 12:08:53 +0100 Subject: [PATCH 4/6] docs(agents): keep the maintainer validation rules; scope the change to the worker handoff Restores docs/agents from main and keeps only the worker handoff, the owner-first routing, and the maintainer label on the pre-push gate. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 15 ++++---- docs/agents/code-ownership.md | 2 +- docs/agents/device-verification.md | 5 +-- docs/agents/gates.md | 4 +- docs/agents/pull-requests.md | 32 +++++++-------- docs/agents/test-authoring.md | 13 ++++--- docs/agents/testing.md | 62 ++++++++++++++++-------------- 7 files changed, 67 insertions(+), 66 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 5ffe2caea2..39ed09d7bb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,13 +5,11 @@ The daemon owns sessions. Registry declarations route commands to platform runti ## Worker handoff -A worker is an agent with a delegated task. -For worker changes, CI owns validation. -Do not run local gates, check scripts, lint or typecheck sweeps, coverage, or project-wide test runs. -If you need local feedback to write a test, run only the test file you changed. -If authorized, push the change and report the head SHA with checks pending. -Do not wait for CI. -The coordinator reads CI, assigns fixes, and arranges review. +For a delegated task, CI owns validation. +Do not run local gates, check scripts, coverage, or project-wide tests. +To write a test, run only that test file. +Push, report the head SHA with checks pending, and stop. +The coordinator relays CI results and review. ## Task routing @@ -38,6 +36,8 @@ For each question that remains, use the matching row. | Issues, PRDs, or triage labels | `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md` | | Web backend setup or diagnostics | `docs/agents/web-backend.md` | +A device-facing change affects dispatch, capture, interaction, app lifecycle, or native execution. + The versioned CLI help owns command semantics. To drive an app, start with the skill's routing card. ## Working rules @@ -58,6 +58,7 @@ The versioned CLI help owns command semantics. To drive an app, start with the s - Do not change other worktrees, devices, sessions, dirty files, or experiments. Do not use `git stash`; all worktrees share it. - Do not copy `.env` into a worktree. For host credentials, source the main checkout's file by absolute path. - Give each parallel worker different files and devices. +- The layering scan reads only tracked files. Stage new modules before you trust its result. - When you rename a file, move its Fallow baseline entry. Do not regenerate unrelated baselines. ## Agent docs diff --git a/docs/agents/code-ownership.md b/docs/agents/code-ownership.md index f6b399979c..e9b65ea372 100644 --- a/docs/agents/code-ownership.md +++ b/docs/agents/code-ownership.md @@ -1,6 +1,6 @@ # Code ownership -If direct callers do not show the affected boundary, use `pnpm depgraph affected ` when it is available. +Before you edit a module with many callers, run `pnpm depgraph affected `. ## Declarations diff --git a/docs/agents/device-verification.md b/docs/agents/device-verification.md index 5ad3c304df..886cf62bad 100644 --- a/docs/agents/device-verification.md +++ b/docs/agents/device-verification.md @@ -1,7 +1,6 @@ # Verify on a device -For a requested manual device run, use this guide. -For foldables, also read [foldable verification](device-foldable.md). +Use this for Apple runner changes or manual device runs. For foldables, also read [foldable verification](device-foldable.md). ## Prepare @@ -48,7 +47,7 @@ The physical runner handoff checklist is in `docs/evidence/ios-physical-runner-h ## Platform policy -For Apple runner changes, CI runs `pnpm check:xctest-selection`. +For Apple runner changes, run `pnpm check:xctest-selection` and build the affected target. Swift `#if` guards own the XCTest classification. Do not keep a second list of test names. Use macOS host lanes for pure decisions. Use simulator lanes for iOS and XCTest semantics. If system policy rejects an unsigned host bundle, rebuild with `CODE_SIGN_IDENTITY="Apple Development"` diff --git a/docs/agents/gates.md b/docs/agents/gates.md index b0efc5be5f..15e57188db 100644 --- a/docs/agents/gates.md +++ b/docs/agents/gates.md @@ -3,7 +3,7 @@ `CHECK_CATALOG` in `scripts/check-affected/checks.ts` owns checks and commands. CI declares ownership through the shared `run-gate` action with a literal gate id. For a new check, update the catalog and executable model. -When a maintainer verifies ownership and reachability locally, run `pnpm check:gate-manifest`. +To verify ownership and reachability, run `pnpm check:gate-manifest`. For parser and geometry changes, extend shared fast-check arbitraries and properties. Use `PROPERTY_RUNS` budgets. Keep examples for past bugs or named decisions. @@ -17,7 +17,7 @@ Dispatch with `--with-dependencies` adds `LANE_DEPENDENCIES`. Scores are advisory. Incomplete sweeps fail. Before a pilot, read `pnpm mutation:run --help`. Concurrency torture uses production lock decisions. -When a maintainer runs concurrency torture locally, use `pnpm test:concurrency-torture`. +Run `pnpm test:concurrency-torture`. To replay, use the printed `TORTURE_SEED`. Do not commit output stamped with a run or commit under `scripts/`. diff --git a/docs/agents/pull-requests.md b/docs/agents/pull-requests.md index 89327e5f1a..b45736e0f5 100644 --- a/docs/agents/pull-requests.md +++ b/docs/agents/pull-requests.md @@ -1,24 +1,21 @@ # Open or update a PR -A request to open or ship a PR authorizes branch creation, commits, push, and PR creation. -Before you merge or release, get separate authorization. +After validation, a request to open or ship a PR authorizes branch creation, commits, push, and PR creation. Merging and releasing need separate authorization. ## Validate -If you are a worker, publish the change with CI pending. -For maintainer validation, follow [validation](testing.md). -If you have authorization to open an incomplete draft, record its blocker. -For each review round, push once. -Each push restarts CI. Drafts skip device lanes. +Follow [validation](testing.md). +A serialized gate stage can validate the pushed head instead. +An authorized incomplete draft can record a blocker. A blocker is not a pass. +Push once per review round. Each push restarts CI. Drafts skip device lanes. -If the task includes manual device verification, follow the [device guide](device-verification.md). -Report a blocked device run. +For device-facing changes, follow [device verification](device-verification.md). +Report missing devices or commands. - Published: the branch is pushed, the PR is open, and validation status is recorded at a named commit. - Merge-ready: required checks pass at the head, with live evidence for device-facing changes. -A device-facing change affects live dispatch, capture, interaction, app lifecycle, or native execution. - +Do not wait for CI merely to report publication. Do not report skipped integration or coverage as passed. ## New public package @@ -28,9 +25,9 @@ First, the maintainer publishes an empty placeholder version, for example `0.0.0 Then the maintainer configures the npm trusted publisher for the release workflow. Only after these steps does the PR remove `"private": true`. -## Coordinator review +## Self-review -Give the reviewer the worktree, merge-base SHA, head SHA, and task requirements. +Give an independent reviewer the worktree, the merge-base SHA, the head SHA, and the task requirements. In the first review, do not supply an implementation summary. Review that SHA range with AGENTS.md and [review guidance](review.md). @@ -38,6 +35,7 @@ In later rounds, supply the SHA reviewed before, its findings, and their disposi Review the changes since that SHA and the interactions that they affect. After a rebase, compare the branch ranges with `git range-diff .. ..`. Fix accepted findings with the smallest change. Prefer configuration or deletion to new code. +Rerun affected checks. For rejected findings, record a reason. If no independent reviewer is available, read the full diff again cold. Report that limitation. At the [review](review.md) growth thresholds, this fallback is not enough. @@ -52,19 +50,17 @@ Never push tags. Put enforcement edits in a final `chore(gates): ` commit. For conflicts or relevant upstream changes, rebase. Disjoint changes alone do not require rebase. -After a rebase, keep old evidence attributed to its original SHA. +After a rebase, validate the new head. Keep old evidence attributed to its original SHA. ## PR body The `pr-body` gate enforces the sections and the 250-word limit. -If the scope or evidence changes, update the body. -If the task requests a draft or the implementation is incomplete, open as draft. +Update the body after each push. Open as draft only when requested or incomplete. - `## Summary`: the invariant and behavior, the reason, the linked issue, and scope expansion. - `## Before / after`: for `feat` and `fix`, up to 3 calls at base and head, with the output that differs. Or state `No observable change` with a reason. - `## Value`: for a refactor, 2–4 numbers measured at base and head. -- `## Validation`: validation status at the head SHA, available evidence, and unresolved risks. +- `## Validation`: the tested SHA and receipt, command results, CI obligations, and unresolved risks. Use evidence accessible remotely. - If CI is pending, record `CI pending`. For docs-only changes, explain why runtime tests do not apply. diff --git a/docs/agents/test-authoring.md b/docs/agents/test-authoring.md index 099756042b..245a45583a 100644 --- a/docs/agents/test-authoring.md +++ b/docs/agents/test-authoring.md @@ -15,15 +15,15 @@ For native behavior, use the owning E2E lane. For pure logic, types, or exhaustive cases, use focused tests. If an existing scenario covers the regression, extend it. Do not add test-only production exports or dependency injection. -Write the regression test so that it fails for the intended reason without the fix. -For a requested experiment, use [isolated experiments](test-experiments.md). -For a pure move, retain the tests and their runner coverage. +Without the fix, a regression test must fail for the intended reason. +Use [isolated experiments](test-experiments.md). +Pure moves retain their tests. Verify discovery at the new path. Pair classifier positives with the closest negative. Prove identical error text without the typed reason cannot trigger recovery. For callback canaries, assert semantic success. Automatic replay coverage requires a PR or scheduled lane that runs the scenario at the actual head. -Reject assertion-free probes, self-comparisons, assertions about prose, subject-derived expectations, duplicate cases, and mocks that assert their own inputs. +Reject assertion-free probes, self-comparisons, subject-derived expectations, duplicate cases, and mocks that assert their own inputs. Match test names to exercised inputs. Type-only checks do not prove runtime behavior. @@ -55,11 +55,12 @@ Import the subject module, not a platform barrel. ## Run a focused test -For a focused test, run `pnpm exec vitest run --project unit-core `. +Use `pnpm exec vitest run --project unit-core `. For `packages/apple-runner/src/**`, use `--project apple-runner`. Local runs default to four workers. For a different host share, set `AGENT_DEVICE_VITEST_MAX_WORKERS=`. CI ignores it. -Verify runner inclusion separately from typechecking. +The root tsconfig includes scripts TypeScript. +Verify runner inclusion; typechecking does not prove collection. For a provider scenario, use `pnpm exec vitest run --project provider-integration `. For device smoke, use the owning checked-in harness. diff --git a/docs/agents/testing.md b/docs/agents/testing.md index 136678d695..ba7e52cb96 100644 --- a/docs/agents/testing.md +++ b/docs/agents/testing.md @@ -1,24 +1,21 @@ # Validate a change -If you are a worker, use the CI log from the coordinator. +## Run checks -## Run local checks as a maintainer - -Before testing in a new worktree, run `pnpm install --frozen-lockfile && pnpm build`. - -1. During edits, run a focused test or `pnpm check:quick`. -2. Before you push, run `pnpm check:affected --run --head ` on the committed change. -3. For a broad refactor or a requested full gate, run `pnpm check`. +1. During edits, run the focused test or `pnpm check:quick`. +2. A maintainer commits, then runs `pnpm check:affected --run --head `. +3. For a broad refactor or an explicitly requested full gate, run `pnpm check`. Serialized validation requires macOS or Linux. -`pnpm check:affected --run`, `pnpm check`, and heavy `pnpm gate` ids share one lock. On Windows, use plan mode or focused checks. -The lock reclaims provably dead owners. An unknown owner blocks. -If the two-hour wait ends, report the printed owner and lock state. -Do not add lock wrappers or remove the lock manually. +An unknown lock owner blocks; report it. +Do not add lock wrappers. +A wait ends after two hours. Focused tests do not lock. Avoid subprocess-heavy tests beside a broad gate. -Stage new modules before the layering scan. + +The runner stops at failure. +Its receipt records refs, checkout state, commands, exits, skips, and results. For a plan, run `pnpm check:affected`. For reasons, add `--verbose`. @@ -26,13 +23,15 @@ For JSON, run `pnpm --silent check:affected --json`. With `--run --json`, stdout contains the receipt and stderr contains progress. When head is `HEAD`, planning and execution include working-tree changes. -`pnpm check` runs every `localRunnable` check except `vitest-related`. -For each CI-only check, it names the CI lane. +`pnpm check` runs every `localRunnable` catalog check except `vitest-related`. +It skips each non-`localRunnable` check, naming its CI lane. -Only a passed receipt with `exactCommit: true` proves a local pass at its named commit. -Checkout changes invalidate the run. +Only a passed receipt with `exactCommit: true` proves validation at the named commit. +A dirty-tree pass is local feedback. +Detected checkout changes invalidate the run. +Initial/final checks detect persistent changes. +They do not sandbox the checkout. During validation, stop all edits. -The runner records the results in a receipt and stops at failure. ## Interpret selection @@ -41,26 +40,31 @@ For package manifest or TypeScript config changes, retain full selection. Read `failOpenReasons` in plan JSON or `plan.failOpenReasons` in a receipt. Do not reduce selection to get a pass. +Read required-check status on the PR. GitHub owns full coverage, native builds, device lanes, provider integration, and compatibility that uses history. -In a narrowed plan, related tests replace only provider integration. -For skip reasons, read `results[].reason`. -Keep #4050's full-unit fallback until source-read ownership is complete. +On a narrowed plan, related tests replace only provider integration. +For skipped-check owners, read `results[].reason`. +Until source-read ownership is complete, keep #4050's full-unit production fallback. +Do not add tests that assert prose. -## Diagnose a gate failure as a maintainer +## A gate failed +Separate cause from validation status. Never call a failing gate passed. | Evidence | Required action | | --- | --- | -| Failure from the change | Fix its owner and rerun. | -| Suspected infrastructure fault | Save the log. Run the same command at base without competing tests. | -| Matching failure at base | Report Base-blocked with SHAs, command, logs, and the owner or issue. If authorized to publish, open a draft with the remaining checks. | -| Missing or inconclusive base result | Report blocked with cause unproven. Give the missing evidence and next action. | -| Repaired fault or upstream fix | Rerun the failed check and affected gate at head. Change status only with new evidence. | +| Failure caused by this change | Fix its owner and rerun. Until a run passes, report failed validation. | +| Suspected host or infrastructure fault | Save the log; compare the same command on the unchanged base without competing tests. Until compared, report cause unproven. | +| Matching failure on unchanged base | Report Base-blocked with SHAs, command, and logs. Name the blocker and owner or issue. For authorized publication, use a draft with remaining checks. Do not mark merge-ready. | +| Unavailable or inconclusive base comparison | Record the missing evidence and next action. Report blocked with cause unproven. | +| Repaired fault or upstream fix | Rerun the failed check and affected gate at head. Require new evidence to change blocked status. | Match failures by check, location, diagnostic code, and assertion. -The coordinator owns diagnosis until a named owner or issue accepts it. +Until a named owner or issue accepts the blocker, the implementing agent owns diagnosis. +Do not loop on an unchanged failure. Do not widen timeouts. Do not mask exit codes. -If CI shows an infrastructure fault, rerun it once. +Do not claim CI authority as a local pass. +Only if its log shows an infrastructure fault, rerun failed CI once. If the same failure occurs twice, treat it as a finding. From 7be6556648f363dd207c3c0d1816a32de6a739cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 25 Nov 2026 12:09:16 +0100 Subject: [PATCH 5/6] docs(agents): one instruction per sentence in the worker handoff Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 39ed09d7bb..dd03b990c5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,9 @@ The daemon owns sessions. Registry declarations route commands to platform runti For a delegated task, CI owns validation. Do not run local gates, check scripts, coverage, or project-wide tests. To write a test, run only that test file. -Push, report the head SHA with checks pending, and stop. +Push the change. +Report the head SHA with checks pending. +Do not wait for CI. The coordinator relays CI results and review. ## Task routing From 92a4f1ad0b5dff1eb318aab76683a71c90fff104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 25 Nov 2026 13:04:54 +0100 Subject: [PATCH 6/6] docs(agents): scope local validation to non-delegated tasks and keep the lock rules Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 7 +++---- docs/agents/testing.md | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index dd03b990c5..7c460820fa 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,11 +7,10 @@ The daemon owns sessions. Registry declarations route commands to platform runti For a delegated task, CI owns validation. Do not run local gates, check scripts, coverage, or project-wide tests. -To write a test, run only that test file. -Push the change. +If you write a test, run only that test file. +If the task asks you to publish a change, push it. Report the head SHA with checks pending. Do not wait for CI. -The coordinator relays CI results and review. ## Task routing @@ -34,7 +33,7 @@ For each question that remains, use the matching row. | A PR to open or update | `docs/agents/pull-requests.md` | | A change to review | `docs/agents/review.md` | | Trust boundaries, untrusted paths, security review | `docs/agents/security.md` | -| Manual device verification | `docs/agents/device-verification.md` | +| Apple runner or device-facing changes | `docs/agents/device-verification.md` | | Issues, PRDs, or triage labels | `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md` | | Web backend setup or diagnostics | `docs/agents/web-backend.md` | diff --git a/docs/agents/testing.md b/docs/agents/testing.md index ba7e52cb96..76e29d6057 100644 --- a/docs/agents/testing.md +++ b/docs/agents/testing.md @@ -1,26 +1,28 @@ # Validate a change +If the task is delegated, follow the worker handoff in AGENTS.md. + ## Run checks 1. During edits, run the focused test or `pnpm check:quick`. -2. A maintainer commits, then runs `pnpm check:affected --run --head `. -3. For a broad refactor or an explicitly requested full gate, run `pnpm check`. +2. If the task is not delegated, commit before you push. + Then run `pnpm check:affected --run --head `. +3. For a broad refactor or a requested full gate, run `pnpm check`. Serialized validation requires macOS or Linux. On Windows, use plan mode or focused checks. -An unknown lock owner blocks; report it. -Do not add lock wrappers. +Wait for a live owner to finish. +An unknown owner blocks; report it. +Do not add lock wrappers. Do not remove the lock manually. A wait ends after two hours. Focused tests do not lock. Avoid subprocess-heavy tests beside a broad gate. -The runner stops at failure. -Its receipt records refs, checkout state, commands, exits, skips, and results. +The runner stops at failure and writes a receipt. For a plan, run `pnpm check:affected`. For reasons, add `--verbose`. For JSON, run `pnpm --silent check:affected --json`. -With `--run --json`, stdout contains the receipt and stderr contains progress. When head is `HEAD`, planning and execution include working-tree changes. `pnpm check` runs every `localRunnable` catalog check except `vitest-related`. @@ -54,8 +56,8 @@ Never call a failing gate passed. | Evidence | Required action | | --- | --- | -| Failure caused by this change | Fix its owner and rerun. Until a run passes, report failed validation. | -| Suspected host or infrastructure fault | Save the log; compare the same command on the unchanged base without competing tests. Until compared, report cause unproven. | +| Failure from this change | Fix its owner and rerun. Until a run passes, report failed validation. | +| Suspected infrastructure fault | Save the log; compare the same command on the unchanged base without competing tests. Until compared, report cause unproven. | | Matching failure on unchanged base | Report Base-blocked with SHAs, command, and logs. Name the blocker and owner or issue. For authorized publication, use a draft with remaining checks. Do not mark merge-ready. | | Unavailable or inconclusive base comparison | Record the missing evidence and next action. Report blocked with cause unproven. | | Repaired fault or upstream fix | Rerun the failed check and affected gate at head. Require new evidence to change blocked status. |