feat: scheduled developer report exports to object storage#593
Open
Ope4196 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Scheduled Developer Report Exports to Object Storage
Summary
Adds a daily export pipeline that materialises
usage_eventsinto per-developer CSV and JSON artifacts stored in S3-compatible object storage, and exposes a signed download URL endpoint atGET /api/developers/exports.This replaces the previous synchronous export approach which timed out on large date ranges.
Changes
New files
migrations/0017_developer_exports.sql—developer_exportstable withid,developer_id,format,s3_key,exported_at,expires_atand a composite index on(developer_id, exported_at DESC)src/services/reportExporter.ts—ReportExporterService,InMemoryExportStore,DeveloperExportStoreinterface,createReportExporterWorkerworker factorysrc/services/reportExporter.test.ts— unit tests for service, store, and worker lifecycleModified files
src/db/schema.ts— addeddeveloperExportsDrizzle table definition,DeveloperExportandNewDeveloperExporttypessrc/routes/developerRoutes.ts— addedGET /exportsroute and extendedDeveloperRoutesDepswith optionalreportExporterServicesrc/routes/developerRoutes.test.ts— addeddescribe('GET /api/developers/exports')test block (5 cases)docs/scheduled-exports.md— updated to document the new table, route, TTL config, daily job interval, and in-memory test adapterTest coverage
src/services/reportExporter.test.tssrc/routes/developerRoutes.test.tsSecurity
EXPORT_SIGNED_URL_TTL_SECONDS(default 900 s)developer.user_id— no cross-tenant reads possiblecloses #398