7 Commits
Author SHA1 Message Date
poli0981andClaude Opus 5.5 0cdc730461 feat(worker): site-wide rate limit with the branded 429 page (D32) (#49)
* feat(worker): site-wide rate limit with the branded 429 page (D32)
* docs: record how the rate-limit binding really counts (measured on the preview)

Every page, feed and data request runs the Worker first and spends one
unit of SITE_LIMITER (60 per 10 s per IPv4 or IPv6 /64); over it, the
built /errors/429 page (status 429, Retry-After 10, no-store) or JSON
under /api/. What a page loads stays asset-first. Fails open. Measured on
the preview: holds a client on one connection; many-connection floods are
for the zone rule (docs/16 §9.1). Privacy #rate-limit, LEGAL_VERSION
2026-10-26, suite v3.0, v1.3.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 06:16:14 +07:00
poli0981andClaude Opus 5.5 0c6e5bc85d v1.1: Turnstile human check (+ /api/verify Worker), GPC-aware Web Analytics, legal rewrite, contacts (#24)
- test(e2e): match Cloudflare hosts by hostname, not substring
- docs: amend hard rules 1 and 7; decision log D25–D27
- docs(legal): v1.1 legal set — Cloudflare services, operator, notices, contacts
- feat(gate,analytics): Turnstile human check after consent; GPC-aware Web Analytics
- feat(worker): POST /api/verify — server-side Turnstile check (D25)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 22:56:21 +07:00
poli0981andClaude Opus 5.5 ff95578f48 fix: unblock CI — close every dependency advisory, pin actions, fix asset caching (#21)
Squashed from 8 signed commits:

- chore: normalise line endings to LF with .gitattributes
- fix(deps): refresh dependencies and close every open advisory
- style: adopt prettier-plugin-astro 1.x formatting
- fix: resolve the SonarCloud findings in scripts and issueUrl
- ci: pin actions to SHAs, fix notify/quarantine/link-check, add Dependabot config
- fix(headers): stop Cache-Control concatenation that disabled asset caching
- fix(theme): guard storage access in the pre-paint theme script
- chore(config): TS6-safe tsconfig, type-aware lint, gated build script

Each commit's full rationale is preserved on the PR (#21).
Verified on the Workers Builds preview: hashed assets now carry a single
`Cache-Control: public, max-age=31536000, immutable`, the JSON feeds a single
`max-age=300`, security.txt is utf-8, and preview hosts send noindex.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:10:17 +07:00
poli0981 66c62555be Remove custom domain routes from wrangler.jsonc
Removed routes for custom domains from configuration.
2026-07-28 20:55:54 +07:00
poli0981andClaude Opus 5 b75a67393e feat: M6 CI/CD, launch config, dead-code sweep
Repo automation, the config changes Kokone asked for, and a full error pass.

Kokone's asks:
- LEGAL_VERSION -> 2026-07-28, the H6 approval date. Anyone who accepted the
  pre-approval wording sees the gate once more; that is intended, they agreed
  to different text.
- X-Robots-Tag: noindex REMOVED. It existed only while the dataset was empty,
  where an indexed blank site can linger as "Crawled - currently not indexed".
  With real entries, legal pages and a sitemap live, that objection is gone.
- The existing favicon.svg is now the PWA manifest icon, sizes "any" with
  purpose "any maskable". One scalable asset covers every size, and browsers
  without SVG-manifest support fall back to the favicon - strictly better than
  the empty icons array that shipped in M5 and suppressed the install prompt.

The www deletion, diagnosed: a `www` DNS record added by hand is not part of
the Worker's trigger list, so `wrangler deploy` reconciles triggers and can
remove it - the redirect then dies silently. Declaring www.softharbor.net as a
second custom_domain makes wrangler CREATE and KEEP the record, so it survives
deploys and reproduces from a fresh clone instead of depending on a manual
step. www still never SERVES the site: Redirect Rule R1 runs before Workers
and 301s it to apex. That rule is now a documented hard prerequisite, because
without it www would serve a duplicate - the exact hazard docs/16 N1/N2 exist
to prevent.

CI/CD (docs/12): ci.yml with the two-job split the reusable workflow forces,
plus codeql, notify, deploy, preview, quarantine and link-check. Also
renovate.json - which pins TypeScript below 7 and flags Astro/Vite/Tailwind
majors for a fresh S1 - CODEOWNERS on the three highest-risk paths, and the
remaining issue templates.

quarantine.mjs implements hard rule 5 mechanically, and I tested it rather
than assuming: flagging VLC and running the sweep removed it from the detail
page, the grid, the API export, the RSS feed AND the search index - all five
surfaces - then restored cleanly.

Error sweep found real things:
- Two exactOptionalPropertyTypes violations. Under that flag `foo?: string`
  means "absent or string", not "may be passed undefined", and both props came
  from optional lookups. Object.fromEntries also widens to { [k: string]: … }
  and no longer satisfies Record<Locale, …>.
- ShProbe.svelte was still in the tree - a dead S1 leftover sitting in
  islands/ where docs/02 §5 caps the count at six.
- Five unused exports and an unused PWA type reference.
knip now passes clean, so the next dead export is visible instead of buried.

Gate: lint, i18n:check, validate:data, 99 tests, astro check (0 errors), knip,
build (55 pages) - all green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 14:38:52 +07:00
poli0981andClaude Opus 5 44c6faa8b8 feat: close S1/S5 gaps — trailing slash, service worker, offline page
Deployed to a Cloudflare preview URL (Worker created with a routes-free
config, so nothing is attached to softharbor.net yet) and tested against a
real origin. Four bugs that only a real deploy could surface:

1. trailingSlash x html_handling — S1's last open question, now answered.
   With build.format 'directory', Workers' auto-trailing-slash 307s /apps to
   /apps/, while every canonical, sitemap entry, hreflang alternate and
   internal link we emit uses the NO-slash form. So each advertised URL cost
   a redirect and none ever returned 200. Fixed with build.format 'file' +
   html_handling 'drop-trailing-slash': measured after, every canonical
   returns 200 and only the slashed variant redirects, to it.

2. The service worker never registered. @vite-pwa/astro emits registerSW.js
   and sw.js but references them from no page, and the build reports success
   regardless - so the entire offline story silently did not exist. Base.astro
   now loads the emitted file (external, to satisfy script-src).

3. navigateFallback served the offline page to ONLINE visitors. On its own it
   registers a NavigationRoute that answers every navigation from the
   precache; an online request for /apps returned "You appear to be offline".
   docs/08 Part D already had the right shape - NetworkOnly navigations with
   precacheFallback - and this config had dropped it. Restored, and the
   regression is now an explicit check.

4. clientsClaim was false, so the SW controlled only pages loaded after
   activation: a first-time visitor losing connection mid-session got the
   browser error page, not ours. Set true, which is what 'autoUpdate' implies.

Also: the workbox globs are coupled to build.format ('offline.html', not
'offline/**') and Workbox normalises the precache key to the extensionless
'/offline' - both verified against the emitted manifest rather than assumed.

Verified on the preview origin: _headers applies (CSP, X-Frame-Options,
Referrer-Policy, cache rules), /nope returns a real 404, SW is active AND
controlling, offline page is precached with all 13 fonts and renders both
languages, and online navigation still serves real pages.

Pre-launch X-Robots-Tag: noindex added to _headers - the site is deployable
but has no dataset, and an empty site indexed early can linger as "Crawled -
currently not indexed". Removing it is now a launch-checklist item.

Supporting: /offline and /404 pages, robots.txt, ringbuffer.ts and
issueUrl.ts (S3's subject) with tests covering budget truncation, oldest-line
eviction and unicode round-tripping.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 12:14:51 +07:00
poli0981andClaude Opus 5 79bac59e69 feat: P1 scaffold + spikes S1 and S2
Astro 7 static scaffold with the full integration set, plus the two spikes
that could be run without external provisioning. Both passed; four findings
changed the spec and are folded into docs/ in this commit (docs/10 §7).

Toolchain (all verified building together): astro 7.1.3, svelte 5.56.8,
tailwindcss 4.3.3, minisearch 7.2.0, nanostores 1.4.1, vitest 4.1.10,
wrangler 4.114.0, Node 24, pnpm 11.15.1. The pre-approved astro@6.5.x
fallback was not needed.

S1 findings:
- @nanostores/svelte DOES NOT EXIST (registry 404). D15 named it as a locked
  dependency. No binding is needed - a nanostores atom already satisfies
  Svelte's store contract, which is why bindings exist for React/Vue/Solid
  but not Svelte. D15 amended.
- D18 ("ship nothing inline, use plain script-src 'self'") is unachievable.
  ClientRouter is fine - it compiles to an external script, so View
  Transitions are NOT at risk. The real source of inline script is Astro's
  island hydration: any page with a client:* directive gets bootstrap
  scripts inlined, and we have six islands. Replaced by D20: Astro's
  security.csp emits a per-page <meta> with generated hashes, and _headers
  carries only frame-ancestors. Both policies are enforced independently, so
  _headers must NOT also declare script-src or the intersection drops the
  hashes and breaks every island. Verified by recomputing the SHA-256 of
  every inline script/style in dist/ against the emitted policy.
- TypeScript 7's native compiler does not expose the API astro check needs;
  pnpm check fails outright. Held at 6.x (D21), matching the sibling project.
- ignore-scripts=true does not "break nothing" as docs/09 §7 assumed: pnpm
  >=10 already blocks dependency scripts by default, and the flag also
  suppresses the allowlist, so esbuild never links its binary and the build
  cannot run. Replaced with an explicit allowBuilds gate in
  pnpm-workspace.yaml (esbuild/lefthook yes, workerd no). pnpm line
  corrected 10.x -> 11.x.

S2 findings:
- normalizeViet passes the full docs/05 §A1 vector table incl. NFC/NFD
  convergence, d-stroke folding, and idempotency.
- FUZZY set to 0.25 by measurement (D22). The declared gmip -> GIMP vector
  needs 2 edits on 4 characters (fuzzy >= 0.375), and at that setting the
  correctly spelled query `gimp` stops being an exact match. Precision on
  correct spellings beats one contrived typo, so the vector was retired in
  favour of gimo -> GIMP and fierfox -> Firefox. Tests pin both directions
  so a future fuzzy miss cannot be "fixed" by raising the constant.

Gate: pnpm lint, pnpm test (21/21), pnpm check (0 errors), pnpm build - all
green.

Not done, blocked on provisioning rather than code: S3 needs the GitHub repo
(H1), S5 needs the zone and a deploy (H2/H3), and S1's trailingSlash x
html_handling probe needs a real origin. S4 is doable locally and is next.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 22:11:33 +07:00