Skip to content

[AISAGE-503] chore(usage-ingest): enable staging processing - #8074

Merged
johnnyeric merged 1 commit into
mainfrom
johnnyeric/usage-staging-processing
Oct 19, 2026
Merged

johnnyeric merged 1 commit into
mainfrom
johnnyeric/usage-staging-processing

Conversation

@johnnyeric

@johnnyeric johnnyeric commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Persist staging usage-ingest processing mode and https://staging-app.kilo.ai/api/internal/usage/record as its writer URL so later deployments retain the tested dashboard configuration. Production stays in receipt mode; gateway direct writes and shadow publishing remain unchanged.

Regenerate Worker bindings, keep the writer URL type usable for local and production URLs, and limit the receipt-test override to staging so production's actual default remains covered.

Already tested staging end-to-end with an override in the CF dashboard. Now enabling staging processing in code.

Verification

  • Inspected resolved production/staging Wrangler configs and dry-run builds: production receipt, staging processing, separate queues/DLQs, unchanged retry/concurrency policy.
  • Hosted staging consumer-only event: matching usage row with cost 1 microdollar and personal counter increasing from 1068 to 1069, without gateway inference or a direct write for that ID.
  • Replayed the same event after restoring staging processing: the staging writer logged the matching usage ID as an already-recorded redelivery and returned HTTP 200.

Visual Changes

N/A

Reviewer Notes

Staging is already configured with processing and the writer URL through the dashboard; this persists those values in source control. Keep the existing staging USAGE_WRITER_SECRET aligned with the app's INTERNAL_API_SECRET, and retain USAGE_WRITER_PROTECTION_BYPASS if deployment protection requires it. Publisher authentication remains separate. Scheduled staging deployment can apply this configuration automatically after merge.

All 60 service tests, service typecheck/lint, formatting and generated-types checks passed after rebasing onto current main. Hosted evidence confirms a first consumer-originated insert and writer-side duplicate recovery; no new hosted test or deployment was performed while preparing this PR.

@johnnyeric
johnnyeric marked this pull request as ready for review October 19, 2026 11:12
@kilo-code-bot

kilo-code-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The configuration-only change correctly persists staging processing mode and the staging writer URL, keeps production in receipt mode, and updates the type override so runtime tests can still inject a local writer URL; no defects found in the five changed files.

Files Reviewed (5 files)
  • services/usage-ingest/README.md
  • services/usage-ingest/src/index.runtime.test.ts
  • services/usage-ingest/src/publish-usage.ts
  • services/usage-ingest/worker-configuration.d.ts
  • services/usage-ingest/wrangler.jsonc

Assumption: staging's existing USAGE_WRITER_SECRET and optional USAGE_WRITER_PROTECTION_BYPASS are already configured and aligned with the staging app's INTERNAL_API_SECRET, as stated in the PR description; secret state cannot be verified from the repository.


Reviewed by deepseek-v4.1-flash-1017 · Input: 57.9K · Output: 10.6K · Cached: 770K

Review guidance: REVIEW.md from base branch main

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.

2 participants