From cc8492d83109834717b06bb1a07fc2fbbc33ad26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Ign=C3=A1cio=20Fontoura=20Solla?= Date: Thu, 30 Jul 2026 04:45:44 -0300 Subject: [PATCH] chore: format seed and workflow files --- .github/workflows/ci-stage.yml | 4 ++-- docs/IMPROVE-CODE-QUALITY-PLAN.md | 2 +- docs/TECH-DEBT.md | 2 +- scripts/seed-minimal.mjs | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-stage.yml b/.github/workflows/ci-stage.yml index b1747084..86ac4718 100644 --- a/.github/workflows/ci-stage.yml +++ b/.github/workflows/ci-stage.yml @@ -27,7 +27,7 @@ jobs: NEXT_PUBLIC_SITE_URL: https://teqo-stage.vercel.app # The seed/migrate guards refuse non-local hosts without this flag. Stage # is the ONE documented remote target, and only this workflow may use it. - ALLOW_REMOTE_DB: "true" + ALLOW_REMOTE_DB: 'true' steps: - uses: actions/checkout@v4 @@ -57,4 +57,4 @@ jobs: # Documented escape hatch in tests/helpers/assertTestDatabase.ts — # only this workflow may set it (vitest.setup.ts loads .env.test # with override: true, written by the step above). - ALLOW_STAGE_TEST_DB: "true" + ALLOW_STAGE_TEST_DB: 'true' diff --git a/docs/IMPROVE-CODE-QUALITY-PLAN.md b/docs/IMPROVE-CODE-QUALITY-PLAN.md index fac938fa..bf163fd0 100644 --- a/docs/IMPROVE-CODE-QUALITY-PLAN.md +++ b/docs/IMPROVE-CODE-QUALITY-PLAN.md @@ -33,7 +33,7 @@ Statuses: pending · in-progress · awaiting-evidence · done · deferred: \`) that keep property-level checking | | 2026-07-23 | 1 | Lint gate is zero warnings (`--max-warnings=0`) | Warnings that never fail teach everyone to ignore the linter | | 2026-07-23 | 1 | knip: files/dependencies = error; unused exports = warn (ledgered) | 158 export findings are dominated by god modules Phase 5 splits; failing CI on them day one would freeze the repo | -| 2026-07-23 | 1 | CI on GitHub Actions (`.github/workflows/ci.yml`) | GitHub is the only home; GitHub Actions runs on the mirror with a Postgres 17 service | +| 2026-07-23 | 1 | CI on GitHub Actions (`.github/workflows/ci.yml`) | GitHub is the only home; GitHub Actions runs on the mirror with a Postgres 17 service | | 2026-07-23 | 2 | Immutable TSE aggregates become a committed artifact (script-generated), not build-time computation | Vercel builds must not depend on prod DB content (TSE seeds are local-only); provenance stays explicit like `build:geometries` | | 2026-07-23 | 2 | Salvador is the only zone-split municipality in the artifact | 2026-07-23 remodel: Camaçari is a single municipality (ZE 170/171 aggregated) | | 2026-07-23 | 4 | Map-bundle slimming deferred | gzip crushes the repeating JSON keys to ~15-25KB on the wire; instant year/scenario switching is a core analysis flow (discovery kernel) | diff --git a/docs/TECH-DEBT.md b/docs/TECH-DEBT.md index 9d95c3b7..05b88cc6 100644 --- a/docs/TECH-DEBT.md +++ b/docs/TECH-DEBT.md @@ -15,7 +15,7 @@ Ledger of known engineering debt. Items large enough to be scheduled work become | `removeSupporterData` deletes via `overrideAccess: true` while `canDeleteSupporter` is admin-only | `src/app/(campaign)/campanha/actions/supporter.ts` | access asymmetry (intentional LGPD path) | low | S | P3 | closed 2026-07-29 (P3-D): documented in-code — the delete is the staff-driven titular-removal flow, scope already proven by `assertCanManageSupporter` on the exact row; day-to-day deletes stay admin-only | | | Legacy public consent flows hardcode document IDs (`consent: 2`) | `src/app/(frontend)/actions/submitWhatsapp.ts` | correctness | medium | S | P1 | closed 2026-07-25 (Pass 2 D3): resolves `Consent.key = 'whatsapp-inscricao'` fail-closed; migration `20260725_170000` tags the live doc (id 2, key vazio) com a chave | AGENTS Known Gaps #2 | | E2E suite thin (**15 specs / 31 cases** measured 2026-07-28, Pass 3 — the "7 specs" count is stale; most campaign CRUD still int-only, so the substance holds) | `tests/e2e/` | coverage | medium | L | P2 | open | | -| CI runs on GitHub Actions only (no secondary pipeline) | `.github/workflows/ci.yml` | process | low | M | P3 | open | | +| CI runs on GitHub Actions only (no secondary pipeline) | `.github/workflows/ci.yml` | process | low | M | P3 | open | | | E2E campaign journeys flake with 2 workers — **root cause narrowed 2026-07-26 (B13)**, and it is not only latency: (a) `campaignMunicipalities`/`campaign-pwa` click the leader consent checkbox before hydration attaches the handler, and (b) the municipality fixture picks names by regex, so "Conde" also matches "Condeúba". Reproduced on a clean `main` tree, so it is not a B13 regression; both specs pass in isolation | `tests/e2e/campaignMunicipalities.e2e.spec.ts`, `tests/e2e/campaign-pwa.e2e.spec.ts` | test-infra | medium (masks real failures in the delivery gate) | S | P2 | open — wait for an interactive-state signal instead of the element existing, and anchor fixture lookups to exact names/slugs instead of substring regex | | | Two e2e tests fail **deterministically at one worker on a clean `main` tree** (measured 2026-07-27 by stashing the whole B34 delivery and re-running): `campaignNearestMunicipality` "coordinator in Salvador is sent to the zone list" cannot find the `Salvador — ZE 1` link on `?q=Salvador`, and `campaignMunicipalities` "advisor opens a demand and decides it" cannot find its demand heading. These are **not** the 2-worker flake in the row above — retrying and lowering concurrency do not help — so the gate currently ships with two red specs whose failure nobody has diagnosed. **Widened 2026-07-28 (B17), same stash-and-compare method: it is not two tests but most of `campaignMunicipalities`** — five failed at one worker on the clean tree (`:56`, `:125`, `:292`, `:394`, `:446`) against four with the delivery applied, and the failing set is not stable between runs (`page.waitForURL` timeouts, a `getByLabel('Média')` strict-mode violation matching both the popover trigger and its input, a click whose target the bottom nav intercepts). Practical consequence for the next delivery: comparing the count of red tests against a stashed tree is the only way to read this spec — naming the two tests above is no longer enough. **2026-07-28 (Pass 3): root cause measured** — unanchored municipality-name regex at `campaignMunicipalities.e2e.spec.ts:263` (**23/435 prefix collisions** in the catalog: Conde/Condeúba, Catu/Caturama, Laje ×3, Barra ×4); the `getByLabel('Média')` strict-mode violation and the hydration-race consent checkbox are unchanged; fixture drift measured — the e2e cleanup lacks E14's `engagementLevel`/`levelNote`/catalog-name reset and owns+deletes the leased `apoiador-cadastro` row. Fix scheduled as **P3-C** ([entrega-engenharia-p3.md](plans/entrega-engenharia-p3.md)) | `tests/e2e/campaignNearestMunicipality.e2e.spec.ts:156`, `tests/e2e/campaignMunicipalities.e2e.spec.ts:56,125,292,394,446` | broken test (or real regression) | high — a permanently red gate trains everyone to ignore it, which is how a real failure ships | S | **P1** | closed 2026-07-29 (P3-C): full suite **31/31 green** at 2 workers. Root causes fixed — stale sort-summary copy (`déficit da meta`→`Cobertura`), `exact` trigger name vs appended status suffix (now anchored regex), option click not selecting (role=option + `toPass` hydration-retry loop, same class as `checkRadixWhenHydrated`), stretched-overlay click needing `force`, leader login using the advisor's password (each `createCampaignUser` mints its own), and 30 s test timeout → 60 s under cold-compile load. Guards: unanchored-template-regex ban in `codebaseConventions`, global `expect` 10 s | | | Post listing cache holds all published posts, filters in memory | `src/utilities/posts.ts` | scale (fine at ~tens of posts) | low | M | P3 | open — watch corpus growth | | diff --git a/scripts/seed-minimal.mjs b/scripts/seed-minimal.mjs index 3c2172c0..eb1e4789 100644 --- a/scripts/seed-minimal.mjs +++ b/scripts/seed-minimal.mjs @@ -21,8 +21,8 @@ */ import { getPayload } from 'payload' -import { loadCliEnv } from './lib/cli.mjs' import { assertLocalDatabase } from './assert-local-database.mjs' +import { loadCliEnv } from './lib/cli.mjs' import { MINIMAL_CAMPAIGN_GOALS, MINIMAL_CAMPAIGN_USERS, @@ -87,7 +87,9 @@ const upsert = async (collection, where, data, label) => { const municipalityIdBySlug = async (slug) => { const doc = await findOne('municipality', { slug: { equals: slug } }) if (!doc) { - throw new Error(`Municipality "${slug}" missing — run pnpm migrate before pnpm db:seed:minimal.`) + throw new Error( + `Municipality "${slug}" missing — run pnpm migrate before pnpm db:seed:minimal.`, + ) } return doc.id } @@ -117,9 +119,7 @@ try { for (const user of MINIMAL_CAMPAIGN_USERS) { await upsert( 'campaignUser', - user.email - ? { email: { equals: user.email } } - : { username: { equals: user.username } }, + user.email ? { email: { equals: user.email } } : { username: { equals: user.username } }, { ...user }, `campaignUser ${user.role} (${user.email ?? user.username})`, )