Skip to content

Commit 719ef14

Browse files
fix(repo): scope Mosaic parity reminders to current edits
1 parent 30ed600 commit 719ef14

7 files changed

Lines changed: 459 additions & 261 deletions

File tree

‎.claude/settings.json‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@
3737
],
3838
"PreToolUse": [
3939
{
40-
"matcher": "Write",
40+
"matcher": "Write|Edit",
4141
"hooks": [
4242
{
4343
"type": "command",
4444
"command": "node \"$(git rev-parse --show-toplevel)/scripts/mosaic-parity-gate.mjs\" write",
45-
"timeout": 10,
46-
"if": "Write(/packages/mosaic/src/features/**)"
45+
"timeout": 10
4746
}
4847
]
4948
}
@@ -60,11 +59,6 @@
6059
"type": "command",
6160
"command": "cd \"$(git rev-parse --show-toplevel)\" && { git diff --name-only --diff-filter=d HEAD -- packages/swingset/src; git ls-files --others --exclude-standard -- packages/swingset/src; } | grep -E '\\.tsx?$' | xargs -r pnpm exec eslint --quiet --no-warn-ignored --rule 'import/no-unresolved: off' >&2 || exit 2",
6261
"timeout": 180
63-
},
64-
{
65-
"type": "command",
66-
"command": "node \"$(git rev-parse --show-toplevel)/scripts/mosaic-parity-gate.mjs\" stop",
67-
"timeout": 30
6862
}
6963
]
7064
}

‎.codex/hooks.json‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
"type": "command",
1313
"command": "cd \"$(git rev-parse --show-toplevel)\" && { git diff --name-only --diff-filter=d HEAD -- packages/swingset/src; git ls-files --others --exclude-standard -- packages/swingset/src; } | grep -E '\\.tsx?$' | xargs -r pnpm exec eslint --quiet --no-warn-ignored --rule 'import/no-unresolved: off' >&2 || exit 2",
1414
"timeout": 180
15-
},
16-
{
17-
"type": "command",
18-
"command": "node \"$(git rev-parse --show-toplevel)/scripts/mosaic-parity-gate.mjs\" stop",
19-
"timeout": 30
2015
}
2116
]
2217
}

‎packages/mosaic/AGENTS.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ Before you change a file that matches a pattern below, read its guide, even for
4040

4141
## Ports of legacy components are migrations
4242

43-
Before you write a new feature, search `packages/react/src/components/` and `packages/ui/src/components/` for its counterpart. If one exists, the work is a [migration](docs/migration.md), including a headless port of a `@clerk/react` button framed as a new feature:
43+
For a current task that implements or reviews a Mosaic migration, or changes its migrated behavior, search `packages/react/src/components/` and `packages/ui/src/components/` for the counterpart. A headless port framed as a new feature is a [migration](docs/migration.md) too. Unrelated work does not acquire this workflow merely because the branch already contains Mosaic changes.
4444

45-
1. Read the counterpart and write the Phase 1 inventory to `tmp/mosaic-parity/<feature>.md` before the model. The file names the legacy path and has an `## Inventory` section.
45+
1. Read the counterpart, shared prop types, and relevant helper/runtime calls. Write the Phase 1 inventory to `tmp/mosaic-parity/<feature>.md` before the model. Record the task scope, exact revisions, accepted differences, and exclusions alongside the legacy path and `## Inventory` section.
4646
2. Before you call the work done, review it, or open a PR, run the [parity audit](docs/parity-audit.md) in a read-only subagent and put its table under `## Parity audit` in the same file. Reading the doc is not running the audit.
47-
3. List every **Deliberately changed** and **Deferred** row in the PR description. A difference that is not listed is a regression.
48-
4. Listing a difference does not make it acceptable. If one breaks a rule in this file or in `docs/`, such as a failure that nobody sees, fix it or ask the user before you finish. Do not label it deliberate.
47+
3. Use the audit's classifications to separate parity gaps, intentional differences needing disclosure, missing verification, and optional improvements. List intentional differences and approved deferrals in the PR description. Do not require inherited improvements or refactors as parity fixes.
48+
4. Listing a difference does not make it acceptable. Cite any conflicting rule in this file or `docs/`, and fix the gap or raise it with the user. Do not infer intentional behavior from the implementation. Preserve decisions the user already made, and leave unresolved product choices open.
49+
5. Inspect the actual results of focused type and behavior checks. For relevant async actions, include a representative failure through the existing fake FAPI or supported browser setup. A populated note is process bookkeeping, not proof of parity.
4950

