Remap GUARDRAILS.md to public issue numbers (#48/#49/#50/#54), remove the slug argument from getMunicipality(), expand the sheet-host guard to all variant=sheet surfaces, and pin WebAuthn call-site order.
10 KiB
Guardrails
Ledger dos guardrails determinísticos colhidos de kind:agent-miss (fluxo pnpm agent:file-miss → harvest no engineering-audit → guarda programática) e dos endurecimentos de guarda existentes. Uma linha por guarda: origem, classe na escada de determinismo, mecanismo, status.
Classes (escada do Pass 3 D6 / skill engineering-audit passo 4b): 1 tipo (estado ruim irrepresentável) · 2 ESLint · 3 spec de convenção · 4 análise estática em CI (knip/madge) · 5 pin comportamental · 6 doc/convenção (judgment-only declarado — não fingir que doc é guarda).
Provenance (Pass 5, 2026-08-02): o reopen público remapeou Issues do archive — #52→#48, #53→#49, #54→#50, #73→#54. As guardas abaixo citam os números públicos; PRs do Pass 4 (#91–#95) seguem como origem histórica do código.
Ativos
| Guarda | Origem | Classe | Mecanismo | Status |
|---|---|---|---|---|
agent:ship exige stamp de /simplify casado com HEAD; PR Ready + auto-merge + watch até MERGED |
#83 | 3 (script + hooks) | scripts/agent-ship.mjs, .cursor/hooks/guard-pr-create.mjs, .cursor/hooks/pr-merge-watchdog.mjs |
vivo desde 2026-07-31 (PR #89) |
Alocador de municípios em specs — sem slug fixo + mutação; sem municipio=<slug> em e2e; regex de nome ancorada |
#54 (archive #73) | 1 + 3 | getMunicipality() sem parâmetro de slug (Pass 5); tests/unit/testMunicipalityAllocatorConventions.unit.spec.ts |
vivo Pass 4; endurecido Pass 5 (tipo) |
Sheet compartilhada — variant="sheet" exige provider ou leaf allowlist |
#48 (archive #52) | 3 + 5 | tests/unit/sharedSheetHostConventions.unit.spec.ts; invariante dev em CampaignCellEditOverlay |
vivo Pass 4; endurecido Pass 5 (sheet variant + allowlist) |
| Navegação e2e assentada — goto→goto sem settle falha o build | #50 (archive #54) | 3 | tests/unit/e2eNavigationConventions.unit.spec.ts |
vivo Pass 4; provenance Pass 5 |
Readiness de autenticador virtual — expectCampaignBiometricsReady depois de addVirtualAuthenticator |
#49 (archive #53) | 3 | mesma spec (ordem das calls, Pass 5) | vivo Pass 4; endurecido Pass 5 (ordem) |
| Convenção de navegação e2e (goto = cold load; in-shell = continuidade) | #50 | 6 (judgment-only) | parágrafo em docs/TESTING.md |
vivo |
| Update de globals públicos nunca "qualquer autenticado" | P0 do Pass 4 | 3 | tests/unit/globalAccessConventions.unit.spec.ts |
vivo (PR #91) |
| Loaders de notificação tipados pelo ator | P0 adjacente do Pass 4 | 1 | assinatura (payload, user: CampaignUser) + overrideAccess: false |
vivo (PR #91) |
Die-helpers da CLI importados onde usados; DAY_MS single-source |
P1 do Pass 4 | 3 | tests/unit/scriptCliConventions.unit.spec.ts |
vivo (PR #92) |
src/lib não type-importa @/utilities/** |
dodge do Pass 3 | 2 | ESLint allowTypeImports: false na zona src/lib |
vivo (PR #92) |
Local API com user sempre declara overrideAccess; import dinâmico server banido em utilities |
Pass 4 | 3 | tests/unit/localApiOverrideAccessConventions.unit.spec.ts |
vivo (PR #92) |
Ledger docs/GUARDRAILS.md + harvest no engineering-audit |
#41 OPS2 | 6 → 3 | este arquivo + skill engineering-audit passo 0b/4b |
fechado Pass 5 (pipeline vivo desde Pass 4) |
Precedentes vivos (anteriores ao primeiro harvest)
| Guarda | Origem | Classe | Mecanismo |
|---|---|---|---|
| Vocabulário banido (Praça/Núcleo/Plano de Ação, accent-tolerant) | C13 / W4f / P3-K | 3 | codebaseConventions.unit.spec.ts |
server-only em utilities acopladas (sweep payload/next/*) |
Pass 2 W2 / P3-K | 3 | codebaseConventions.unit.spec.ts |
Escadas de formActions nos wrappers (runCampaignFormAction/Redirect) |
W4d / C8 F4b | 3 | codebaseConventions.unit.spec.ts (filename *FormActions.ts — dodge actions/*.ts ledgerado) |
| Ratchet de bypass admin não documentado | P3-E | 3 | codebaseConventions.unit.spec.ts (por arquivo, só diminui) |
| Mensagens de recusa como constantes + correspondência throw↔safelist | P3-A | 3 | codebaseConventions.unit.spec.ts:216-263 |
as never banido |
Pass 1 | 2 | ESLint no-restricted-syntax |
src/lib não importa utilities/ (valores) |
Pass 2 W2 | 2 | ESLint no-restricted-imports |
| 0 ciclos de import | Pass 2 | 4 | madge (pnpm check:cycles) |
| Dead code (arquivos/deps/exports em erro) | Pass 2 W4b | 4 | knip em CI |
migration-lock (≤1 PR aberto tocando schema) |
agentes paralelos | 4 | job em ci-pr.yml |
PR só docs/plans/ sem Closes/Fixes/Resolves |
#116 OPS12 | 4 | scripts/lib/plansOnlyClosesGuard.mjs + job plans-only-closes em ci-pr.yml |
| Seed mínimo obrigatório com migration (contrato manifest) | OPS fluxo PR | 3 + 5 | tests/unit/seedMinimalManifest.unit.spec.ts + job CI migrate→seed→int |
| Regex de template ancorada em e2e | P3-C | 3 | codebaseConventions.unit.spec.ts (ampliada para literais no Pass 4) |
| Consent fail-closed por chave estável | D3/Onda 0 | 5 | pins int submitWhatsapp/liderança/apoiador |
Misses colhidas aguardando guarda (fila do harvest)
(nenhuma — Pass 5 fechou a fila remapeada #48/#49/#50/#54 e OPS2 #41.)