diff --git a/AGENTS.md b/AGENTS.md index e21a5857fa..e507bea683 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -73,7 +73,7 @@ Full index: [docs/README.md](./docs/README.md). The fast pointers: 6. **Test all 9 roles** — dev, master_technician, assistant, controller (assistant-like + payroll access), subcontractor, helpers (UI "Helper"), estimator, primary, superintendent. 7. **Company time zone** — `APP_CALENDAR_TZ` from `src/utils/dateUtils.ts` (Edge: `supabase/functions/_shared/appTimeZone.ts`); no new `'America/Chicago'` literals (`npm run check:timezone`); a stored instant's day is `calendarYmdInAppTzFromIso(iso)`, never its first ten characters. 8. **Realtime** — `useRealtimeChannel` from `src/hooks/useRealtimeChannel.ts` for every `postgres_changes` listener, filtered server-side via the `filter` string; don't add tables to the `supabase_realtime` publication casually. -9. **Branch + PR** — `main` is protected. Branch → PR (`gh pr create --fill`) → CI `checks` (typecheck + lint + the tests near the change, and it reads *skipped* when every leg passed) green → the merge queue (the *main merge queue* ruleset: squash, all-green, six entries built at once and five merged, a 240-minute check timeout — v2.6395) runs `checks` once more on the merged content, with the whole suite, and squash-merges; nothing on `main` gates on them again: `deploy.yml` only builds and deploys (its `npm run build` still runs `tsc -b`, and since v2.6119 its build job runs `check:calls-ahead --prod`, holding the deploy while the client calls what only an unpushed migration creates), and `warm-caches.yml` re-runs typecheck and lint on each merge only to save the `.cache` every PR and queue build restores. Run `npm run typecheck && npm run lint && npm test && npm run build` locally first, the whole suite being the queue's alone since v2.8596 (the typecheck takes a machine-wide lock, so two worktrees' typechecks run one after the other — `docs/SESSIONS.md` → One typecheck at a time; `TYPECHECK_NO_LOCK=1` skips it, as CI does) — a PR's own `checks` never builds (the merge queue's build does, with `vite build` and `check:built-page`, and so does `deploy.yml`), so a change to a glob, an asset import, `vite.config.ts` or `index.html` is proven by a local `npm run build`, never by a green PR. Never `git add -A`. +9. **Branch + PR** — `main` is protected. Branch → PR (`gh pr create --fill`) → CI `checks` (typecheck + lint + the tests near the change, and it reads *skipped* when every leg passed) green → the merge queue (the *main merge queue* ruleset: squash, all-green, six entries built at once and five merged, a 240-minute check timeout — v2.6395) runs `checks` once more on the merged content, with the whole suite, and squash-merges; nothing on `main` gates on them again: `deploy.yml` only builds and deploys (its `npm run build` still runs `tsc -b`, and since v2.6119 its build job runs `check:calls-ahead --prod`, holding the deploy while the client calls what only an unpushed migration creates), and `warm-caches.yml` re-runs typecheck and lint on each merge only to save the `.cache` every PR and queue build restores. Run `npm run typecheck && npm run lint && npm test && npm run build` locally first, the whole suite being the queue's alone since v2.8596 (the typecheck takes a machine-wide lock, so two worktrees' typechecks run one after the other — `docs/SESSIONS.md` → One typecheck at a time; `TYPECHECK_NO_LOCK=1` skips it, as CI does) — a PR's own `checks` never builds (the merge queue's build does, with `vite build` and `check:built-page`, and so does `deploy.yml`), so a change to a glob, an asset import, `vite.config.ts` or `index.html` is proven by a local `npm run build`, never by a green PR. A merge is not a deploy: a thread that merges a client change reads it on the live site with `npm run check:live -- ` (exit 0 when it is live, 1 when not yet) before it reports the change done, never the merge alone, because a deploy can fail after a green merge and tell no thread (a failed one opens an issue: [docs/TROUBLESHOOTING.md](./docs/TROUBLESHOOTING.md) → *A deploy of `main` that failed*). Never `git add -A`. 10. **Theme tokens, not raw hexes** — CSS variables from `src/index.css`; CI runs `node scripts/theme-tokenize.mjs --check src`. 11. **Docs ship with the PR** — release note + `docs/recent-features/` fragment, migration and edge-function fragments, help guide, specialist doc: `CLAUDE.md` → Working conventions. Amend the line that holds a fact; never append feature detail to this file, `docs/AI_CONTEXT.md`, or `docs/README.md`. 12. **Made-up names** — the repo is public: a test, a help guide, a release note, a doc, a to-do card or a note in the code names no real customer, GC, owner or job, and no real street address, job number, phone number or email; it uses an invented one (a phone number keeps its area code and takes a 555-01xx number, which is never issued). diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index 70f251cf4c..0f003df03d 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -24,7 +24,7 @@ Common issues and how to resolve them. **The page's own script lost (v2.9154, finding 767)**: the recovery above lives in the app's script, so it cannot help a page whose own `assets/index-.js` answered 404, as a link opened in the minute a deploy lands can. A script in `index.html` itself (between the `entry-load-guard` marks, constants in [src/lib/entryLoadGuard.ts](../src/lib/entryLoadGuard.ts)) hears the failed file, draws *Loading…*, and loads the page again by the hard reload's own road: at once, then after 3, 8 and 20 seconds, four tries in three minutes, then *This page did not load. Check your signal, then try again.* with **Try again**. Offline, inside a frame, or with no `sessionStorage`, it shows the words and the press and reloads nothing by itself. Since v2.9184 that script's comment does not name the app's entry file: `deploy.yml` refuses a built page that still holds `main.tsx`, the build keeps an inline script whole, and v2.9154's comment stopped every client deploy from 14:29 UTC on 2026-12-02 until the fix, so `entryLoadGuard.test.ts` now holds `index.html` to one mention, in the module tag the build rewrites. -**A deploy of `main` that failed (v2.9211 and v2.9215, punch list #480)**: a merge is not live until its **Deploy to GitHub Pages** run is green, and a failed run opens one GitHub issue with the label `deploy-failed` that names the job, the run, the commit and how many merges wait (`.github/workflows/deploy-issue.yml` over `scripts/lib/deployIssue.mjs`, 25 tests); a later failed run adds a line to it, the next green deploy of `main` closes it, a cancelled run does nothing, and the merge queue is not stopped. Read it with `gh issue list --label deploy-failed --state open`, then `gh run view --log-failed`. The check a built page passes before it goes live is `node scripts/check-built-page.mjs dist` (`npm run check:built-page`, rules in `scripts/lib/builtPage.mjs`, held by `src/lib/builtPage.test.ts`), which prints every rule a page breaks and still runs only after the merge. +**A deploy of `main` that failed (v2.9211, v2.9215, v2.9253 and v2.9254, punch list #480)**: a merge is not live until its **Deploy to GitHub Pages** run is green, which `npm run check:live -- ` reads on the live site itself (exit 0 when that merge is live, 1 when not yet, 2 when it could not tell; with no number it names the live commit and how many merges on `main` are not live), from the `build.json` the deploy writes beside the page with its commit, its time and its run (`scripts/check-live.mjs` and `scripts/write-build-stamp.mjs` over `scripts/lib/liveBuild.mjs`, held by `src/lib/liveBuild.test.ts`); a failed run opens one GitHub issue with the label `deploy-failed` that names the job, the run, the commit and how many merges wait (`.github/workflows/deploy-issue.yml` over `scripts/lib/deployIssue.mjs`, 25 tests); a later failed run adds a line to it, the next green deploy of `main` closes it, a cancelled run does nothing, and the merge queue is not stopped. Read it with `gh issue list --label deploy-failed --state open`, then `gh run view --log-failed`. The check a built page passes before it goes live is `node scripts/check-built-page.mjs dist` (`npm run check:built-page`, rules in `scripts/lib/builtPage.mjs`, held by `src/lib/builtPage.test.ts`), which prints every rule a page breaks; the merge queue's build runs it too, after a `vite build` (`ci.yml`'s job **build the page and check it**, in the queue alone), so a page the deploy would refuse is turned back before it merges, and a PR's own run still does neither. **Sign-in on a link to a page the phone's copy does not know (v2.9154, finding 762)**: an older kept copy of the app sent an address it did not know to `/`, so a signed-out phone that scanned a new page's code was asked to sign in, and a second scan worked. The last route now draws `UnknownPath` ([src/lib/unknownPath.ts](../src/lib/unknownPath.ts)): with a service worker in charge it asks whether a newer build is out and, on a yes, loads the same address again from the network, once in ten minutes for an address, and never for an address the newest build itself did not know that day. A copy kept from before v2.9154 has neither mend until its next update: scan again, or use **Fix app** below. diff --git a/to-dos/client-deploy-caught/README.md b/to-dos/client-deploy-caught/README.md index 08fe8984bd..06d6eb0c5c 100644 --- a/to-dos/client-deploy-caught/README.md +++ b/to-dos/client-deploy-caught/README.md @@ -1,8 +1,8 @@ --- name: "A broken client deploy is caught before it merges, and seen within minutes when it is not" number: 480 -group: ready -status: written 2026-12-02 (UTC), the night every client deploy failed for two hours and nobody saw it · the one mend of that night is merged · step 1, the measurement, made the same night · the owner answered all four calls the same night, each by the card's pick · steps 2 to 5 are written and none is merged: steps 2 and 4 are in the merge queue, steps 3 and 5 are on pushed branches and wait on step 2 · step 3 is proven on a runner, green and red +group: close +status: built 2026-12-03 (UTC) · all six steps are on main · a broken page was read turned back on a runner, and the live site was read naming its merge 14 minutes after it · left: the by-hand proof that a failed deploy opens the issue and the next green one closes it summary: > On 2026-12-02 a merged change put the words of a source file's name in a comment in the page's shell. The deploy's own check refuses a built page that holds those words. Every client deploy @@ -11,9 +11,11 @@ summary: > after the merge, because only the deploy builds the client. This card moves that check to where a PR fails on it, makes a failed deploy on main reach a person or a session, and gives a way to read which commit is live. Step 1 measures what a build would add to the merge queue. -next: Step 2's pull request (#10695) merges and its first deploy is read. Steps 3 and 5 then open from their pushed branches, rebased onto it. Step 4 (#10700) stands alone. Step 6 is last. -size: M as a train of six (XS · S · S · S · S · XS); left: steps 2 to 6 -blocker: None. Every call is answered. Steps 3 and 5 wait on step 2's merge, since both build on its script. +next: The by-hand proof of step 4, on a yes, since GitHub mails the issue it opens. A throwaway branch fails a deploy on purpose, the issue is read opened, the next green deploy of main is read closing it, and the branch is deleted. Then this card closes on a word. +ask: owner · decide · May a throwaway branch fail a deploy on purpose, to see the issue open and close? GitHub mails that issue. +size: M as a train of six (XS · S · S · S · S · XS); left: the by-hand proof (XS) +blocker: A yes for the by-hand proof. It opens a real GitHub issue, and GitHub mails it to whoever watches the repo. +ver: v2.9211 · 9215 · 9253 · 9254 opinion: build — twenty-nine merges went unseen on the live site for two hours, and the same hole is open for any change to the page's shell mockup: not required — workflows and scripts. No screen changes. --- @@ -163,21 +165,17 @@ installed for the check, or the build can skip the cards there, was not read. ## Where it stands -Written on 2026-12-02 (UTC). The comment is reworded and one test holds it. +Read on `main` at `e5691aeb13`, 2026-12-03 (UTC). All six steps are on `main`. One proof is left, and it waits on a yes. -- **Step 1, the measurement: made** on 2026-12-02 (UTC), from GitHub's record of finished runs. - It is under *Step 1's measurement*. Nothing was built. +- **Step 1, the measurement: made** on 2026-12-02 (UTC), from GitHub's record of finished runs. It is under *Step 1's measurement*. Nothing was built. - **The four calls: answered** on 2026-12-02 (UTC), each by the card's pick. They are under *The owner's answers*. -- **Step 2, the deploy's checks as one script: written, in pull request #10695,** in the merge queue since 20:55 UTC, not merged. `scripts/check-built-page.mjs` over `scripts/lib/builtPage.mjs`, a test for each refusal, and `deploy.yml`'s step runs it. Read green on a real built page and red with the source file's name in a comment. -- **Step 3, the build on the merge queue's build: written, on the pushed branch `claude/480-step3-queue-builds`,** with no pull request yet. It opens after step 2 merges, rebased onto `main`. A fourth job in `ci.yml` runs `vite build` and step 2's script in the merge queue alone. It is proven on a runner by a throwaway pull request (#10697, closed and never merged) that ran the job on a pull request. A clean page read green in 2 min 47 s for the whole job (run 46961835437). A page with the source file's name in a comment read red at the check, after a build that passed (run 46968509673). -- **Step 4, one issue from a failed deploy: written, in pull request #10700,** in the merge queue since 20:55 UTC, not merged. It is a workflow of its own, `deploy-issue.yml`, started when a deploy run finishes, so `deploy.yml` is not touched and the deploy never waits on it. Its proof on a runner comes after the merge, since GitHub starts such a workflow from `main`'s copy alone. -- **Step 5, the live commit: written, on the pushed branch `claude/480-step5-live-commit`,** with no pull request yet. It opens after step 2 merges, rebased onto `main`. The deploy writes `build.json` beside the page, and `npm run check:live` reads it and says how many merges are not live. -- **Step 6, the rule in `AGENTS.md`: not started.** It names step 5's check, so it is last. +- **Step 2, the deploy's checks as one script: on `main`** (v2.9211, pull request #10695, merged 2026-12-02 22:31 UTC). `scripts/check-built-page.mjs` over `scripts/lib/builtPage.mjs`, a test for each refusal, and `deploy.yml`'s **Verify build output** step runs it. Its first deploy was read green (run 46985831106): the step printed the page and the line *Build output verified*. +- **Step 3, the build on the merge queue's build: on `main`** (v2.9253, pull request #10747, merged 2026-12-03 03:47 UTC). A fourth job in `ci.yml`, **build the page and check it**, runs `vite build` and step 2's script in the merge queue alone. Its first run was that pull request's own queue build (run 47028360142): green, 3 min 32 s for the whole job, the `vite build` 2 min 3 s, the page verified. Before the merge it was proven on a runner by a throwaway pull request (#10697, closed and never merged): a clean page read green (run 46961835437), and a page with the source file's name in a comment read red at the check, after a build that passed (run 46968509673). +- **Step 4, one issue from a failed deploy: on `main`** (v2.9215, pull request #10700, merged 2026-12-02 22:36 UTC). It is a workflow of its own, `deploy-issue.yml`, started when a deploy run finishes, so the deploy never waits on it. Read on 2026-12-03 at 03:36 UTC: it had run 31 times, each green, and each planned nothing after a green deploy. No deploy has failed since, so no issue has ever been opened. **Its by-hand proof is not made.** It opens a real issue that GitHub mails, so it waits on a yes. +- **Step 5, the live commit: on `main`** (v2.9254, pull request #10748, merged 2026-12-03 03:17 UTC). The deploy writes `build.json` beside the page, and `npm run check:live` reads it and says how many merges are not live. Read on the live site at 03:32 UTC: `npm run check:live -- 10748` exited 0, 14 minutes after the merge. The file named the deploy's commit and its run (47026471355). +- **Step 6, the rule: on `main` with this card's own pull request.** `AGENTS.md` item 9 says a thread that merges a client change reads it on the live site with `npm run check:live`, never the merge alone. `docs/TROUBLESHOOTING.md` → *A deploy of `main` that failed* holds how the check, the issue and the queue's build job work. The hand-off prompts live outside the repo. Asked on 2026-12-03 (UTC) whether they may be amended to say the same, the person at the keyboard said yes, as the managing session of run 19 relayed it. That session amends them. ## Left to do -1. Step 2 merges. The first deploy of `main` after it is read: its **Verify build output** step must print the page and the verified line. -2. Step 3 opens, with its proof's two runs named, merges, and the first queue build after it is read with the new job in it. -3. Step 4 merges. The first run of **Deploy issue** is read. Then the card's own proof, by hand: a failing run opens the issue, and the next green deploy closes it. -4. Step 5 opens and merges. `npm run check:live` must name its merge's commit on the live site within the deploy's budget. -5. Step 6, and this card's lines brought to what is on `main`. +1. The by-hand proof of step 4, on a yes. A throwaway branch whose `deploy.yml` is one job named `build` that runs `exit 1`, with its `concurrency` group renamed so it never holds the real one, started with `gh workflow run deploy.yml --ref `. The issue is read opened with the label `deploy-failed`. The next green deploy of `main` is read closing it. The branch is deleted. +2. This card closes on a word, once that proof is read.