50-
`tmp/` is ignored by git, so the file stays out of the PR. Hooks in `.claude/settings.json` and `.codex/hooks.json` (`scripts/mosaic-parity-gate.mjs`) check it: one blocks writing a new feature's model until the inventory exists, and one blocks finishing until the audit is in.
51+
`tmp/` is ignored by git, so the file stays out of the PR. The hooks in `.claude/settings.json` and `.codex/hooks.json` (`scripts/mosaic-parity-gate.mjs`) give conditional guidance for the feature paths in the current edit. They do not inspect branch history or notes, deny edits, or block completion. For a read-only parity review, run the explicit scoped command in [Parity audit](docs/parity-audit.md). These reminders do not run the audit or verify its evidence.
5152

5253
## Layers in one paragraph
5354

‎packages/mosaic/docs/migration.md‎

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Do not write the new layers first and then ask "did I get everything?" — that
1818
means proving a negative. Invert it: enumerate the legacy behavior first, then
1919
make each layer account for a specific row.
2020

21+
Apply this workflow to the current requested Mosaic work, not every Mosaic change
22+
already on the branch. Record the feature scope, original revisions, accepted
23+
differences, and exclusions. When reviewing earlier feedback, use the commit the
24+
reviewer saw, not a later implementation that may already have addressed it.
25+
2126
---
2227

2328
## Phase 1 — Inventory the legacy behavior (the spec)
@@ -54,6 +59,12 @@ Turn the hits into a **behavior inventory** — one row per: effect, guard, erro
5459
path, empty/loading state, permission gate, revalidate, reset-on-close, derived
5560
label. This list is finite and is the contract the migration must satisfy.
5661

62+
Include shared prop contracts and mode-dependent options, callback ordering and
63+
awaiting, defaults, and error delivery. Follow helpers and Clerk runtime calls
64+
when they determine the outcome. Record inherited limitations separately from
65+
introduced gaps. A grep hit list or comparison of component files alone is not
66+
the complete contract. See [Parity audit](parity-audit.md) for the checks.
67+
5768
Write it to `tmp/mosaic-parity/<feature>.md` (ignored by git) before the model:
5869

5970
```md
@@ -112,26 +123,28 @@ row into a test there by default, and reach for a smaller test only where
112123
highest-risk layer, so make sure its rows (revalidation, permission gates,
113124
empty states) each have one.
114125

126+
For each affected async action, exercise a representative rejection as well as
127+
success and pending work. Verify error delivery and the final rendered/resource
128+
state, including recovery where promised. Do not replace a Clerk mutation with a
129+
method mock when the existing fake FAPI can drive it. Check mode-dependent prop
130+
contracts with focused type checks and verify forwarding in the relevant modes.
131+
115132
## Phase 4 — Verify parity (the confidence step)
116133

117-
Tests only cover branches you remembered to write. To catch the
118-
ones you didn't, run an automated diff of legacy against new.
134+
Tests only cover branches you remembered to write. Have an independent reader
135+
trace the contract and identify missing checks as well as behavioral differences.
119136

120137
Launch a read-only subagent (Explore in Claude Code) with the prompt in `parity-audit.md`. Give it the
121-
legacy file paths and the new model/controller/view paths. It returns a table
122-
classifying every legacy behavior as:
123-
124-
- **Migrated** — points at a specific state / transition / context field.
125-
- **Deliberately changed** — names the new behavior and why (e.g. infinite
126-
scroll → "Load more" button).
127-
- **Deferred** — a real tracked ticket, **not** a `// TODO` buried in a
128-
controller or model. A buried TODO is invisible at review time; that is exactly
129-
how an earlier domains-section migration shipped three regressions (see
130-
`parity-audit.md`).
131-
132-
Every inventory row from Phase 1 must land in exactly one bucket. Put the table
138+
legacy and new revisions, file paths, shared types, and accepted decisions.
139+
Use the classifications and evidence columns in `parity-audit.md`. Distinguish
140+
parity gaps, intentional differences needing disclosure, missing verification,
141+
and optional improvements. Leave unresolved intent as a decision for the user.
142+
143+
Every inventory row from Phase 1 must have a conclusion and evidence. Put the table
133144
under `## Parity audit` in `tmp/mosaic-parity/<feature>.md`. It drives the work
134-
and the PR discussion, and is never committed.
145+
and the PR discussion, and is never committed. Read the results of its referenced
146+
checks before claiming parity. A filled table, a tracked deferral, or a hook
147+
reminder is not proof that the behavior works.
135148

136149
## Phase 5 — Ship
137150

0 commit comments

Comments
 (0)