Compatibility: designed for Codex CLI and compatible agents with a MatrixOne
git working tree. Use unhappy-path-audit for deep Q1-Q3 ownership, wait, and
growth analysis.
Review contract
The quality bar is complete coverage of every changed contract, not equal depth
for every file. Read every changed hunk once, build one change/risk map, and
route deep analysis only to applicable closures. This is not spot checking:
every lens must map to a closure or have a concrete not-applicable reason.
Keep two execution modes distinct:
| Mode |
Responsibility |
| Self/delivery review |
May fix in-scope code; must close blockers and ensure required evidence exists before push/PR update. |
| External PR review |
Review read-only by default. Verify and reuse qualifying author/CI evidence; run only missing or contradiction-resolving checks. Report the decision, but submit GitHub APPROVE/REQUEST_CHANGES only when the user authorized that external mutation. |
An explicit developer decision closes a subjective tradeoff when its assumptions
and rationale are recorded. Do not repeatedly relitigate it without materially
new evidence. It does not erase a demonstrated correctness/security/data/hang/
leak/compatibility failure or a mandatory user/repository gate. The PR author or
reviewer cannot self-waive such a gate; only its policy owner can explicitly
change an allowed exception, with owner/scope/rationale recorded. User/system
permission boundaries cannot be waived.
A blocker requires either a concrete failure path (input/state -> consequence)
or an objectively missing mandatory artifact/validation. Preferences, plausible
concerns, maintainability suggestions, and micro-nits are non-blocking or
omitted. Assign severity only after the finding is verified.
Resolve target and scope
| Args |
Target |
| (empty) |
current branch vs verified PR base when one exists; otherwise a freshly verified remote default branch |
git ref / vs <ref> / base=<ref> |
current branch vs the explicit ref |
| all digits |
that GitHub PR vs its declared base |
<ref> <scope...> |
explicit base with trailing focus |
| anything else |
focus text with verified default base |
docs / help |
show the workflow only |
Resolve explicit user base, then PR base, then fresh remote default. Never
silently use stale local main. Record base ref/object, head object, merge-base,
committed range, staged/unstaged changes, and untracked files. Report freshness
limits when the remote cannot be verified. A focus narrows presentation and
deep tracing, not awareness of in-scope changes that can interact with it.
Resource map
Single-pass execution
- Resolve and inventory. Establish the exact scope above. Inspect status,
diff stat/name-status, generated/delivery artifacts, then read every changed
hunk once.
- Build the change map. Group files into behavioral closures; record
invariant/purpose, owner/consumers, reverse arcs, R0-R3 triggers, applicable
lenses, and required evidence. Reuse this map instead of rereading the whole
diff once per lens.
- Run the design gate first. Classify the complete feature/refactor or PR
series. Ordinary fixes/maintenance are exempt. When triggered, review the
exact approved design revision before implementation. Missing/unapproved or
failed design makes the decision
REQUEST_CHANGES and short-circuits full
implementation polishing.
- Trace applicable closures. For each map row, follow edited code into the
first owner, all changed consumers/reverse arcs, and terminal success/failure
nodes. Apply the lenses below. R0/R1 does not pay R3 modeling cost; any small
R3 closure does.
- Audit evidence. Check selection, mode, revision, terminal status, and
semantic freshness. Reuse valid exact-head author/CI evidence. In self mode,
produce missing proof; in external mode, run only gaps or checks needed to
resolve a concrete uncertainty.
- Converge once. Verify every candidate against source and full closure,
discard speculation, respect recorded decisions, then return one ranked
finding/fix-or-decision list and final decision. Do not request another broad
review pass.
If an optional code-review workflow is available, it may help discover
candidates from the same resolved range. Its output does not replace the change
map, closure verification, evidence audit, or final severity calibration.
Review lenses
Classify every lens for every mapped closure. Group rows that share the same
applicability and reason instead of emitting a prose Cartesian product. N/A
needs a fact such as “no executable behavior or generated consumer changed,”
not “diff is small.”
| Lens |
Question |
| Correctness/boundaries |
Does the invariant hold for ordinary and reachable zero/empty/nil/boundary/invalid inputs? |
| Contract/consumers |
Are callers, readers, receivers, interfaces, generated artifacts, and public error/result semantics aligned? |
| State/concurrency |
Are transitions, linearization, shared ownership, stale generations, races, and exactly-once side effects defined? |
| Control/liveness |
Can cancel/close/reject/timeout terminate independently of the work it controls? |
| Resource lifecycle |
Does each resource have one effective cleanup owner on success, partial failure, cancel, panic, reset, and reuse? |
| Boundedness/scale |
Are queues, retries, caches, retained state, logs/metrics, memory/disk/FDs, and work admission bounded? |
| Compatibility/security |
Are API/wire/disk/catalog/config, mixed-version/migration/rollback, auth, tenant, and trust boundaries preserved? |
| Performance/operations |
Did hot-path work, allocations, I/O, synchronization, startup, capacity, rollout, observability, or blast radius change materially? |
| Platform/delivery |
Are build tags, OS/arch, CGo/native loading, generated files, packaging, and final committed artifacts correct? |
| Test architecture |
Do tests prove distinct contracts with minimum deterministic data/setup, correct UT/BVT layer, isolation, cleanup, and real selection? |
First-principles finding proof
Do not report “might.” For each candidate:
- State the invariant and concrete reachable input/state.
- Follow all guards, ownership transfers, defer/cancel/timer/retry/release paths.
- Identify the wrong result, crash, hang, data/security/compatibility impact, or
exactly missing required proof.
- Re-read the cited source after forming the hypothesis.
- Keep it only if no existing path closes the failure; calibrate severity last.
The design-first gate is an artifact/decision proof rather than a runtime
counterexample: cite the exact trigger and missing/unresolved design requirement.
Functional and unhappy-path closure
Trace only applicable arcs, but trace them to terminal nodes:
| Change |
Minimum closure |
| persistence/format |
create/write -> read -> backup/restore -> upgrade/restart |
| operator/pipeline |
prepare -> call/send -> receive -> reset/cleanup -> error/cancel |
| resource/state machine |
create/admit -> transfer/transitions -> fail/retry -> close/reuse generation |
| config/API/protocol |
parse/default -> producer -> every consumer -> compatibility/fallback |
| shared test fixture |
create -> scenario admission -> cleanup after FailNow -> reset -> next scenario -> destroy |
| BVT |
clean/readiness -> public action -> positive/negative oracle -> restore/teardown -> same-instance rerun |
For touched resources, waits, or accumulating state, use unhappy-path-audit:
- Q1: every creation reaches exactly one effective destruction owner;
- Q2: every wait-for chain reaches guaranteed release/cancel/bound;
- Q3: every accumulation has a capacity/admission/recycle/terminal bound.
Apply its full-graph, can-fail/block, bound/release, line-reread, and
calibrate-last filters. Do not load or run the deep audit for a closure that has
no resource, wait, asynchronous generation, or growth dimension.
Test and evidence gate
Use the testing contract for purpose, orthogonality, fixture cost, BVT, and
cleanup. Use the validation/evidence reference for R0-R3 depth and semantic
evidence reuse; load the race reference only when its trigger applies.
Non-negotiable outcomes:
- changed behavior maps to the cheapest focused oracle and to BVT when a public
SQL/protocol contract requires it;
- new/heavy fixtures demonstrate existing-case search, a distinct isolation or
topology need, minimum data, deterministic control, and measured cost when
unavoidable;
- merged/deleted cases map every prior positive/negative/boundary/metadata/
privilege/session/error oracle to a retained named scenario;
- sleeps, retries, probabilistic scheduling, huge data, repeated processes, and
generated-result acceptance never substitute for injection, barriers, scoped
configuration, cleanup, or normal comparison;
- race/package/topology/repetition evidence is required only by its mapped risk
trigger, but cannot be skipped when that trigger applies.
Evidence remains valid across unrelated edits. Invalidate and rerun only when a
relevant semantic input, oracle, fixture, build mode/tag, dependency, topology,
or base-side contract changed; ambiguity means stale. Pending, skipped, zero-test,
partial-output, or surviving-process runs are not green.
Convergence and decision
- Record accepted tradeoffs and every won't-fix/known gap with owner/rationale.
Reopen only with materially new evidence that invalidates its assumptions.
- Fix harmless local nits silently in self mode or omit them in external mode.
Do not spend reviewer cycles on style that automation can decide.
- An upstream design/range/artifact blocker may stop downstream review. For code
findings, complete the other applicable mapped closures so one review returns
the converged blocker set rather than serial surprises.
- Final external decision is
REQUEST_CHANGES when any blocker remains,
otherwise APPROVE/no-blocker recommendation. Perform the GitHub mutation only
when authorized.
Exit gate
□ exact range plus committed/staged/unstaged/untracked scope recorded
□ every changed hunk read and represented in one R0-R3 change map
□ every lens mapped to a closure or a concrete N/A reason
□ design gate classified; triggered design approved and implementation aligned
□ applicable owners/consumers/reverse arcs and terminal unhappy paths closed
□ Q1-Q3 and concurrency/generation models completed only where triggered
□ UT/BVT/fixture/oracle decisions complete where behavior/tests changed
□ required evidence validly reused or passed; stale/missing/pending proof explicit
□ each finding has a concrete path or objective gate failure and source re-read
□ decisions logged, severity calibrated last, zero unresolved blockers for PASS
□ final delivery diff/generated artifacts checked in self mode
For index-plugin changes, additionally run the linked section-9 candidate
searches and prove hook interfaces, registration/build tags, ISCP/CDC where
applicable, CPU-runnable tests, and public-path behavior. Candidate greps are not
standalone findings.
1---2name: mo-self-review3description: Review MatrixOne changes before push or as an external PR reviewer using one complete change map, design-first gates, risk-routed first-principles analysis, functional/unhappy-path closure, and reusable validation evidence. Use for pre-push review, PR/deep review, concurrency/lifecycle changes, test-quality changes, or repeated review-loop reduction.4---56Compatibility: designed for Codex CLI and compatible agents with a MatrixOne7git working tree. Use `unhappy-path-audit` for deep Q1-Q3 ownership, wait, and8growth analysis.910## Review contract1112The quality bar is complete coverage of every changed contract, not equal depth13for every file. Read every changed hunk once, build one change/risk map, and14route deep analysis only to applicable closures. This is not spot checking:15every lens must map to a closure or have a concrete not-applicable reason.1617Keep two execution modes distinct:1819| Mode | Responsibility |20|---|---|21| **Self/delivery review** | May fix in-scope code; must close blockers and ensure required evidence exists before push/PR update. |22| **External PR review** | Review read-only by default. Verify and reuse qualifying author/CI evidence; run only missing or contradiction-resolving checks. Report the decision, but submit GitHub `APPROVE`/`REQUEST_CHANGES` only when the user authorized that external mutation. |2324An explicit developer decision closes a subjective tradeoff when its assumptions25and rationale are recorded. Do not repeatedly relitigate it without materially26new evidence. It does not erase a demonstrated correctness/security/data/hang/27leak/compatibility failure or a mandatory user/repository gate. The PR author or28reviewer cannot self-waive such a gate; only its policy owner can explicitly29change an allowed exception, with owner/scope/rationale recorded. User/system30permission boundaries cannot be waived.3132A blocker requires either a concrete failure path (`input/state -> consequence`)33or an objectively missing mandatory artifact/validation. Preferences, plausible34concerns, maintainability suggestions, and micro-nits are non-blocking or35omitted. Assign severity only after the finding is verified.3637## Resolve target and scope3839| Args | Target |40|---|---|41| *(empty)* | current branch vs verified PR base when one exists; otherwise a freshly verified remote default branch |42| git ref / `vs <ref>` / `base=<ref>` | current branch vs the explicit ref |43| all digits | that GitHub PR vs its declared base |44| `<ref> <scope...>` | explicit base with trailing focus |45| anything else | focus text with verified default base |46| `docs` / `help` | show the workflow only |4748Resolve explicit user base, then PR base, then fresh remote default. Never49silently use stale local `main`. Record base ref/object, head object, merge-base,50committed range, staged/unstaged changes, and untracked files. Report freshness51limits when the remote cannot be verified. A focus narrows presentation and52deep tracing, not awareness of in-scope changes that can interact with it.5354## Resource map5556| Trigger | Read |57|---|---|58| Every non-trivial review: change map, R0-R3 routing, evidence reuse, efficient validation | [../mo-dev/references/validation-evidence.md](../mo-dev/references/validation-evidence.md) |59| Credible shared-state/lifecycle/synchronization/timing failure mode | [../mo-dev/references/race-validation.md](../mo-dev/references/race-validation.md) |60| Large/complex feature or major refactor; design document (RFC optional) | [../mo-dev/references/feature-design-review.md](../mo-dev/references/feature-design-review.md) |61| Shared state, cancel/close, callbacks, retry/restart, pooling/reuse, async cleanup | [references/concurrency-lifecycle.md](references/concurrency-lifecycle.md) |62| Production behavior or changed/added/removed/merged/optimized UT/BVT | [../mo-dev/references/testing-contract.md](../mo-dev/references/testing-contract.md) |63| Index algorithm dispatch/plugin/registry/ISCP paths | [../mo-dev/references/index-plugin.md#9-reviewing-an-index-plugin-change](../mo-dev/references/index-plugin.md#9-reviewing-an-index-plugin-change) |6465## Single-pass execution66671. **Resolve and inventory.** Establish the exact scope above. Inspect status,68 diff stat/name-status, generated/delivery artifacts, then read every changed69 hunk once.702. **Build the change map.** Group files into behavioral closures; record71 invariant/purpose, owner/consumers, reverse arcs, R0-R3 triggers, applicable72 lenses, and required evidence. Reuse this map instead of rereading the whole73 diff once per lens.743. **Run the design gate first.** Classify the complete feature/refactor or PR75 series. Ordinary fixes/maintenance are exempt. When triggered, review the76 exact approved design revision before implementation. Missing/unapproved or77 failed design makes the decision `REQUEST_CHANGES` and short-circuits full78 implementation polishing.794. **Trace applicable closures.** For each map row, follow edited code into the80 first owner, all changed consumers/reverse arcs, and terminal success/failure81 nodes. Apply the lenses below. R0/R1 does not pay R3 modeling cost; any small82 R3 closure does.835. **Audit evidence.** Check selection, mode, revision, terminal status, and84 semantic freshness. Reuse valid exact-head author/CI evidence. In self mode,85 produce missing proof; in external mode, run only gaps or checks needed to86 resolve a concrete uncertainty.876. **Converge once.** Verify every candidate against source and full closure,88 discard speculation, respect recorded decisions, then return one ranked89 finding/fix-or-decision list and final decision. Do not request another broad90 review pass.9192If an optional code-review workflow is available, it may help discover93candidates from the same resolved range. Its output does not replace the change94map, closure verification, evidence audit, or final severity calibration.9596## Review lenses9798Classify every lens for every mapped closure. Group rows that share the same99applicability and reason instead of emitting a prose Cartesian product. `N/A`100needs a fact such as “no executable behavior or generated consumer changed,”101not “diff is small.”102103| Lens | Question |104|---|---|105| Correctness/boundaries | Does the invariant hold for ordinary and reachable zero/empty/nil/boundary/invalid inputs? |106| Contract/consumers | Are callers, readers, receivers, interfaces, generated artifacts, and public error/result semantics aligned? |107| State/concurrency | Are transitions, linearization, shared ownership, stale generations, races, and exactly-once side effects defined? |108| Control/liveness | Can cancel/close/reject/timeout terminate independently of the work it controls? |109| Resource lifecycle | Does each resource have one effective cleanup owner on success, partial failure, cancel, panic, reset, and reuse? |110| Boundedness/scale | Are queues, retries, caches, retained state, logs/metrics, memory/disk/FDs, and work admission bounded? |111| Compatibility/security | Are API/wire/disk/catalog/config, mixed-version/migration/rollback, auth, tenant, and trust boundaries preserved? |112| Performance/operations | Did hot-path work, allocations, I/O, synchronization, startup, capacity, rollout, observability, or blast radius change materially? |113| Platform/delivery | Are build tags, OS/arch, CGo/native loading, generated files, packaging, and final committed artifacts correct? |114| Test architecture | Do tests prove distinct contracts with minimum deterministic data/setup, correct UT/BVT layer, isolation, cleanup, and real selection? |115116## First-principles finding proof117118Do not report “might.” For each candidate:1191201. State the invariant and concrete reachable input/state.1212. Follow all guards, ownership transfers, defer/cancel/timer/retry/release paths.1223. Identify the wrong result, crash, hang, data/security/compatibility impact, or123 exactly missing required proof.1244. Re-read the cited source after forming the hypothesis.1255. Keep it only if no existing path closes the failure; calibrate severity last.126127The design-first gate is an artifact/decision proof rather than a runtime128counterexample: cite the exact trigger and missing/unresolved design requirement.129130## Functional and unhappy-path closure131132Trace only applicable arcs, but trace them to terminal nodes:133134| Change | Minimum closure |135|---|---|136| persistence/format | create/write -> read -> backup/restore -> upgrade/restart |137| operator/pipeline | prepare -> call/send -> receive -> reset/cleanup -> error/cancel |138| resource/state machine | create/admit -> transfer/transitions -> fail/retry -> close/reuse generation |139| config/API/protocol | parse/default -> producer -> every consumer -> compatibility/fallback |140| shared test fixture | create -> scenario admission -> cleanup after `FailNow` -> reset -> next scenario -> destroy |141| BVT | clean/readiness -> public action -> positive/negative oracle -> restore/teardown -> same-instance rerun |142143For touched resources, waits, or accumulating state, use `unhappy-path-audit`:144145- **Q1:** every creation reaches exactly one effective destruction owner;146- **Q2:** every wait-for chain reaches guaranteed release/cancel/bound;147- **Q3:** every accumulation has a capacity/admission/recycle/terminal bound.148149Apply its full-graph, can-fail/block, bound/release, line-reread, and150calibrate-last filters. Do not load or run the deep audit for a closure that has151no resource, wait, asynchronous generation, or growth dimension.152153## Test and evidence gate154155Use the testing contract for purpose, orthogonality, fixture cost, BVT, and156cleanup. Use the validation/evidence reference for R0-R3 depth and semantic157evidence reuse; load the race reference only when its trigger applies.158159Non-negotiable outcomes:160161- changed behavior maps to the cheapest focused oracle and to BVT when a public162 SQL/protocol contract requires it;163- new/heavy fixtures demonstrate existing-case search, a distinct isolation or164 topology need, minimum data, deterministic control, and measured cost when165 unavoidable;166- merged/deleted cases map every prior positive/negative/boundary/metadata/167 privilege/session/error oracle to a retained named scenario;168- sleeps, retries, probabilistic scheduling, huge data, repeated processes, and169 generated-result acceptance never substitute for injection, barriers, scoped170 configuration, cleanup, or normal comparison;171- race/package/topology/repetition evidence is required only by its mapped risk172 trigger, but cannot be skipped when that trigger applies.173174Evidence remains valid across unrelated edits. Invalidate and rerun only when a175relevant semantic input, oracle, fixture, build mode/tag, dependency, topology,176or base-side contract changed; ambiguity means stale. Pending, skipped, zero-test,177partial-output, or surviving-process runs are not green.178179## Convergence and decision180181- Record accepted tradeoffs and every won't-fix/known gap with owner/rationale.182 Reopen only with materially new evidence that invalidates its assumptions.183- Fix harmless local nits silently in self mode or omit them in external mode.184 Do not spend reviewer cycles on style that automation can decide.185- An upstream design/range/artifact blocker may stop downstream review. For code186 findings, complete the other applicable mapped closures so one review returns187 the converged blocker set rather than serial surprises.188- Final external decision is `REQUEST_CHANGES` when any blocker remains,189 otherwise `APPROVE`/no-blocker recommendation. Perform the GitHub mutation only190 when authorized.191192## Exit gate193194```text195□ exact range plus committed/staged/unstaged/untracked scope recorded196□ every changed hunk read and represented in one R0-R3 change map197□ every lens mapped to a closure or a concrete N/A reason198□ design gate classified; triggered design approved and implementation aligned199□ applicable owners/consumers/reverse arcs and terminal unhappy paths closed200□ Q1-Q3 and concurrency/generation models completed only where triggered201□ UT/BVT/fixture/oracle decisions complete where behavior/tests changed202□ required evidence validly reused or passed; stale/missing/pending proof explicit203□ each finding has a concrete path or objective gate failure and source re-read204□ decisions logged, severity calibrated last, zero unresolved blockers for PASS205□ final delivery diff/generated artifacts checked in self mode206```207208For index-plugin changes, additionally run the linked section-9 candidate209searches and prove hook interfaces, registration/build tags, ISCP/CDC where210applicable, CPU-runnable tests, and public-path behavior. Candidate greps are not211standalone findings.