Skip to content

Expand how much of the codebase is using Effect; fix excess error emission (take 2)#271

Merged
vcarl merged 13 commits intomainfrom
vc-expand-effect-radius
Feb 4, 2026
Merged

Expand how much of the codebase is using Effect; fix excess error emission (take 2)#271
vcarl merged 13 commits intomainfrom
vc-expand-effect-radius

Conversation

@vcarl
Copy link
Member

@vcarl vcarl commented Feb 4, 2026

Swaps out the way the database loads, and shift more responsibility for startup into AppRuntime (an Effect).

This also reworks how the database is initalized, which might help with some of the weirdo oddball failures we've been seeing. I'm using a new creation mechanism, and it demanded I explciitly provide a "Scope" reference. I think this is going to mean that all access relies on the same connection, which has been the main problem so far.

This failed the last time because of a webserver startup issue that I missed. This PR now includes a CI change that ensures the pod starts correctly in staging.

There's still an issue with the webserver I'm resolving

vcarl and others added 13 commits February 3, 2026 19:14
Use SqliteClient.make with Layer.scoped so the connection lifetime is
tied to the layer scope (Effect.scoped was closing it immediately).
Inline PRAGMA busy_timeout into the layer construction. Convert
integrity check to Effect.repeat(Schedule) and checkpointWal to return
an Effect. Remove runtime, bridge functions, and shutdown helpers that
move to AppRuntime in the next commit.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move ManagedRuntime, layer composition, and bridge functions (db, run,
runTakeFirst, runTakeFirstOrThrow, posthogClient) from Database.ts into
a dedicated AppRuntime.ts. The AppLayer now includes DatabaseLayer,
PostHogServiceLive, and FeatureFlagServiceLive. Update all consumer
imports to use #~/AppRuntime.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Wrap the startup sequence in an Effect.gen pipeline: init Discord
gateway, fork integrity check as a daemon fiber, register commands,
and wire up graceful shutdown (WAL checkpoint + runtime dispose).

Convert gateway init and registerCommand to return Effects so they
compose into the startup pipeline. Move shutdown handler from gateway
to server.ts where the runtime is available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

Smoke Test Results

Metric Value
Image Size unknown
Startup Time 78s

Tested commit: 11c2196

@vcarl vcarl merged commit 7356821 into main Feb 4, 2026
7 checks passed
@vcarl vcarl deleted the vc-expand-effect-radius branch February 4, 2026 06:19
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