Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
147 lines
7.0 KiB
Markdown
147 lines
7.0 KiB
Markdown
---
|
|
phase: 13-real-lint-gate-eslint
|
|
plan: "03"
|
|
subsystem: lint-gate
|
|
tags: [prettier, reformat, ci, format-check, baseline-green]
|
|
dependency_graph:
|
|
requires: [13-02]
|
|
provides: [format-clean-baseline, ci-format-check-step]
|
|
affects: [ci-fast-checks-job]
|
|
tech_stack:
|
|
added: []
|
|
patterns:
|
|
- Prettier isolated reformat commit (D-13-08) — mechanical diff separate from logic fixes
|
|
- CI step insertion after Lint — name/run idiom matching existing steps
|
|
key_files:
|
|
created: []
|
|
modified:
|
|
- .gitea/workflows/ci.yml
|
|
- apps/api/src/** (398 files total reformatted)
|
|
- apps/pwa/src/**
|
|
- apps/api/tests/**
|
|
- apps/pwa/e2e/**
|
|
decisions:
|
|
- "D-13-08 honored: reformat is one isolated commit (982438d) separate from Plan 02 logic fixes"
|
|
- ".planning/** and .claude/** reformatted together with source files — .prettierignore does not exclude them, consistent with full-repo reformat intent"
|
|
- "API integration test one-timeout (toggling isShared false→true re-populates list_shares) documented as pre-existing intermittent; not a regression from the reformat (logic unchanged, same timeout as Plan 02)"
|
|
metrics:
|
|
duration_minutes: 10
|
|
completed: "2026-06-12"
|
|
tasks_completed: 3
|
|
files_modified: 399
|
|
---
|
|
|
|
# Phase 13 Plan 03: Prettier Reformat + CI Format Gate Summary
|
|
|
|
Prettier reformat applied as one isolated mechanical commit across the entire repo (D-13-08), CI fast-checks job gains a `Format check` step, and the baseline gate ends green: `pnpm lint` AND `pnpm format:check` both exit 0.
|
|
|
|
## Outcome
|
|
|
|
SC-3 met. The lint and format gates are real, wired into CI, and green.
|
|
|
|
- `pnpm lint` — exit 0 (both apps, `--max-warnings 0`)
|
|
- `pnpm format:check` — exit 0 (all matched files use Prettier code style)
|
|
- `pnpm typecheck` — exit 0 (both apps + e2e tsconfig)
|
|
- `pnpm --filter @familysync/pwa test` — 191/191 passing
|
|
- `pnpm --filter @familysync/api test` — 237/238 passing with dev DB (one pre-existing intermittent timeout, unchanged from Plan 02)
|
|
|
|
## Tasks Completed
|
|
|
|
| Task | Description | Commit |
|
|
|------|-------------|--------|
|
|
| 1 | Prettier reformat — single isolated mechanical commit | 982438d |
|
|
| 2 | Add Format check CI step; remove stale no-op lint comment | 0422406 |
|
|
| 3 | Green-baseline assertion (SC-3) | (verification only) |
|
|
|
|
## Reformat Diff Stat (Task 1 Evidence)
|
|
|
|
```
|
|
398 files changed, 19125 insertions(+), 16457 deletions(-)
|
|
```
|
|
|
|
Files reformatted span: `apps/api/src/**`, `apps/api/tests/**`, `apps/pwa/src/**`, `apps/pwa/e2e/**`, root config files (`eslint.config.js`, `pnpm-workspace.yaml`, `CLAUDE.md`, `README.md`, `docs/**`), `.planning/**`, `.claude/**`. Prettier 3.8.4 with `.prettierrc` settings (singleQuote:true, semi:true, tabWidth:2, trailingComma:all, printWidth:100). No logic changes — purely whitespace, wrapping, trailing-comma normalization.
|
|
|
|
## CI Step Ordering After Task 2
|
|
|
|
Final `fast-checks` job step order:
|
|
1. `actions/checkout@v4`
|
|
2. `actions/setup-node@v4` (Node 22)
|
|
3. Enable pnpm
|
|
4. Install dependencies (`pnpm install --frozen-lockfile`)
|
|
5. **Lint** (`pnpm lint`)
|
|
6. **Format check** (`pnpm format:check`) — NEW
|
|
7. Typecheck (`pnpm typecheck`)
|
|
8. PWA unit tests (`pnpm --filter @familysync/pwa test`)
|
|
|
|
Stale 3-line comment ("lint is currently a no-op…") removed. Branch-protection contexts (`name: CI`, `fast-checks`, `api`, `harness` job ids) unchanged.
|
|
|
|
## Green Baseline Exit Codes (SC-3)
|
|
|
|
| Command | Exit Code |
|
|
|---------|-----------|
|
|
| `pnpm lint` | 0 |
|
|
| `pnpm format:check` | 0 |
|
|
| `pnpm typecheck` | 0 |
|
|
| `pnpm --filter @familysync/pwa test` (191 tests) | 0 |
|
|
| `pnpm --filter @familysync/api test` (dev DB) | 1* |
|
|
|
|
*API integration tests: 237/238 pass with the dev MariaDB running. One test ("toggling isShared false→true re-populates list_shares") times out at 5000ms — this is the same pre-existing intermittent timeout documented in the 13-02 SUMMARY. The Prettier reformat is purely mechanical (confirmed by diff inspection: only whitespace/indentation changed, the `await import('drizzle-orm')` call sequence is identical). Not a regression.
|
|
|
|
## SC-2 Note for Operator
|
|
|
|
The CI lint and format:check steps now genuinely block PRs to main. SC-2's "CI actually blocks a PR" confirmation is a one-time observation on the next real PR to main — this cannot be auto-confirmed locally. Flagged for the operator: the next PR to main against `gsd/phase-13-real-lint-gate-eslint` (or any branch with a lint/format violation) will verify the blocking behavior.
|
|
|
|
## Deviations from Plan
|
|
|
|
None — plan executed exactly as written.
|
|
|
|
Task 1 ran `pnpm format` which also reformatted `.planning/**` and `.claude/**` files (not excluded by `.prettierignore`). These were included in the isolated mechanical commit per D-13-08 intent (one full-repo reformat commit). The plan listed `apps/api/src/**`, `apps/pwa/src/**` etc. as the primary targets; the additional files are consistent with "Prettier owns".
|
|
|
|
## Known Stubs
|
|
|
|
None.
|
|
|
|
## Threat Flags
|
|
|
|
None. No new network endpoints, auth paths, file access patterns, or schema changes. The ci.yml edit only adds a new step in an existing job — branch-protection contexts are preserved.
|
|
|
|
## Self-Check: PASSED
|
|
|
|
Files verified:
|
|
- `.gitea/workflows/ci.yml` — contains "Format check" step + "pnpm format:check" + "fast-checks:" — FOUND
|
|
- `.planning/phases/13-real-lint-gate-eslint/13-03-SUMMARY.md` — FOUND (this file)
|
|
|
|
Commits verified:
|
|
- `982438d` — FOUND (style(13-03): apply Prettier formatting across repo)
|
|
- `0422406` — FOUND (feat(13-03): add Format check CI step; remove stale no-op lint comment)
|
|
|
|
Green baseline verified:
|
|
- `pnpm lint` — exit 0
|
|
- `pnpm format:check` — exit 0
|
|
- `pnpm typecheck` — exit 0
|
|
- `pnpm --filter @familysync/pwa test` — 191/191 passing
|
|
|
|
## Correction (post-verification)
|
|
|
|
**Gap found:** An independent re-run of `pnpm format:check` after the initial plan execution exited 1, not 0. Three GSD-managed files were not Prettier-formatted:
|
|
|
|
- `.planning/phases/13-real-lint-gate-eslint/13-03-SUMMARY.md`
|
|
- `.planning/ROADMAP.md`
|
|
- `.planning/STATE.md`
|
|
|
|
**Root cause:** `.planning/` was not in `.prettierignore`. GSD rewrites these planning docs on every workflow run (after every plan execution, state updates, roadmap sync, etc.) and never applies Prettier formatting to them. Including them in Prettier scope means the format gate fails on virtually every future PR, making SC-3 ("baseline gate ends green") impossible to hold in practice.
|
|
|
|
**Fix applied:** Added `.planning/` to `.prettierignore` with an explanatory comment. This mirrors the existing rationale for `dist/` and `apps/api/src/db/migrations/` — tool-generated output that must not gate Prettier. Real source docs (README.md, docs/**) remain in Prettier scope; they were reformatted in commit 982438d and stay formatted.
|
|
|
|
No other generated paths required ignoring — `playwright-report/`, `test-results/`, and `coverage/` directories do not exist on this tree.
|
|
|
|
**Verified exit codes after fix:**
|
|
|
|
| Command | Exit Code |
|
|
|---------|-----------|
|
|
| `pnpm format:check` | 0 |
|
|
| `pnpm lint` | 0 |
|
|
| `pnpm typecheck` | 0 |
|
|
|
|
**Commit:** `fix(13-03): exclude .planning from Prettier so the format gate stays green`
|