Skip to content

Deploy the published Identity provider - #12

Merged
FlyOverCoderKY merged 6 commits into
mainfrom
claude/identity-provider-site
Jul 28, 2026
Merged

FlyOverCoderKY merged 6 commits into
mainfrom
claude/identity-provider-site

Conversation

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor

Summary

  • compose exact published @pegma/identity@0.1.0 with @pegma/authorization-identity@0.1.2, @pegma/sessions@0.1.0, durable rate limits, Mail, and the Cloudflare D1 adapter
  • replace the injected account placeholder with real passkey, account-creation, email sign-in, session, and claims-adapter boundaries
  • add a fail-closed Resend Mail adapter with durable idempotent submission, authoritative reconciliation, cursor-persisted maintenance, and acknowledgement-gated retention
  • publish accurate Identity/Mail/Rate Limit/Authorization/Storage status on the site and compiled roadmap
  • split secretless PR CI from the credentialed main-only deployment workflow

Email delivery remains explicitly disabled (IDENTITY_EMAIL_ENABLED=false) until the sender domain, provider credential, audited operator acknowledgement workflow, and end-to-end delivery smoke test are complete. The stable Identity HMAC secret is already installed in Cloudflare's managed secret store.

Verification

  • Node 22: npm ci, npm run check, 38/38 tests, static build
  • Node 24: npm run check, 38/38 tests, static build
  • npm audit --audit-level=high: 0 vulnerabilities
  • Wrangler 4.114.0 deploy dry-run and startup analysis
  • local D1 migration/health/scheduled-maintenance smoke
  • desktop visual QA of Home, Stack, Roadmap, and Account; canonical roadmap release status verified after upstream plan corrections
  • independent security/correctness review: no remaining P0-P2 findings

Copilot AI review requested due to automatic review settings July 28, 2026 15:18
@cursor

cursor Bot commented Jul 28, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex review

@FlyOverCoderKY
FlyOverCoderKY merged commit 39996ac into main Jul 28, 2026
2 checks passed
@FlyOverCoderKY
FlyOverCoderKY deleted the claude/identity-provider-site branch July 28, 2026 15:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05c92859d7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pages/roadmap.astro
Comment on lines +68 to +71
<strong>Authorization Core → its consumers.</strong> Its public <code>0.x</code> packages
now exist, and this reference application composes the Identity claims adapter with
first-party Identity and Sessions. Broader consumer migrations still determine when those
contracts are stable enough for <code>1.0</code>.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Compile the new roadmap facts instead of hard-coding them

These assertions about Authorization, Identity, Mail, and Rate Limit are component-status facts written directly into the roadmap, so future component-plan changes can leave this section contradicting the compiled table above it. Pull these facts from the source repositories through the roadmap compiler rather than maintaining them in page prose.

AGENTS.md reference: AGENTS.md:L28-L30

Useful? React with 👍 / 👎.

# Token must include Workers Edit in addition to Pages Edit — see
# Token must include Workers Edit and D1 Edit in addition to Pages Edit — see
# docs/PROJECT_PLAN.md Phase 2.
- name: Apply pegma-dev-identity D1 migrations

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Activate the backend before publishing the account UI

The checked workflow publishes Pages at lines 32–39 before this migration and the Worker deployment at lines 43–65. If either backend step fails, /account remains successfully released while the previous Worker has no identity routes, leaving the production account flow broken until a later successful run; migrate and activate the Worker before exposing the dependent Pages build, or add an equivalent rollback/gate.

Useful? React with 👍 / 👎.

