Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,3 @@ jobs:
npx wrangler pages deploy dist
--project-name pegma-dev
--branch main
- name: Deploy pegma-dev-api Worker
if: >
github.ref == 'refs/heads/main' &&
(github.event_name == 'push' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch')
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: npx wrangler deploy -c worker/wrangler.jsonc
27 changes: 17 additions & 10 deletions docs/PROJECT_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
serves the static site from Cloudflare Pages (project `pegma-dev`;
`www` 301s to the apex); push-to-main deploys production via the SHA-pinned
workflow, while PRs validate without receiving production credentials.
**Phase 3 complete
2026-07-27. Phase 4 is in progress:** its D1-backed Identity consumer now
**Phase 3 complete 2026-07-27. Phase 4 complete 2026-07-28:** its D1-backed
Identity consumer now
composes the exact public Identity, Authorization adapter, Sessions, Mail,
rate-limit, and storage packages. Production deployment remains gated on
review and end-to-end account smoke tests. Email-code activation is a separate
gate: provider-domain setup, its managed secret, an audited operator workflow,
and an end-to-end delivery smoke test.
rate-limit, and storage packages. Worker version
`0a9956e6-01c6-4a9a-953f-4e71d94d0055` is live on `pegma.dev/api/*`; production
health, capabilities, unauthenticated account, and cross-origin rejection
smoke tests pass. Email-code activation is a separate gate: provider-domain
setup, its managed secret, an audited operator workflow, and an end-to-end
delivery smoke test.

**Hosting decision:** Cloudflare (Pages for the static site; Workers when a
dynamic slice exists). Deliberate: the reference application
Expand Down Expand Up @@ -167,15 +169,19 @@ Actions deploy (SHA-pinned, per ecosystem standard).
Exit: push-to-main publishes; the domain serves the site with an A grade on
the obvious security headers. **Done:** project `pegma-dev`, deploys via
plain `npx wrangler` in the SHA-pinned workflow (the CI token is scoped to
Pages:Edit and Workers:Edit — deliberately no D1 or DNS scope; the custom
domain was attached in the dashboard); security headers served from
Pages:Edit only — deliberately no Worker, D1, or DNS scope; the custom domain
was attached in the dashboard); security headers served from
`public/_headers`, CSP with same-origin scripts only; `www` 301s to the apex.
The initial D1 migration was operator-applied and production CI pins its exact
hash; a future schema change remains fail-closed until it has a separate
least-privileged D1 credential. Pull requests run the build gate but never
receive the production token; branch previews remain disabled until a
separately scoped preview credential exists.

The Worker is an explicit operator deployment until a second GitHub credential
has least-privileged Worker script plus `pegma.dev` route authority. The broad
local OAuth credential is never copied into GitHub.

### Phase 3 — the compiled roadmap ✓ (2026-07-27)

Build-time aggregation of component PROJECT_PLAN.md statuses into the
Expand All @@ -189,7 +195,7 @@ emits file-format output so extensionless URLs serve 200 with no
trailing-slash redirect. Verified live: the roadmap shows plan text the
registry never contained.

### Phase 4 — the environment test
### Phase 4 — the environment test ✓ (2026-07-28)

`packages/storage-cloudflare-d1` in the storage-core repo, passing the full
conformance suite against real D1 (Miniflare/wrangler in CI). Then the
Expand Down Expand Up @@ -243,11 +249,12 @@ with a source link where not. Decide in Phase 3.
## Near-term backlog

1. Complete independent review and local/remote D1 tests for the exact
Identity composition.
Identity composition. **Done 2026-07-28.**
2. Configure the Resend free-tier account, verify the `pegma.dev` sender,
install its managed provider secret, and smoke-test idempotent delivery
behind an authenticated, audited terminal-mail acknowledgement workflow
before enabling email-code entry points. The stable HMAC secret is already
installed in Cloudflare's managed secret store.
3. Route same-origin `/api/*` traffic to `pegma-dev-api`, deploy, and verify the
D1-backed account flow without changing the Pages-hosted static architecture.
**Done 2026-07-28; email activation remains separately gated.**
9 changes: 6 additions & 3 deletions worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ npx wrangler secret put DATADOG_SITE -c worker/wrangler.jsonc
# value: us5.datadoghq.com (or datadoghq.eu — not a full URL)
```

CI deploys this Worker with the same `CLOUDFLARE_API_TOKEN` as Pages; that
token needs **Workers:Edit** in addition to **Pages:Edit**. It intentionally
does not receive D1 authority.
The GitHub deployment credential is Pages-only. Deploy this Worker from an
authenticated operator session with `npm run worker:deploy` until a separate,
least-privileged credential has both Worker script and `pegma.dev` route
authority. Do not substitute a broad personal OAuth token into GitHub. The
production Worker was operator-deployed on 2026-07-28 as version
`0a9956e6-01c6-4a9a-953f-4e71d94d0055`.

## Identity composition

Expand Down