Home

boring / v2

publicBoring-Software-Inc/v2
Overview Code History Branches Pull requestsIssuesInsights Campfire Docs
main
HomeOverview Code PRsIssues

feat(economics): economics-rollup cron with drift, credit, reconciliation (slice 5)

3 months ago

5650c9f
Authored
grim7/23/2026, 12:54:13 AM
rollupEconomicsDay folds a UTC day's runs and prod ai_review_usage into
economics_daily: one row per org plus a null-org totals row with the
unattributed bucket, pulled-cost drift, Railway usage, and a credit decrement
read only from prior days (idempotent delete-then-insert). COGS sums filter
source=prod; eval-key pulled spend is excluded from drift. Cron 02:20 UTC after
the pull. Integration-tested end to end.

Parent2da6eda

4 files changed
  • apps/worker/src/index.ts+9−0
  • apps/worker/src/jobs/economics-rollup.ts+30−0
  • packages/db/src/services/economics.integration.test.ts+136−1
  • packages/db/src/services/economics.ts+229−4