Skip to content

refactor(PRO-401): serve /__mcl/* from edge-core's endpoints; the Lambda is an adapter - #15

Merged
alistairsmith-tech merged 2 commits into
mainfrom
feat/pro-401-platform
Sep 21, 2026
Merged

alistairsmith-tech merged 2 commits into
mainfrom
feat/pro-401-platform

Conversation

@alistairsmith-tech

Copy link
Copy Markdown
Collaborator

The Lambda is now the CloudFront adapter for edge-core 0.7.0 (spurintel/monocle-edge-core#16, plan D9 in monocle-fastly-port-plan.md). http.ts converts the origin-request event to a Fetch API Request and the shared Response back to a CloudFront generated response; breaker.ts wraps the shared breaker with the KVS brk mirror on transitions; runtime.ts builds the endpoint runtime from the baked secrets and the live KVS config. endpoints.ts and responses.ts are gone. The Function is untouched.

What the shared endpoints take from here

  • allowedOrigins: the deployment's hosts plus the distribution domain, or the browser's same-origin statement when the deployment names none. Never the origin-request Host.
  • sharedPages: the challenge page and the resident script stay cacheable per segment, and the session tag still comes from /__mcl/state.
  • A body CloudFront truncated is refused before the shared reader sees it.

Behaviour

Nothing user-visible changes on this platform: the endpoint responses, the script segment formula the dashboard derives, the cacheable challenge page and the breaker mirror are the ones the Lambda had, now produced by the shared code.

Verification

Typecheck clean; 61 tests; npm run build passes with the Function at 8,379 of 10,240 bytes. Pinned to v0.7.0-rc.1; repin to v0.7.0 once the edge-core PR merges.

🤖 Generated with Claude Code

alistairsmith-tech and others added 2 commits September 21, 2026 08:15
…bda is an adapter

http.ts converts the origin-request event to a Fetch API Request and the
shared Response back to a CloudFront generated response. breaker.ts wraps the
shared breaker with the KVS brk mirror on transitions. runtime.ts builds the
endpoint runtime from the baked secrets and the live KVS config. endpoints.ts
and responses.ts are gone; the Function is untouched.

The shared endpoints take the allowed verify origins from here (the
deployment's hosts plus the distribution domain, or the same-origin statement
when none are named) and serve the challenge page and resident script as the
shared, cacheable kind.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
npm kept the lockfile's previous commit for the github: spec, so the first
commit installed 0.6.0. Re-resolved explicitly; typecheck, tests and the build
run against the tagged 0.7.0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@alistairsmith-tech
alistairsmith-tech merged commit 37b8ca8 into main Sep 21, 2026
4 checks passed
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.

1 participant