Comment thread worker/src/index.ts
cloudflare: true,
datadog: Boolean(env.DATADOG_API_KEY),
}),
createDetailCheck('identity', {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make the identity health check exercise identity readiness

When the email-code secret is absent or invalid, or D1 is unavailable, /api/identity/* returns 503, but /api/health reaches this static createDetailCheck before constructing the runtime and still reports the identity check as healthy with HTTP 200. This prevents health monitoring from detecting a completely unavailable account service; validate runtime/storage readiness in this check or avoid reporting it as an identity health check.

Useful? React with 👍 / 👎.

Comment thread worker/README.md
## Endpoints

- `GET /` or `GET /health` — JSON from `@pegma/health`
- `GET /`, `GET /health`, or `GET /api/health` — JSON from `@pegma/health`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict documented health URLs to the routed endpoint

With workers_dev and preview URLs disabled and the sole production route set to pegma.dev/api/*, only /api/health reaches this Worker: / is the Pages homepage and /health is also served by Pages rather than returning the documented JSON. Operators following this endpoint list therefore receive HTML or a Pages 404, so document only /api/health or add explicit Worker routes for the other paths.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR turns the repository’s existing Cloudflare Worker (“pegma-dev-api”) into a first-party Identity reference consumer for pegma.dev, wiring the published Pegma Identity/Sessions/Mail/Rate Limit/Storage packages behind a same-origin /api/identity/* boundary, plus adding the static /account shell and CI/deploy updates to support production rollout.

Changes:

  • Compose and expose a production Identity runtime + HTTP API boundary in the Worker, including scheduled maintenance lanes and a Resend mail adapter (kept fail-closed unless explicitly enabled).
  • Add the /account page + client script and update site copy/registry/roadmap to reflect published component status.
  • Split PR CI from main-only deploy; add Worker typechecking/tests to the build gate and apply D1 migrations in deploy.

Reviewed changes

Copilot reviewed 27 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
worker/wrangler.jsonc Configure production routing, D1 binding, cron trigger, and Identity vars for the Worker.
worker/tsconfig.json Add Worker-specific TS config and include wrangler-generated types.
worker/src/resend-mail.ts Implement Resend provider adapter + renderer + failure classification for @pegma/mail/Identity MailWorker.
worker/src/resend-mail.test.ts Unit tests for Resend adapter behavior, rendering, and failure classification.
worker/src/index.ts Route /api/identity/*, extend health details, and run scheduled Identity maintenance.
worker/src/identity-runtime.ts Compose exact published Identity + Sessions + rate limits + D1 store + mail worker.
worker/src/identity-runtime.test.ts Validate composition works end-to-end with MemoryStore and MailWorker scheduling behavior.
worker/src/identity-maintenance.ts Implement cron-driven cursor-persisted hygiene lanes (Identity sweeps, mail lanes, sessions, limiters).
worker/src/identity-maintenance.test.ts Verify cursor persistence and lane isolation behavior under failures.
worker/src/identity-contracts.ts Define narrow “published surface” ports consumed by the HTTP boundary.
worker/src/identity-api.ts Implement same-origin, no-store account API with CSRF/session protections and flow gating.
worker/src/identity-api.test.ts Extensive boundary/security tests for sessions, CSRF, composition fail-closed behavior, and request limits.
worker/README.md Document the Worker’s Identity composition, operational gates, and endpoint surface.
worker/migrations/0001_pegma_storage.sql Add initial D1 schema required by the storage adapter.
tsconfig.json Remove Worker sources/types from the site TS config; Worker is typechecked via its own project.
src/styles/global.css Add account page styling and minor formatting tweaks.
src/pages/roadmap.astro Update roadmap narrative to reflect the now-published components and Cloudflare consumer.
src/pages/account.astro Add static /account shell that talks to same-origin /api/identity/*.
src/layouts/Base.astro Add “Account” to global navigation.
src/data/components.ts Update component registry statuses/packages to published versions and add D1 adapter + authorization-identity.
README.md Update repository overview to reflect the Worker’s current Identity consumer role.
public/llms.txt Update LLM-facing package/status listing and add Account page description.
public/account.js Add browser client for passkey flows, email-code flows, session/CSRF handling, and account UI.
public/_headers Update CSP/Permissions-Policy for account/WebAuthn support (currently applied site-wide).
package.json Add check (including Worker tsc) and test scripts; pin/introduce Pegma dependencies; add vitest.
docs/PROJECT_PLAN.md Update plan to mark Phase 4 in progress and document Identity consumer gates.
.github/workflows/deploy.yml Main-only deploy: run check/test/build; apply D1 migrations; deploy Pages + Worker.
.github/workflows/ci.yml New PR-only workflow to run check/test/build without production credentials.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread public/_headers
Comment on lines +4 to +5
Content-Security-Policy: default-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'
Permissions-Policy: camera=(), microphone=(), geolocation=(), publickey-credentials-create=(self), publickey-credentials-get=(self)
Comment on lines +88 to +102
async function saveCursor(
store: Store,
name: CursorName,
next: string | null,
): Promise<void> {
await store.collection(maintenance).update(KEY, (current) => ({
action: 'write',
value: {
...(current ?? emptyRecord()),
partition: KEY.partition,
id: KEY.id,
[name]: next,
},
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants