Repository navigation
improvement(perf): bound trash, file-path and attachment reads - #8945
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
All reported issues were addressed across 33 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 35 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
Summary
GET /api/workspaces/[id]/recently-deleted, which returns 50 rows per page with keyset pagination. Each type's query is limited tolimit + 1rows, in page order, using its(workspace_id, deleted)partial index. The query reads oneUNION ALLof those per-type queries and only the columns the list renders. Search and sort run on the server and the UI scrolls infinitely. Ties still break name then id, A→Z, in either direction.run_codefile mounts and the file-preview target resolution now share one batched candidate query (findListedWorkspaceFiles, built on the display-name index candidate query) under the samefiles.listauthorization. It keeps the listing's exact matching rules.read_attachmentreads only thefileAttachmentsentries whose id or filename matches, through the same lateral-array pattern as the MCP server lookup.KeysetKeygains an optional fixeddirectionfor ascending tiebreakers, andkeysetOrderBy, so the trash reuses the shared keyset engine.useLoadMoreSentinelis extracted fromResourceand shared.Type of Change
Testing
lib/workspaces/__integration__/recently-deleted.integration.ts: per-type predicates, page walks at limits 1/2/3 equal the unpaged order for every sort, microsecond page boundaries, search escaping, type narrowing, cursor validation.lib/mothership/chat/file-attachments.integration.ts: equivalence with the transcript scan, malformed entries, deleted messages.file-names.integration.tschecks that the batched and single lookups pick exactly the file the full listing picked.read-attachment.test.ts,stream.test.ts,function-execute-file-mounts.test.ts,list-query*.test.ts,workspace-file-reference.test.ts,list-workspace-files.test.ts,folders/tables/mothership-chatshook tests.check:api-validation:strict,check:react-query,check:boundaries,check:client-boundary,check:utils,check:comment-hygiene,check:test-patterns,check:file-names, and the permission-group enforcement audit.check:audits, and the integration suites. The UI has not been verified in a browser.Checklist
test-auditauthoring gate)