spike: Step-2 deploy oracle — static Effect-DI graph + ManagedRuntime (DO NOT MERGE)#23
Open
usirin wants to merge 1 commit into
Open
spike: Step-2 deploy oracle — static Effect-DI graph + ManagedRuntime (DO NOT MERGE)#23usirin wants to merge 1 commit into
usirin wants to merge 1 commit into
Conversation
… probe
Additive, non-merge deploy spike to test two things under a single future
`alchemy deploy --stage spike-effectdi`:
Q1 (plan-phase safety): does building DrizzleLive (eager `connection.raw`
inside Layer.effect) fire that runtime-only binding at deploy PLAN time?
Q2 (runtime wiring): does a route on static AppLayer + a worker-init
ManagedRuntime resolve REAL data (a session lookup)?
- worker/spike/graph.ts — DrizzleLive / PasaportLive / AppLayer (layer defs
only; the branch's structural-stub ambient + stub ManagedRuntime dropped).
- worker/spike/route.ts — GET /api/spike/whoami, runs Pasaport.validateSession
through the spike ManagedRuntime, returns JSON via runPromiseExit.
- worker/index.ts — builds the ManagedRuntime in init from AppLayer with the
REAL captured ambient context (Effect.context + Layer.succeedContext, zero
casts); merges the route additively. LAZY primary wiring (Q1 safe by lazy
construction); one-line EAGER toggle to stress Q1 at plan time.
typecheck green; zero `as`/`any`; biome clean. Not deployed, not pushed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Throwaway spike — do not merge. Close this PR to destroy the
pr-<n>stage.Tests two unknowns from the Effect-DI refactor audit via the
pr-<n>preview auto-deploy.Q1 — plan-phase safety. Does building the idiomatic static layer graph fire
DrizzleLive's eagerconnection.rawatalchemy deployplan time (→ deploy error), or stay deferred to runtime (→ safe)?Q2 — runtime wiring. Does a route driven by a worker-init
ManagedRuntimeover the staticAppLayerresolve real data at runtime?How to read the result
ManagedRuntimenever builds the graph at plan).connection.rawfired at plan. One-line fix: defer it underEffect.cached, likeBetterAuthLive.curl https://<pr-url>/api/spike/whoami→{"ok":true,"hasSession":false,"user":null}confirms Q2 (Drizzle + better-auth resolve through the injected runtime).Scope (additive, isolated)
spike/graph.ts—DrizzleLive/PasaportLive/AppLayer(idiomatic R-channel layers, zero casts).spike/route.ts— throwawayGET /api/spike/whoami, run through the spikeManagedRuntime.index.ts— builds the runtime in init from the real captured ambient context; merges the route additively./fate,/api/auth/*,/fate/live,/api/healthuntouched.Lazy wiring (primary); a one-line eager toggle is left in
index.tsto stress Q1 at plan time.pnpm typecheckgreen, zeroas/any.🤖 Generated with Claude Code