All four findings reproduced before fixing. rev-code-01 was right on each. B2 (blocker, mine). SEAT-IDENTITY provisioning step 4 said to symlink the framework store entry to the seat slot, while the same file says those bridges must not be recreated. The same bridge, told both ways, in one document. I rewrote the resolution and token-location sections when the deploy made them stale and did not carry the change into the numbered steps. Step 4 is gone and the file now says explicitly that no provisioning step links the store to the slot, so the omission cannot read as an oversight. S1 (mine). The guide claimed the helper "attempts a fleet notification" on refusal. The shipped helper does no such thing — its only reference to notification is a comment saying an alert built on the record is best-effort, and there is no send or wake call anywhere in the file. Now: it writes a durable record, the record is what exists, and nobody should wait for a notification that nothing sends. A guide that promises an alert is worse than one that promises nothing. S2. Estate-local content removed from files that ship to every estate: the ~/.mosaic/fleet/bin script paths (dead paths elsewhere) and the 2026-08-18 dates, which dated a specific host's migration rather than describing behavior. The bridge-removal passage now states the ORDERING that matters — remove bridges only after a seat-aware helper can reach the slot, never before — which is the part that transfers. B1. prettier reformatted all three files. Reproduced the pipeline 2515 failure locally before and confirmed clean after; the other three guides prettier flags are untouched by this branch (0 changes vs origin/next) and are pre-existing. Sanitization gate re-run and passing. Verified for the record, since I could not verify my own work: rev-code-01 confirmed the no-fallback claim TRUE against helper content on origin/next, and judged the evidence rules actionable on the grounds that each names an executable replacement.
9.6 KiB
Executable File
Code Review Guide
Hard Requirement
If an agent modifies source code, code review is REQUIRED before completion.
Do not mark code-change tasks done until review is completed and blockers are resolved or explicitly tracked.
If code/config/API contract/auth behavior changed and required docs are missing, this is a BLOCKER.
If tests pass but acceptance criteria are not verified by situational evidence, this is a BLOCKER.
If implementation diverges from docs/PRD.md or docs/PRD.json without PRD updates, this is a BLOCKER.
Merge strategy enforcement (HARD RULE):
- PR target for delivery is
main. - Direct pushes to
mainare prohibited. - Merge to
mainMUST be squash-only. - Use
~/.config/mosaic/tools/git/pr-merge.sh -n {PR_NUMBER} -m squash --expect-head {approved_full_sha}(or PowerShell equivalent).
An estate MAY carry a documented exception for a repository whose gates are commit hooks rather than review. Such an exception belongs in that estate's own working copy of this guide, is scoped to the named repository, and is never precedent for a second one.
Do not use pr-review.sh or issue-comment.sh to post a verdict (mosaicstack#1280). Post
through a direct authenticated API call as your own seat, or hand the verdict to the requesting
seat. Handing it over is a legitimate delivery path, not a fallback.
Evidence Discipline (applies to every finding)
The checklist below says what to look at. This section says when you are allowed to believe what you saw. Every rule here was earned by a wrong conclusion that reached a report.
- A finding is a claim about behavior. State the failing input, the path taken, and the wrong result. "This looks fragile" is not a finding.
- A green check is not a result until you have shown it could go red. Run the control. A
0, an empty result, or a column of identical values with no failing counterpart is a non-result. - Measurement and explanation are separate sentences. Report the command and its output, then, as its own sentence, what you think it means.
- Never widen the case you measured. If you checked one path, the finding covers one path.
- Reproduce a reported failure before recording it, and say which tree you measured. Two correct measurements of two different trees disagree without either being wrong.
- Verify by content on the ref that ships, never by ancestry of a local sha. A rebase mints
new shas; a commit being an ancestor of something local proves nothing about the remote.
Compare by digest against
origin/<branch>. - Confidence is part of the finding. "I could not reproduce this" is a usable review comment. A confident guess is not.
- Author is not reviewer (Gate-16). Do not review your own work, or work you shaped closely enough to be a co-author of. Say so and hand it back.
Measuring a shell suite
Each of these produced a wrong conclusion before it was written down.
cmd | tail; echo rc=$?reportstail's exit code, notcmd's. It reads as a pass when the command failed. Redirect to a file and checkrcdirectly, or use${PIPESTATUS[0]}.- Under
set -o pipefail, a missed glob makeslsexit 2, the pipeline inherits it, andset -ekills the run. Iterate a glob with aforloop and an-etest instead of pipingls. - A suite that exits nonzero with ZERO output is an environment question, not a defect in
the code under review. The usual cause is a sourced dependency that is absent, so
set -ekills the first case before anything prints. Extract whole tool trees —tools/gitalone is missingtools/_lib/credentials.sh. Isolate the variable and prove it by adding only that back. git -C <dir>in a directory that is not itself a repo answers from the enclosing repo. A scratch tree under~/.mosaicreports~/.mosaic's HEAD, not the PR's, and every conclusion drawn from it describes the wrong tree. Confirmgit rev-parse --show-toplevelis the tree you think it is before trusting any git output.
Feedback Categories
- Blocker: must fix before merge (security, bugs, test failures)
- Should Fix: important but not blocking (code quality, minor issues)
- Suggestion: optional improvement (style preference, nice-to-have)
- Question: seeking clarification
Review Checklist
Reviewer seats split this checklist by class rather than duplicating it. A seat reviews its own sections in full and may raise anything it notices outside them as a Suggestion, never as a Blocker on someone else's ground.
| Reviewer class | Owns |
|---|---|
rev-code-* |
1 Correctness, 3 Testing, 4 Code Quality, 4a TypeScript, 5 Documentation, 6 Performance, 7 Dependencies |
rev-security-* |
2 Security, 2a OWASP |
Where two seats of the same class review the same change, they review independently and compare after. A second seat that reads the first seat's findings before measuring is a proofreader, not a second opinion.
1. Correctness
- Code does what the issue/PR description says
- Code aligns with active PRD requirements
- Acceptance criteria are mapped to concrete verification evidence
- Edge cases are handled
- Error conditions are managed properly
- No obvious bugs or logic errors
2. Security
- No hardcoded secrets or credentials
- Input validation at boundaries
- SQL injection prevention (parameterized queries)
- XSS prevention (output encoding)
- Authentication/authorization checks present
- Sensitive data not logged
- Secrets follow Vault structure (see
docs/vault-secrets-structure.md)
2a. OWASP Coverage (Required)
- OWASP Top 10 categories were reviewed for change impact
- Access control checks verified on protected actions
- Cryptographic handling validated (keys, hashing, TLS assumptions)
- Injection risks reviewed for all untrusted inputs
- Security misconfiguration risks reviewed (headers, CORS, defaults)
- Dependency/component risk reviewed (known vulnerable components)
- Authentication/session flows reviewed for failure paths
- Logging/monitoring preserves detection without leaking sensitive data
3. Testing
- Tests exist for new functionality
- Tests cover happy path AND error cases
- Situational tests cover all impacted change surfaces (primary gate)
- Tests validate required behavior/outcomes, not only internal implementation details
- TDD was applied when required by
guides/QA-TESTING.md - Coverage meets 85% minimum
- Tests are readable and maintainable
- No flaky tests introduced
4. Code Quality
- Follows Google Style Guide for the language
- Functions are focused and reasonably sized
- No unnecessary complexity
- DRY - no significant duplication
- Clear naming for variables and functions
- No dead code or commented-out code
4a. TypeScript Strict Typing (see TYPESCRIPT.md)
- NO
anytypes — explicit types required everywhere - NO lazy
unknown— only for error catches with immediate narrowing - Explicit return types on all exported/public functions
- Explicit parameter types — never implicit any
- No type assertions (
as Type) — use type guards instead - No non-null assertions (
!) — use proper null handling - Interfaces for objects — not inline types
- Discriminated unions for variant types
- DTO files used at boundaries — module/API contracts are in
*.dto.ts, not inline payload types
5. Documentation
- Complex logic has explanatory comments
- Required docs updated per
guides/DOCUMENTATION.md - Public APIs are documented
- Private/internal APIs are documented
- API input/output schemas are documented
- API permissions/auth requirements are documented
- Site map updates are present when navigation changed
- README updated if needed
- Breaking changes noted
6. Performance
- No obvious N+1 queries
- No blocking operations in hot paths
- Resource cleanup (connections, file handles)
- Reasonable memory usage
7. Dependencies
- No deprecated packages
- No unnecessary new dependencies
- Dependency versions pinned appropriately
Review Process
Use ~/.config/mosaic/templates/docs/DOCUMENTATION-CHECKLIST.md whenever code/API/auth/infra changes are present.
Getting Context
# List the issue being addressed
~/.config/mosaic/tools/git/issue-list.sh -i {issue-number}
# View the changes
git diff main...HEAD
Providing Feedback
- Be specific: point to exact lines/files
- Explain WHY something is problematic
- Suggest alternatives when possible
- Distinguish between blocking issues and suggestions
- Be constructive, not critical of the person
Review Comment Format
[BLOCKER] Line 42: SQL injection vulnerability
The user input is directly interpolated into the query.
Use parameterized queries instead:
`db.query("SELECT * FROM users WHERE id = ?", [userId])`
[SUGGESTION] Line 78: Consider extracting to helper
This pattern appears in 3 places. A shared helper would reduce duplication.
After Review
- Update issue with review status
- If changes requested, assign back to author
- If approved, note approval in issue comments
- For merges, ensure CI passes first
- Merge PR to
mainwith squash strategy only