Skip to content

fix: close the 12 hacks and 5 bugs the comment purge surfaced - #74

Merged
rcnsh merged 28 commits into
mainfrom
fix/open-issues
Nov 21, 2026
Merged

rcnsh merged 28 commits into
mainfrom
fix/open-issues

Conversation

@rcnsh

@rcnsh rcnsh commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

The comment purge (#67) left 12 hacks that comments used to excuse, filed as issues labelled excuse, and 5 bugs found along the way. This PR fixes all 17. Each issue has its own commit. Each fix is proved by a test that failed before it, or by a Playwright before-and-after where the change is visual.

Closes #55, closes #56, closes #57, closes #58, closes #59, closes #60, closes #61, closes #62, closes #63, closes #64, closes #65, closes #66, closes #68, closes #69, closes #70, closes #71, closes #72.

Summary

excuse (hacks)                                  bugs
#55 usage skeleton draws its own pending state  #68 suffix ranges get a 206 and the right Content-Range
#56 lattice reads --container-page              #69 meta answers 503 for unreadable rules
#57 line editor: wide chars are 2 columns       #70 BUCKET_ORIGIN pinned to PUBLIC_BUCKET_URL by test
#58 grep parses its args once                   #71 edgeCached never stores no-store/private
#59 lattice measures the band's foot row        #72 THIRD_PARTY_NOTICES.md (lucide ISC, Simple Icons, Geist OFL, world-atlas)
#60 one era palette for music stats
#61 stats offers a year newer than the build
#62 motion bootstrap pinned to one rule
#63 readingTime uses wordCount
#64 share card and badge colours read from global.css
#65 daily Cron Trigger sweeps expired sessions
#66 post body styles shared with the editor preview

Both readers of bucket bytes (upload.rcn.sh and /api/files/download) now make every Range decision in shared/bucket-http.ts (rangeToAsk, rangeOutcome). ADR-0039 has the rules. If-Range and a 304 on the download route were already missing before this PR; they are #73.

Evidence

  • Before: each new test failed on main, for example grep astro astro printing nothing, a zero-byte suffix giving an empty 200, and two share-card colours (line, inkFaint) that had drifted from global.css.
    After: npm test passes 540 of 540, npm run lint and npx astro check (0 errors) are clean, and on this branch a full npm run build passed csp-union (37 hashes) and verify-headers.
  • Browser and runtime checks:
    • Playwright: the lattice cover sits in the same place on / and /music at 1440px and 390px, the /files usage tile is the same height held and loaded, and a 2027 year option appears on /music/stats.
    • Local wrangler dev: every page returns 200 and /cdn-cgi/handler/scheduled deletes only the expired session.
  • Not tested: the cron firing in production, and real R2 range behaviour. R2 was faked in the tests.

Proof: the tests above, Playwright on the dev server, and a smoke run of the built worker under local wrangler dev. The last full build is from before the final range commits, which touch only server routes; this PR's Workers Builds check covers the rest.

Merge Danger

Door: two-way

The site Worker's entry becomes src/worker.ts (main in wrangler.jsonc) so it can export scheduled, and a daily cron is added (17 4 * * *). Every share card is redrawn with the palette's real colours.

Blast Radius: deploy

npm run deploy does not deploy upload.rcn.sh. Its range and refusal changes go live only after npm run deploy:upload.

Created with Claude Opus 5.5 in T3 Code over Claude Code.

rcnsh added 28 commits November 21, 2026 20:54
resolveMotion in shared/motion.ts is the only statement of the rule;
prefs.ts calls it, page-lifecycle.ts asks prefs.ts, and MOTION_BOOTSTRAP
splices in its source, so the inline string and its CSP hash share it.

Closes #62
…ad of copying them

satori cannot resolve CSS custom properties, so og.ts and badge.ts kept
hex copies of the palette. The share card's copy had drifted: line and
ink-faint still held the values from before they were lifted for
contrast. Both COLOR objects now come from loadPalette, which reads the
--color-* tokens from src/styles/global.css at generate time and throws
on a missing one. palette.ts and global.css join the card generator's
LAYOUT_SOURCES so a palette change redraws every card.

Closes #64
…s.ts

THIRD_PARTY_NOTICES.md carries Lucide's license verbatim (ISC, with the
MIT notice for its Feather-derived icons), Simple Icons' CC0 and the
Rust mark's CC BY-SA 4.0 for src/lib/brand-marks.ts, world-atlas's ISC
notice and Natural Earth's public-domain status for src/lib/world.ts,
and the SIL OFL 1.1 for the Geist TTFs in src/assets/fonts. README links
to it.

Closes #72
…a hardcoded 8

UsageBar draws its own pending skeleton with the loaded legend's classes and one entry per kind in KIND_LABEL; FilesUsage passes it as the fallback.

Closes #55
…editor preview

Footnote, code-frame spacing and Expressive Code variable styles move to src/styles/post-body.css, imported by the post page and /blog/edit; the preview carries post-body. A bare pre gets Expressive Code's frame metrics; highlighting stays server-only (see ADR-0172).

Closes #66
…d the right Content-Range

Move span() from the upload Worker into shared/bucket-http.ts and use it in the download route, which read a suffix range as an offset.

Closes #68
… unreadable

Read refusals answer from one REFUSALS table in shared/visibility.ts, used by both the meta and download routes.

Closes #69
…load Worker's route

shared/security.test.ts parses wrangler.jsonc and workers/upload/wrangler.jsonc and fails when either names a different bucket origin than BUCKET_ORIGIN.

Closes #70
… at the edge

edgeCached now returns an answer whose cache-control carries no-store or private as sent, without storing it, whatever its status.

Closes #71
- stats skeletons stay up for a year newer than the build
- the shell prompt counts a wide working directory by columns
- edgeCached keeps caller headers on a response it refuses to store
- /api/files/download answers an unsatisfiable range with 416, and span()
  gives no range for zero bytes
- upload.rcn.sh answers a path naming no key with the shared 400
- palette.ts resolves global.css from its own location
- the motion bootstrap writes its rule out, pinned to resolveMotion by test
A transient R2 error with a Range header is rethrown instead of looking
like a bad range, a zero-byte suffix is unsatisfiable rather than an empty
200, and every 416 carries bytes */size. edgeCached keeps caller headers on
a non-2xx answer, and the upload Worker's bad-request refusal is uncached.
…usal

span() gives no range for zero bytes again, so a range R2 accepts but that
selects nothing is a 416 naming the size. Only R2's own range refusal
(10039) is a 416, a refused range on a missing key is a 404, and every
upload.rcn.sh refusal carries uncachedError.
Both readers of bucket bytes now ask shared rangeOutcome whether to send
the whole object, a span or a 416. A malformed, multi-part or other-unit
Range is ignored, the unit is case-blind, a 416 carries no object headers
and cancels the body, a head() failure after a range refusal surfaces, and
a 412 cannot be cached.
The readers parse the Range header themselves and pass R2 an explicit
offset/length or suffix, so a malformed, reversed or multi-part header
serves the whole file instead of reaching R2 and coming back as a 416.
Every /api/files/download refusal is uncached and nosniff.
R2 keeps its own HTTP range parsing and clamping; the readers only decide
whether a header reaches it. A reversed, multi-part, oversized or zero
suffix range is ignored or refused locally, and the bucket-unbound 503 is
uncached too.
@rcnsh
rcnsh merged commit 78d3547 into main Nov 21, 2026
3 checks passed
@rcnsh
rcnsh deleted the fix/open-issues branch November 21, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment