Queue-North-Website/docs/architecture/GUARDS.md

169 lines
7.2 KiB
Markdown
Raw Normal View History

docs: adopt project template, retire the markdown backlog This repository is the one the template's README describes: 205 issues, zero milestones, and severity labels spelled "P0 Critical" / "P1 High" / "P2 Medium", which privacyllc.dev reports as NOT ADOPTED rather than as 87% complete. Six markdown records described the same work and none pointed at the tracker. Two of them said the project was in "Phase 5" while the code was at 0.9.3. Migrated, then deleted in this commit: FUTURE.md -> docs/history/BATCH_LEDGER.md (Archived). Its open items were all already filed as issues, so nothing needed migrating into the tracker HISTORY.md -> docs/history/DEVELOPMENT_LOG.md, verbatim, 0 lines lost DEVELOPMENT_LOG.md -> the same file, as a second labelled block. Not interleaved: the changelog has three duplicated version headings, so one date order would have implied more than the record supports PROJECT.md -> docs/planning/PROJECT_PLAN.md STRUCTURE.md -> the agent pipeline into README.md; its versioning rules retired BUILD_SUMMARY.md -> BATCH_LEDGER.md. Its embedded SQL schema deliberately NOT carried: it predated the UNIQUE constraint on leads.email, and server/index.js owns the schema SCRIPTS.md -> docs/TOOLS.md, corrected for the SSR + prerender build Moved with history (git detects all four as renames): OVERHAUL_PLAN.md, review.md, project-requirements.md, docs/zoho-setup.md Kept because this project earned them: the five-agent pipeline, the design system in OVERHAUL_PLAN.md (Status: Current, with a front-note saying which half is history), the positioning argument in REDESIGN_REVIEW.md, and REQUIREMENTS.md whole, including its change policy. Deleted from the template because they do not apply, each said out loud in DOC_TRUST_MAP.md: QA pass I (no money moves), the authorisation checklist group and the session-token row (no accounts, no sessions), and one PRECAUTIONARY paragraph in SECURITY.md about holding credentials on behalf of users — there are none, and PROJECT_PLAN.md records accounts as out of scope. Pass H was kept and rewritten: its authorisation half does not apply, its what-a-stranger-can- reach half is the most exposed surface here. Also removed: main.js, the old static site's hash router, referenced by nothing and preserved in .drop/; and test-results/.last-run.json, a May Playwright artifact reading {"status":"failed"} for a suite that does not exist. The repository was made private on Forgejo before this commit. That is what let the internal history be committed rather than exempted — null/fruit-fall is already private and reports normally. Two defects found on the way in and fixed here: zoho-setup.md told admins to edit `server/zoho/`, a directory that has never existed in any commit (the mapping is in server/index.js), and README.md's route list still advertised /8x8, removed at 0.6.6, while omitting /privacy-policy. Branding: icon.webp and logo.webp converted from this project's own marks in assets/. banner.webp is absent and is filed as an issue rather than faked. Verified: verify.sh 3/3, doc-claims 71 claimed paths all present, backup and a first-ever restore of the live leads database (2 tables, 3 rows, under 1s). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 01:19:02 -05:00
# Guards — how to write a check that actually checks
```
Status: Current
Owner: _null
Last reviewed: 2026-08-18
Governs: scripts/verify.d/**, .githooks/** — structural tests, source-grep
assertions, probes, and any check whose passing is taken as evidence
Review trigger: A guard is found to have been passing while the thing it guards
was broken; a new class of check is added to the suite.
```
fix(security): stop secrets.sh flagging every prerendered page, and clear the dangling doc claims secrets.sh --built reported ten credentials in dist/ and all ten were the same false positive: the template's user:pass@host pattern reads the schema.org JSON-LD on every prerendered page — //queuenorth.com"},"areaServed":{"@ — as a host, a password and an @. One more finding for every page added, which is the noise that turns a scanner into something people mute. Quotes, braces, commas and angle brackets cannot occur in a real userinfo component. Checked against a database URL with an inline password, one percent-encoded, and a git remote carrying a token — all three still caught, all ten false positives gone, and the historical Zoho leak from 033bdf6 still caught when replayed. The first version of that fix wrote its three test cases out literally in the header, and --tracked then reported two credentials in the scanner itself. The placeholders now use angle brackets, which are in the exclusion class the comment is describing — so the examples cannot match the pattern they illustrate. Same shape as the trap DOC_TRUST_MAP.md records about Exempt: lines. doc-claims: 240 claimed paths, all present, up from 5 dangling. DOC_TRUST_MAP was claiming banner.webp exists while saying it does not; GUARDS.md pointed at prove-guard.sh, which this project declined. docs/history/ is excluded rather than corrected — its entries name files that existed when they were written, and editing an append-only log to satisfy a present-tense check is a category error. TOOLS.md records the exclusion and why. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 01:40:46 -05:00
> **prove-guard.sh is not in this repository.** It lives in the template at
> `~/.openclaw/Projects/Template/docs/architecture/scripts/`, and this project
feat(build): audit what the site actually serves, in the build and on the wire Everything here checked an input: the content check reads the data, the secret scan reads the diff, the build reads the source. Nothing read the OUTPUT, which is the only thing a visitor or a crawler ever sees. Two live defects made the case: every page preloaded the wrong image for months, and eleven pages shipped a run-on description. Both are plain in the built HTML and invisible in the source. Build mode is guard 15-built-html, after 10-build. Per page it requires exactly one title, one non-empty description, one canonical equal to the site origin plus the route, and one h1; JSON-LD that parses, with no FAQPage, which the owner ruled out; no em dash and no U+FFFD; a preload naming the image the page actually paints first; and no description that runs its short description into the next sentence. Across pages it requires every internal link and every fragment to resolve, the sitemap to list exactly the routes the site serves, and 404.html to carry noindex and no canonical. It exits 2, not 0, when dist/ is missing or older than the sources: auditing stale output is auditing nothing. That also guards a specific hazard. react-helmet-async on React 19 does not merge, so a second <SEO> anywhere on a page silently emits a second title and a second canonical, and a search engine picks whichever it likes. URL mode fetches every page in a live sitemap once per crawler user agent (OAI-SearchBot, PerplexityBot, ClaudeBot, Googlebot, bingbot), requires HTTP 200 and identical bytes across agents, runs the same page rules, and reports any URL without a lastmod. It is deliberately NOT wired into deploy.sh: a check that runs after publication cannot stop it, and pretending otherwise is worse than not having it. Run it after a deploy. Proven by mutation, nine of them, each restored afterwards: a wrong canonical (7 pages), a second h1 (4), FAQPage markup, an em dash in copy, a link to a route that does not exist (18), a fragment that is not on its target page (7), the preload keyed on the old attribute (19), the template title left in place giving two titles (19), and the industry routes dropped from the route list (56). A clean build audits clean, and URL mode passes against the local server as all five crawlers. Closes #228. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 04:51:08 -05:00
> declined it on adoption — its guards are four shell scripts in
fix(security): stop secrets.sh flagging every prerendered page, and clear the dangling doc claims secrets.sh --built reported ten credentials in dist/ and all ten were the same false positive: the template's user:pass@host pattern reads the schema.org JSON-LD on every prerendered page — //queuenorth.com"},"areaServed":{"@ — as a host, a password and an @. One more finding for every page added, which is the noise that turns a scanner into something people mute. Quotes, braces, commas and angle brackets cannot occur in a real userinfo component. Checked against a database URL with an inline password, one percent-encoded, and a git remote carrying a token — all three still caught, all ten false positives gone, and the historical Zoho leak from 033bdf6 still caught when replayed. The first version of that fix wrote its three test cases out literally in the header, and --tracked then reported two credentials in the scanner itself. The placeholders now use angle brackets, which are in the exclusion class the comment is describing — so the examples cannot match the pattern they illustrate. Same shape as the trap DOC_TRUST_MAP.md records about Exempt: lines. doc-claims: 240 claimed paths, all present, up from 5 dangling. DOC_TRUST_MAP was claiming banner.webp exists while saying it does not; GUARDS.md pointed at prove-guard.sh, which this project declined. docs/history/ is excluded rather than corrected — its entries name files that existed when they were written, and editing an append-only log to satisfy a present-tense check is a category error. TOOLS.md records the exclusion and why. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 01:40:46 -05:00
> `scripts/verify.d/` that fail visibly on their own. It is named without
> backticks throughout for that reason. §1 below still applies and was performed
> by hand on every guard here; `docs/history/DEVELOPMENT_LOG.md` for 2026-08-18
> records how each was broken and what it did.
docs: adopt project template, retire the markdown backlog This repository is the one the template's README describes: 205 issues, zero milestones, and severity labels spelled "P0 Critical" / "P1 High" / "P2 Medium", which privacyllc.dev reports as NOT ADOPTED rather than as 87% complete. Six markdown records described the same work and none pointed at the tracker. Two of them said the project was in "Phase 5" while the code was at 0.9.3. Migrated, then deleted in this commit: FUTURE.md -> docs/history/BATCH_LEDGER.md (Archived). Its open items were all already filed as issues, so nothing needed migrating into the tracker HISTORY.md -> docs/history/DEVELOPMENT_LOG.md, verbatim, 0 lines lost DEVELOPMENT_LOG.md -> the same file, as a second labelled block. Not interleaved: the changelog has three duplicated version headings, so one date order would have implied more than the record supports PROJECT.md -> docs/planning/PROJECT_PLAN.md STRUCTURE.md -> the agent pipeline into README.md; its versioning rules retired BUILD_SUMMARY.md -> BATCH_LEDGER.md. Its embedded SQL schema deliberately NOT carried: it predated the UNIQUE constraint on leads.email, and server/index.js owns the schema SCRIPTS.md -> docs/TOOLS.md, corrected for the SSR + prerender build Moved with history (git detects all four as renames): OVERHAUL_PLAN.md, review.md, project-requirements.md, docs/zoho-setup.md Kept because this project earned them: the five-agent pipeline, the design system in OVERHAUL_PLAN.md (Status: Current, with a front-note saying which half is history), the positioning argument in REDESIGN_REVIEW.md, and REQUIREMENTS.md whole, including its change policy. Deleted from the template because they do not apply, each said out loud in DOC_TRUST_MAP.md: QA pass I (no money moves), the authorisation checklist group and the session-token row (no accounts, no sessions), and one PRECAUTIONARY paragraph in SECURITY.md about holding credentials on behalf of users — there are none, and PROJECT_PLAN.md records accounts as out of scope. Pass H was kept and rewritten: its authorisation half does not apply, its what-a-stranger-can- reach half is the most exposed surface here. Also removed: main.js, the old static site's hash router, referenced by nothing and preserved in .drop/; and test-results/.last-run.json, a May Playwright artifact reading {"status":"failed"} for a suite that does not exist. The repository was made private on Forgejo before this commit. That is what let the internal history be committed rather than exempted — null/fruit-fall is already private and reports normally. Two defects found on the way in and fixed here: zoho-setup.md told admins to edit `server/zoho/`, a directory that has never existed in any commit (the mapping is in server/index.js), and README.md's route list still advertised /8x8, removed at 0.6.6, while omitting /privacy-policy. Branding: icon.webp and logo.webp converted from this project's own marks in assets/. banner.webp is absent and is filed as an issue rather than faked. Verified: verify.sh 3/3, doc-claims 71 claimed paths all present, backup and a first-ever restore of the live leads database (2 tables, 3 rows, under 1s). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 01:19:02 -05:00
A guard that cannot fail is worse than no guard, because it is trusted. Every
rule here was learned by finding one that had been green for months over
something broken.
## 1. Prove the guard fails before you believe it passes
The one discipline that matters most, and it takes thirty seconds:
```bash
cp src/lib/thing.ts /tmp/thing.bak
# break exactly the thing the test protects
sed -i 's/if (body.error)/if (false)/' src/lib/thing.ts
npx vitest run tests/thing.test.ts # expect: exactly one failure
cp /tmp/thing.bak src/lib/thing.ts
npx vitest run tests/thing.test.ts # expect: green again
```
**Exactly one** is the part people skip. If breaking the guard's target fails
three tests, two of them are coincidental and will mask a real regression later.
If it fails none, the guard is decoration — and you have just learned that for
the price of one `sed`.
fix(security): stop secrets.sh flagging every prerendered page, and clear the dangling doc claims secrets.sh --built reported ten credentials in dist/ and all ten were the same false positive: the template's user:pass@host pattern reads the schema.org JSON-LD on every prerendered page — //queuenorth.com"},"areaServed":{"@ — as a host, a password and an @. One more finding for every page added, which is the noise that turns a scanner into something people mute. Quotes, braces, commas and angle brackets cannot occur in a real userinfo component. Checked against a database URL with an inline password, one percent-encoded, and a git remote carrying a token — all three still caught, all ten false positives gone, and the historical Zoho leak from 033bdf6 still caught when replayed. The first version of that fix wrote its three test cases out literally in the header, and --tracked then reported two credentials in the scanner itself. The placeholders now use angle brackets, which are in the exclusion class the comment is describing — so the examples cannot match the pattern they illustrate. Same shape as the trap DOC_TRUST_MAP.md records about Exempt: lines. doc-claims: 240 claimed paths, all present, up from 5 dangling. DOC_TRUST_MAP was claiming banner.webp exists while saying it does not; GUARDS.md pointed at prove-guard.sh, which this project declined. docs/history/ is excluded rather than corrected — its entries name files that existed when they were written, and editing an append-only log to satisfy a present-tense check is a category error. TOOLS.md records the exclusion and why. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 01:40:46 -05:00
prove-guard.sh performs exactly this, which removes the two ways it
docs: adopt project template, retire the markdown backlog This repository is the one the template's README describes: 205 issues, zero milestones, and severity labels spelled "P0 Critical" / "P1 High" / "P2 Medium", which privacyllc.dev reports as NOT ADOPTED rather than as 87% complete. Six markdown records described the same work and none pointed at the tracker. Two of them said the project was in "Phase 5" while the code was at 0.9.3. Migrated, then deleted in this commit: FUTURE.md -> docs/history/BATCH_LEDGER.md (Archived). Its open items were all already filed as issues, so nothing needed migrating into the tracker HISTORY.md -> docs/history/DEVELOPMENT_LOG.md, verbatim, 0 lines lost DEVELOPMENT_LOG.md -> the same file, as a second labelled block. Not interleaved: the changelog has three duplicated version headings, so one date order would have implied more than the record supports PROJECT.md -> docs/planning/PROJECT_PLAN.md STRUCTURE.md -> the agent pipeline into README.md; its versioning rules retired BUILD_SUMMARY.md -> BATCH_LEDGER.md. Its embedded SQL schema deliberately NOT carried: it predated the UNIQUE constraint on leads.email, and server/index.js owns the schema SCRIPTS.md -> docs/TOOLS.md, corrected for the SSR + prerender build Moved with history (git detects all four as renames): OVERHAUL_PLAN.md, review.md, project-requirements.md, docs/zoho-setup.md Kept because this project earned them: the five-agent pipeline, the design system in OVERHAUL_PLAN.md (Status: Current, with a front-note saying which half is history), the positioning argument in REDESIGN_REVIEW.md, and REQUIREMENTS.md whole, including its change policy. Deleted from the template because they do not apply, each said out loud in DOC_TRUST_MAP.md: QA pass I (no money moves), the authorisation checklist group and the session-token row (no accounts, no sessions), and one PRECAUTIONARY paragraph in SECURITY.md about holding credentials on behalf of users — there are none, and PROJECT_PLAN.md records accounts as out of scope. Pass H was kept and rewritten: its authorisation half does not apply, its what-a-stranger-can- reach half is the most exposed surface here. Also removed: main.js, the old static site's hash router, referenced by nothing and preserved in .drop/; and test-results/.last-run.json, a May Playwright artifact reading {"status":"failed"} for a suite that does not exist. The repository was made private on Forgejo before this commit. That is what let the internal history be committed rather than exempted — null/fruit-fall is already private and reports normally. Two defects found on the way in and fixed here: zoho-setup.md told admins to edit `server/zoho/`, a directory that has never existed in any commit (the mapping is in server/index.js), and README.md's route list still advertised /8x8, removed at 0.6.6, while omitting /privacy-policy. Branding: icon.webp and logo.webp converted from this project's own marks in assets/. banner.webp is absent and is filed as an issue rather than faked. Verified: verify.sh 3/3, doc-claims 71 claimed paths all present, backup and a first-ever restore of the live leads database (2 tables, 3 rows, under 1s). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 01:19:02 -05:00
gets skipped: the restore is a `trap`, so an interrupted run cannot leave the
code broken, and the failure count comes from the runner's own summary rather
than from eyeballing red — one failing test is routinely reported on half a
dozen lines, and counting those calls a clean result six coincidental
failures.
Do this when you write a guard, and again when you change what it guards. A
test written alongside the code it tests has never been observed failing.
## 2. A source-grep guard must tell code from the comment about code
Structural tests that assert a file does *not* contain some pattern will match
the docblock explaining why that pattern is forbidden. So the clearest possible
comment breaks the test, and the obvious fix is to delete the explanation.
Strip comments first:
```ts
const codeOf = (path: string) =>
readFileSync(path, "utf8")
.split("\n")
.filter((line) => !/^\s*(\*|\/\/|\{\/\*)/.test(line))
.join("\n");
expect(codeOf("src/lib/thing.ts")).not.toContain("dangerouslySetInnerHTML");
```
Otherwise the guard quietly punishes documenting the rule it exists to enforce —
which is exactly backwards, because the comment is how the next person learns
the rule at all.
## 3. Pin the behaviour, not the spelling
A guard should fail when the protected behaviour breaks and stay quiet
otherwise. One that asserts on a variable name fails on a rename that changed
nothing.
```ts
// Brittle: breaks when the variable is renamed, while the fallback it protects
// is untouched.
expect(route).toContain("readAsset(project.forgejoRepo");
// Pins the behaviour: the route fetches through the wrapper that tries both
// spellings, and never through the raw reader.
expect(route).toMatch(/readAsset\(\s*\w+,\s*ASSETS\[which\]\s*\)/);
expect(body).not.toContain("readFileBytes(");
```
A guard that fails on changes it does not care about is one people learn to edit
rather than heed, and the edit is usually deletion.
## 4. A negative result is only as good as the probe that produced it
"The check found nothing" and "the check did not run" are different facts, and
they look identical from the outside. Before reporting an absence, prove the
instrument worked:
```bash
# Not this alone — an unreadable file produces the same silence as an unset key
grep -c '^WANTED=' /proc/$PID/environ
# Establish the read succeeded first
tr '\0' '\n' < /proc/$PID/environ | grep -c . # 0 here means "could not read"
```
This is the confident-absence failure one level up: the same trap as a screen
rendering a failed query as a count of zero, applied to your own diagnosis.
fix(seo): the production sitemap had no dates, and the build context had secrets Three things, all in the path between this repository and the running image. Closes #225, #224 and #223. 1. THE PRODUCTION SITEMAP CARRIED NO LASTMOD AT ALL. Dates come from git history, and the image build cannot see git: .dockerignore excludes .git and node:alpine has no git binary. prerender.js read the failure into an empty catch commented "git unavailable or file untracked", so all 18 URLs came out undated while the build printed a success line. Local builds looked perfect, which is why nobody caught it. release.sh now computes the map where git exists, passes it as the SITEMAP_LASTMOD build arg, and then asks the built image whether its sitemap has dates, refusing to publish one that does not. prerender prints the count on every run, so "18 URLs, 0 dated" can never again read as success. The route-to-source map moved into scripts/lib/routes.js, where a service page now also counts its own content file, so editing one page's copy moves that page's date and no other. Proven: an image built with the arg carries 18 lastmod entries; a build with git deliberately unreadable and no arg reports "18 URLs, 0 carrying a lastmod" and warns. 2. THE DOCKER BUILD CONTEXT CARRIED CLIENT MATERIAL AND LIVE SECRETS. .drop/, zoho.md (the reCAPTCHA secret and the Zoho tokens), Levi.md and two 30 MB zips were all sent to the daemon on every build, along with four agent workspaces. The final image copies only built output, so none of it ever shipped, but one careless COPY would have changed that. Proven by listing the context from inside a throwaway image: before, all of it; after, none of it. 3. UNTRACKED FILES PASSED SILENTLY. docker build packs the working tree, so an untracked module the code imports produces an image that works and a tag that cannot rebuild it. release.sh now refuses while untracked files are present, and pre-commit's note counts them too. #223 also claimed post-commit hides a refused push. It does not: it printed "push was refused. The commit is safe locally and the branch is now ahead." during this batch. The issue was corrected on the tracker rather than acted on. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 04:58:37 -05:00
**The same trap inside a data source.** `scripts/prerender.js` read sitemap dates
from `git log` inside a `try` whose `catch` was empty and commented *"git
unavailable or file untracked"*. Inside the image build git is always
unavailable, so every date came out empty and the sitemap shipped with none at
all, for months, while the build printed a cheerful success line. The fix is two
parts and both matter: pass the data in from where it exists, and **say the
count out loud on every run**, so "18 URLs, 0 dated" cannot read as success.
security: the scanner never ran its private-key pattern, and verify never saw dist Three faults in one guard, the only thing standing between a credential and a pushed commit. Found while planning Batch 17; closes #235. 1. grep was called without -e, at both call sites. The private-key pattern starts with dashes, so grep read it as an option, exited 2, and the beside-it 2>/dev/null threw the complaint away. A staged private key passed the pre-commit hook, and had since the rule was written. Proven in a scratch repository before and after. 2. The 2026-08-29 pattern, committed as-is in 7415e19, flagged two comment lines that exist to show the shape of a credential. verify was therefore red, and release.sh would have died after bumping package.json, package-lock.json and the Dockerfile, leaving a tree that pre-push then refuses. 3. verify never scanned dist/, though SECURITY_CHECKLIST.md has listed the bundle scan as a release check for months. A key can reach the bundle from an environment variable inlined at build time without ever being committed. What changed, beyond -e: every pattern is compiled against empty input before the scan and an unreadable one exits 2, because silence from a broken matcher looks exactly like a clean tree. The NAME=value pattern now also catches quoted values, which is how a real secret is usually written down and which it has always missed. A line that must show a credential shape carries `secrets-ok:` and a reason, which excuses that line alone and stays visible to review and to grep. Guard 20-secrets runs --tracked and --built dist/. Proven by mutation, per GUARDS.md: a staged PEM header, a bare API_KEY=, a quoted API_KEY=, an exported secret and an AWS key id each exit 1; a ${VAR} value, a <placeholder>, an excused line and a delete-only commit each exit 0; an unreadable pattern exits 2 with content staged and with none; a key planted in dist/ fails guard 20-secrets alone, masked in the report. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 04:22:56 -05:00
**The same trap inside a scanner.** A matcher that discards its errors turns
"could not run" into "found nothing". `grep "$pattern" 2>/dev/null` answers a
pattern it cannot read with exit 2 and no output, and a loop reading its matches
sees an empty list. `scripts/secrets.sh` ran its private-key pattern exactly that
way from the day the rule was written: the pattern starts with dashes, grep took
it for an option, and the scanner reported a clean tree over a staged private
key until 2026-09-10 (#235). Two rules follow. Pass every pattern with `-e`. And
compile each pattern once before trusting its silence, exiting 2 when one cannot
be read, which is what `secrets.sh` now does.
docs: adopt project template, retire the markdown backlog This repository is the one the template's README describes: 205 issues, zero milestones, and severity labels spelled "P0 Critical" / "P1 High" / "P2 Medium", which privacyllc.dev reports as NOT ADOPTED rather than as 87% complete. Six markdown records described the same work and none pointed at the tracker. Two of them said the project was in "Phase 5" while the code was at 0.9.3. Migrated, then deleted in this commit: FUTURE.md -> docs/history/BATCH_LEDGER.md (Archived). Its open items were all already filed as issues, so nothing needed migrating into the tracker HISTORY.md -> docs/history/DEVELOPMENT_LOG.md, verbatim, 0 lines lost DEVELOPMENT_LOG.md -> the same file, as a second labelled block. Not interleaved: the changelog has three duplicated version headings, so one date order would have implied more than the record supports PROJECT.md -> docs/planning/PROJECT_PLAN.md STRUCTURE.md -> the agent pipeline into README.md; its versioning rules retired BUILD_SUMMARY.md -> BATCH_LEDGER.md. Its embedded SQL schema deliberately NOT carried: it predated the UNIQUE constraint on leads.email, and server/index.js owns the schema SCRIPTS.md -> docs/TOOLS.md, corrected for the SSR + prerender build Moved with history (git detects all four as renames): OVERHAUL_PLAN.md, review.md, project-requirements.md, docs/zoho-setup.md Kept because this project earned them: the five-agent pipeline, the design system in OVERHAUL_PLAN.md (Status: Current, with a front-note saying which half is history), the positioning argument in REDESIGN_REVIEW.md, and REQUIREMENTS.md whole, including its change policy. Deleted from the template because they do not apply, each said out loud in DOC_TRUST_MAP.md: QA pass I (no money moves), the authorisation checklist group and the session-token row (no accounts, no sessions), and one PRECAUTIONARY paragraph in SECURITY.md about holding credentials on behalf of users — there are none, and PROJECT_PLAN.md records accounts as out of scope. Pass H was kept and rewritten: its authorisation half does not apply, its what-a-stranger-can- reach half is the most exposed surface here. Also removed: main.js, the old static site's hash router, referenced by nothing and preserved in .drop/; and test-results/.last-run.json, a May Playwright artifact reading {"status":"failed"} for a suite that does not exist. The repository was made private on Forgejo before this commit. That is what let the internal history be committed rather than exempted — null/fruit-fall is already private and reports normally. Two defects found on the way in and fixed here: zoho-setup.md told admins to edit `server/zoho/`, a directory that has never existed in any commit (the mapping is in server/index.js), and README.md's route list still advertised /8x8, removed at 0.6.6, while omitting /privacy-policy. Branding: icon.webp and logo.webp converted from this project's own marks in assets/. banner.webp is absent and is filed as an issue rather than faked. Verified: verify.sh 3/3, doc-claims 71 claimed paths all present, backup and a first-ever restore of the live leads database (2 tables, 3 rows, under 1s). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 01:19:02 -05:00
## 5. A guard that is often wrong is worse than none
A check with a high false-positive rate trains everybody to skip its output,
including on the day it is right.
One written for this template flagged **684 of 1142** candidates on its first
run. That was not 684 findings, it was a broken heuristic — and shipping it
would have taught its readers that the check is noise. Two rounds of narrowing
brought it to 17 of 363, all of them real.
If a new guard's first run is loud, tune it until it is quiet before anybody
relies on it. Report the false-positive rate you settled at, so the next person
knows what silence is worth.
## 6. Guards belong before the artifact exists
A check that runs after publication catches the problem once it is somewhere it
cannot be taken back from: the tag is in the registry, and refusing the commit
afterwards leaves git with no record of it.
Order the gates so the expensive, irreversible step is last — preconditions,
guards, build, verify the built thing is what was asked for, publish, and record
it last of all.
## 7. When the gate finds something that invalidates the operation, stop
Printing a warning and continuing produces the worst outcome available: the bad
thing happens *and* a reassuring summary appears above it.
The question is not how bad the finding is. It is **whether it invalidates what
the operation claims**:
- A release whose test gate skipped half the suite — a release claims to be
tested. **Refuse.**
- A backup written to a group-readable directory — the backup is still a
backup. **Warn.**
Escape hatches are fine, and they have to be asked for by name, never be the
default, and say plainly what is being given up.