brydup@mac ~/cowork % cat 2026-05-21-tech-brief.md

# 2026-05-21 Tech Brief

## Session Arc

Two tracks: Pi cowork-backup emergency fix (surfaced by morning cron check), then full
Cloudflare Pages migration for cowork HTML briefs. Both shipped and verified end-to-end.

---

## Shipped Artifacts

- ~/bin/cowork-pages-push.sh — new publish pipeline. Idempotently injects responsive
  viewport meta into source HTML, copies to ~/cowork-web/, regenerates date-sorted
  index.html, commits, pushes to trigger Cloudflare Pages auto-deploy. Handles back-catalog:
  every copy through the script gains <meta name="viewport" ...> whether or not the
  source had it.

- ~/bin/tech-brief-to-html — modified. Replaced Drive-PDF publish call with Pages push
  call. Added <meta charset="utf-8">, viewport meta, word-wrap: break-word on pre,
  and @media (max-width:600px) responsive CSS to the HTML template.

- ~/cowork-web/ + GitHub repo BryanDuplantis/cowork-web (private) — static HTML repo
  Cloudflare Pages deploys from. Contains 6 briefs (all viewport-injected) + index.html.

- cowork-web.pages.dev — live, auto-deploys on push to main, ~30s deploy time.
  Verified: index 200 OK, viewport meta present in served HTML, iPhone Chrome readable
  without pinch-zoom.

- /home/brydup/cowork-backup.sh (Pi) — self-heal rebase added. After git commit:
  git fetch -q origin main && git rebase -q origin/main before push. Rebase conflict
  aborts and alerts rather than silently failing. Defensive git rebase --abort at top
  clears half-finished state from prior aborted runs.

- ~/bin/cowork-html-to-drive.sh — DELETED. Drive-PDF path fully retired; Pages path
  replaces it. Script had already been dormant since migration.

---

## Cron Schedule Changes

None. tech-brief-to-html is manual-trigger; Pages deploy is event-driven (git push).
Pi cowork-backup cron schedule unchanged — only the script body was modified.

---

## Decisions

- Cloudflare Pages over Drive PDFs: responsive HTML, no rclone dependency, auto-deploy
  on push, iPhone-readable via viewport + responsive CSS.
- Zero Trust email gate deferred: CF requires CC on file even for free tier. Site is
  currently public at cowork-web.pages.dev (security by obscurity). Tracked for follow-up.
- Pi cowork-backup divergence fix: rebase over merge --ff-only — cleaner history,
  plays well with cross-machine workflows. -X theirs used for the one-time manual
  reconciliation; script uses plain rebase (conflict = abort + alert, not auto-resolve).
- cowork-html-to-drive.sh retired immediately on confirmation — no callers, no reason
  to keep a dead script in PATH.

---

## Incidents

- **cowork-backup silent divergence.** Pi was 1-ahead/3-behind origin — Mac had pushed
  3 commits while Pi had a local commit not yet pushed. git push rejected silently
  (non-fast-forward), rc bubbled up but was masked. Discovered via morning cron check.
  Fix: manual git rebase -X theirs origin/main + push, then self-heal added to script.
  Pi's local commit: removed "Slack summaries" from CLAUDE.md routing row (correct —
  Slack fully retired 5/20). Remote had complete 5/19 tech briefs. No data lost.

- **Cloudflare Workers vs Pages confusion.** Dashboard's default "Create application"
  flow routes to Workers. Pages requires clicking "Looking to deploy Pages? Get started"
  buried at the bottom of the Worker setup screen. Wasted ~3 minutes navigating.

---

## Gotchas Added to §8

- Cross-machine git divergence silently blocks git push with no alert. Pi's nightly
  backup committed local changes while Mac had also pushed to origin — left Pi
  1-ahead/3-behind, push rejected (non-fast-forward), rc masked. Fix: fetch + rebase
  in script before push; rebase conflict = abort + alert.

---

## Verification Matrix

| Artifact | Status |
|---|---|
| cowork-pages-push.sh — viewport injection | Tested: all 6 back-catalog files confirmed viewport-present in repo |
| cowork-pages-push.sh — index regen | Tested: dated newest-first, undated alpha after |
| cowork-pages-push.sh — git push triggers deploy | Tested: pipeline test brief appeared at pages.dev within 30s |
| tech-brief-to-html → Pages publish | Tested: this brief |
| cowork-web.pages.dev — 200 OK + viewport in response | Tested: curl confirmed |
| iPhone Chrome — readable without pinch-zoom | Tested: Bryan confirmed |
| Pi cowork-backup self-heal — rebase path | Trusted-untested: code reviewed, logic sound; will exercise on next cross-machine divergence |
| Zero Trust email gate | Wait-for-event: deferred pending CC |

---

## Open Items

- Zero Trust email gate — cowork-web.pages.dev is currently public. Add CF Access
  email-OTP policy (duplantis@gmail.com only) once CC can be added to Cloudflare account.
  Tracked in session task list.

---

## Brain Refs

- cowork-backup divergence fix + self-heal pattern
- Cloudflare Pages setup: Framework=None, build command empty, output dir /, project
  name must match desired *.pages.dev subdomain
- Viewport injection pattern: idempotent sed "s|<head>|<head>${VIEWPORT}|" on copy


brydup@mac ~/cowork %