Repository navigation
feat(usage-ingest): accept authenticated usage events - #7229
johnnyeric merged 1 commit into
Conversation
0fe3702 to
d447a1c
Compare
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe previously reported pre-enqueue Files Reviewed (22 files)
Previous Review Summaries (4 snapshots, latest commit c31e540)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit c31e540)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe authenticated Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (22 files)
Fix these issues in Kilo Cloud Previous review (commit 955f9ef)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (22 files)
Executive SummaryOne low-severity hardening item: the pre-enqueue reserialization is not guarded by the parse Previous review (commit 6a31f14)Status: No Issues Found | Recommendation: Merge Executive SummaryThe new authenticated Files Reviewed (22 files)
Previous review (commit d447a1c)Status: No Issues Found | Recommendation: Merge Files Reviewed (11 files)
Reviewed by deepseek-v4.1-flash · Input: 72.2K · Output: 14.1K · Cached: 912.1K Review guidance: REVIEW.md from base branch |
d447a1c to
6a31f14
Compare
955f9ef to
c31e540
Compare
Validate bounded usage events and await queue acceptance. Extract the shared Zod-only usage contracts while preserving compatibility exports and DB checks.
c31e540 to
9b6e920
Compare
Summary
Add authenticated
POST /usageto validate the existing usage event and send it toUSAGE_INGEST_QUEUE, preserving the supplied ID. Return 202 only after queue acceptance. Authenticate before body access, enforce strict UTF-8 and actual input/serialized event limits of 120,000 bytes, strip unknown keys, and return safe failures for invalid requests or enqueue errors.Extract the current request/response/Bouncer schemas and usage enums into
@kilocode/usage-contracts, whose only runtime dependency is Zod. The Worker imports its real package export with no web-shared dependency or resolver aliases. Existing DB/web-shared exports remain compatible, and exact DB/type alignment assertions remain in web-shared. Preserve the default-nullreasoning_settingrollout for older senders; the queue fixture includes that field so exact forwarding and byte-boundary checks use the parsed event shape.Verification
reasoning_setting, Unicode/Bouncer data, unknown-key stripping and the 120,000-byte boundary; rejected requests produced no extra receipts. All temporary servers stopped.Visual Changes
N/A
Reviewer Notes
Depends on #7228 and targets
johnnyeric/bounded-stream-reader: one commit, 22 files, +675/-190. Merge the prerequisite first, then retarget this PR to main. Direct-import cleanup is the separate dependent draft #7258.202 confirms queue acceptance; a future consumer performs processing. No consumer, gateway activation or existing Vercel API integration is included. Public Worker/preview URLs remain disabled. Verification used only local synthetic inputs; no remote queue, deployment, live PostgreSQL or billing operations were performed. The usage-client unit suite mocks fetch and does not replace database-backed writer tests.