Commit Graph
22 Commits
Author SHA1 Message Date
RainbowBird f8d1fa7a64 refactor(server): drop redis stream + worker role (#1792)
The Redis Stream `billing-events` + `worker` Railway role +
advisory-lock poller layered together didn't actually buy us reliability
— `debitFlux` swallowed XADD failures, leaving the door open to "balance
updated, ledger row never written". Collapse the whole thing back to:
`creditFlux` and `debitFlux` write `flux_transaction` ledger rows inline
within the same DB transaction that mutates `user_flux`, and `(user_id,
request_id)` remains the partial unique index that keeps retries safe.

Concrete changes:
- Inline ledger inserts in `BillingService.{debitFlux, creditFlux,
creditFluxFromStripeCheckout, creditFluxFromInvoice}`; drop `billingMq`
and `publishEvent` plumbing entirely.
- `routes/openai/v1` writes `llm_request_log` synchronously via the
existing `requestLogService`; the duplicate `llm-request-log.ts` service
module is removed.
- `bin/run-worker.ts`, `libs/mq/*`,
`services/billing/billing-events.ts`,
`services/billing/billing-consumer-handler.ts`, and matching tests are
deleted. CLI now exposes only `api`.
- `BILLING_EVENTS_*` env vars and the `DEFAULT_BILLING_EVENTS_STREAM`
helper are dropped; `docker-compose.yml` no longer ships a worker
service.
- `docs/ai-context/{workers-and-runtime, billing-architecture,
redis-boundaries-and-pubsub, data-model-and-state,
architecture-overview, README}.md`, `CLAUDE.md`, and the existing
verification docs are updated to describe the single-process synchronous
pipeline.

Tests: 29 files / 247 cases pass. Production deployments need to drop
the worker Railway service after this lands.
2026-05-08 21:14:01 +08:00
RainbowBird 99956014fa feat(server): admin api (#1788) 2026-05-08 21:14:00 +08:00
RainbowBird 6f0b7e0b9b feat(auth): delete account (#1756) 2026-04-28 20:53:00 +08:00
RainbowBird f1fe161bc0 feat(auth): OIDC (#1531) 2026-04-02 04:24:04 +08:00
RainbowBird 2f730ef93a feat(server): refactor flux auditing to transaction logging 2026-03-28 02:25:44 +08:00
RainbowBird 11c456c0a7 refactor(server): squash flux-audit-log into flux-ledger 2026-03-28 02:25:44 +08:00
RainbowBird eab60d0bdb feat(server): reimplement message queue, drop outbox 2026-03-28 02:25:44 +08:00
RainbowBird 405904183f refactor(server): revert a8f445a17985a90d7eb5d981b4231114c3066e94 2026-03-28 02:25:44 +08:00
RainbowBird e24da799d0 fix(server): squash drizzle schema 2026-03-28 02:25:44 +08:00
RainbowBird ef18772798 feat(server): message queue 2026-03-28 02:25:44 +08:00
RainbowBird 9b8d1f6ab7 feat(server): flux aduit (#1482) 2026-03-28 02:25:44 +08:00
RainbowBird 0f9ea751e5 feat(server): official provider router (#1117) 2026-03-28 02:25:44 +08:00
RainbowBird 4e510bf5c2 feat(server): stripe service, more stripe table 2026-03-28 02:25:44 +08:00
RainbowBird fc51738209 feat(server): stripe integration and credits system (#1024) 2026-03-28 02:25:44 +08:00
RainbowBird f38871b2d8 refactor(server): squash drizzle migration files 2026-03-04 18:41:21 +08:00
RainbowBird fe65a207bf refactor(server,stage-ui): use local first message key 2026-01-24 19:32:39 +08:00
RainbowBird 7c9a23f250 feat(server,stage-ui): sync message to server (#990) 2026-01-24 17:57:45 +08:00
RainbowBird 371a0b105f feat(server): system_provider_configs and character_covers (#905) 2026-01-07 21:44:05 +08:00
RainbowBird 9346708c34 feat(server): characters (#882) 2026-01-07 21:37:54 +08:00
RainbowBird ddde54d22f feat(stage-ui): character settings page (#847) 2026-01-05 16:26:43 +08:00
RainbowBirdandNeko Ayaka 3dbf3fafd9 feat(server): hono server with character schema, valibot, routes (#848)
Co-authored-by: Neko Ayaka <neko@ayaka.moe>
2026-01-05 16:25:20 +08:00
d064a959cf feat(server): with api server, service-lize (#807)
Co-authored-by: Neko Ayaka <neko@ayaka.moe>
Co-authored-by: Lovehsigure_520 <1260907335@qq.com>
2026-01-05 16:24:03 +08:00