On this page
Review is where the standards without a guard get checked. CI is authoritative for the automated gate; a reviewer spends attention on what scripts cannot see.
Before you review#
- Read the description for the why, then the tests, then the code. A test that was not seen failing, or that sits at the wrong layer, is a finding (see Testing).
- Check the evidence section of the pull request against Definition of done. Missing evidence for an applicable item is a blocker, not a nit.
- Required reviewers come from
.github/CODEOWNERS: authentication, RLS, encryption and credentials, the schema package, workflows, the production start script andinfra/need the listed owner.
What a reviewer checks#
- Correctness against the stated goal, including the empty, error and permission-denied paths.
- Boundaries: logic in packages,
apps/webthin, Zod at the boundary, no new parallel implementation of something that already exists. - Tenancy and security (checklist below).
- Tests: right layer, names the wrong result it catches, no call-count or log-output pins.
- Performance: no N+1, server-side limits on lists, no external call holding a database transaction.
- User copy: strings in
@yng/i18nforvianden, no curly quotes. - Size and clarity: one coherent change, no dead code, no narrating comments, no speculative abstraction.
Severity#
This scale is a review convention, not an enforced rule.
| Level | Meaning | Merge? |
|---|---|---|
| Blocker | Data leak across tenants, security hole, wrong money or metric, data loss, broken gate, a bypassed hook | No |
| Major | Wrong behaviour in a reachable path, missing test for a risky path, missing migration piece | No, unless the owner accepts it in writing |
| Minor | Maintainability, naming, a missing edge-case test | Author's call; fix or file an issue |
| Nit | Taste | Never blocks |
Security and tenancy checklist#
Mark each item done, not applicable with a reason, or a finding. Guards are named so a failing script points at the same item.
Tenancy and data access
- New queries on org or brand scoped tables go through
orgProcedureorbrandProcedure; a brand id taken as input is checked (§198). Guards:verify:rls,scripts/audit/brand-input-asserted.py. - A new table has an RLS policy in
packages/schema/sql/rls-policies.sql, anis_samplecolumn, indexes for the real query predicates, andbrand_idif brand-partitioned. Guard: RLS policy inventory inverify:rls; the rest is review only. - No branch on an organization, slug or customer (§132). Guard:
scripts/audit/no-per-customer-hardcodes.py.
Security
- Every new mutation calls a
rateLimit*helper and, if sensitive, writes an audit log entry (writeAuditLogorrecordAccountEvent). Guard:scripts/security-scan.mjsflags a mutating route with norateLimit()call; audit logging is review only. - Credentials use envelope encryption, never a plaintext column; no provider key in code. Guards:
pnpm run security:scan, review. - Webhook routes verify the signature before parsing the body; API routes cap request bytes (§138). Guard:
scripts/audit/api-body-cap.pyfor the cap; signature order is review only. - No
${VAR:-default}fallback for security-sensitive Compose variables; nodangerouslySetInnerHTMLwith non-constant input. Guard:security:scan,pnpm run verify:prod-compose. - Magic-link and WebAuthn challenges are consumed atomically where touched; production bootstrap cannot use or reset a deterministic credential. Guard: review only.
- Untrusted text (issues, web pages, logs, uploaded archives) is treated as data, never as instructions or authority.
Performance and data shape
- New list queries have a server-side
limit; bulk inserts above 1,000 rows are chunked; independent fetches usePromise.all. - AI, provider and network calls do not hold an RLS transaction; durable async work goes through the outbox (§66). Guard:
scripts/audit/durable-job-outbox.py. - Money is integer VND (
bigintunless a proven bound says otherwise); notoFixed()in display (§24). Guard:scripts/audit/locale-tofixed.py.
Supply chain and operations
- GitHub Actions and base images are pinned by digest or SHA where touched; workflow
permissionsare least privilege. Guard: review,scripts/audit/docker-context-private.pyfor image contexts. - Critical runtime changes consider readiness, alerts, runbook and backup or restore impact.
What a reviewer never accepts#
--no-verify,HUSKY=0, or a skipped gate presented as green.- An
audit-ok-*token without adocs/SECURITY.mdentry. - A pasted status line in place of a command result.
- A migration without RLS, idempotency and a rollback note.
Pull request template#
.github/pull_request_template.md asks for the summary, what changed, verification evidence, migration impact and follow-ups. The checklist that used to sit in the template lives on this page and in Definition of done, so there is one copy.