Repository navigation
fix(web): Infra upload idempotency, repeat transcript delete and no-store developer responses - #4176
Merged
Merged
Conversation
# Conflicts: # apps/web/lib/developer-transcript-store.ts
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Member
Author
|
hey @greptileai, please re-review the PR |
|
Sandchest reviewed Sandchest reviews every change for vulnerabilities an attacker could use · 12 credits · Review details |
Member
Author
|
hey @greptileai, please re-review the PR |
Member
Author
|
hey @greptileai, please re-review the PR |
This branch was successfully deployed
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.

Four small fixes to the Cap Infra developer REST API.
Idempotency-Key on create upload
POST /api/developer/v1/uploadsnow accepts anIdempotency-Keyheader with the same rules as the transcript routes: 8 to 128 characters from letters, digits, dot, dash and underscore. A key that breaks those rules gets 400invalid_idempotency_key.on duplicate key update, then reads the row back. No table or column was added.userId,maxResolutionTierand metadata returns the same video and playback id with a fresh upload token. Metadata is compared after sorting its keys.idempotency_conflict, and the message names the field that changed.idempotency_conflict. A repeat after the upload completed getsupload_already_completed, the same answer the token route gives.lib/developer-ids.tsand the transcript routes share it.The agent API's create upload already derives its id from a key in
createDeveloperVideoUploadand does not share this code, so it is unchanged.Repeat delete of a transcript
DELETE /api/developer/v1/transcripts/{id}on a transcript this app already deleted now answers 200{ "success": true }. It runs the file cleanup again, which includes the captions sync from #4134. An id that never existed, or another app's transcript, still answers 404.Cache-Control and X-Request-Id
A middleware registered first on both Hono apps (
/api/developer/v1and/api/developer/sdk/v1) setsCache-Control: private, no-storeon every response. That covers errors, 404s fromnotFoundand 429s from the rate limiter. When Vercel sendsx-vercel-id, the middleware echoes it asX-Request-Id, and the SDK CORS config adds that header toAccess-Control-Expose-Headers.The public OpenAPI and docs routes are untouched. The agent API (
/api/v1) is a single Effect HttpApi, so scoping the header to its developer routes is more than a one-line change. It is left for a follow-up.Docs
rest-api.mdxand the OpenAPI spec cover:Tests
infra-upload-idempotency.test.tsruns against an in-memorydeveloper_videosbehind drizzle's mysql proxy. It covers:developer-api-contract.test.tschecks:createInfraVideoprivate, no-storeon v1 200, 401, 404, 405 and 429 answers, and on SDK 200 and 401 answersdeveloper-transcript-store.test.tsanddeveloper-video-captions.test.tscover the repeat delete and the 404 cases.Web unit suite: 125 files, 2,556 passed. The transcripts database suite passed 39 tests against a scratch MySQL. Against main's source files, 20 of the new or changed tests fail.
The headers were tested through Hono in process, not on a Vercel deployment. Check them on the preview.


Confidence Score: 5/5
The PR appears safe to merge; no new actionable issues were found.Summary
Adds safe upload retries, repeat transcript deletion, and private response headers to the developer APIs.
No new actionable issues were found. Tests and deployed headers were not independently run or checked.
Reviews (4) · Last reviewed commit: "Merge branch 'main' into fix/infra-rest-..." · Reviewed by Greptile