Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
love it! @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c148c1304e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .set({ | ||
| currentVersionId: BigInt(inserted.id), | ||
| url: documentUrl, | ||
| mimeType, | ||
| }) |
There was a problem hiding this comment.
Move current-version flip after successful job dispatch
This updates document.currentVersionId/document.url before triggerDocumentProcessing runs, so if dispatch fails (e.g., job runner outage) the handler returns 500 but the document is already switched to the new version with no queued OCR job. That leaves users in a confusing partial state (request reported failed, yet current version changed and retrieval can go empty) and requires manual recovery. Consider deferring the pointer flip until after dispatch succeeds, or rolling it back on dispatch failure.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| const fullWhere = sql`${baseWhere} ${filterWhere}`; | ||
| const fullWhere = sql`${baseWhere}${versionFilter} ${filterWhere}`; |
There was a problem hiding this comment.
Filter metadata rows to the current version in vector retrieval
fullWhere now filters chunk rows by current version, but metadata filters still join pdr_ai_v2_document_metadata only by document_id. Since this commit made metadata version-scoped, documents can now have multiple metadata rows, so old-version metadata can satisfy dm.* filters for current-version chunks (and can also duplicate candidate rows, reducing effective recall). Add a dm.version_id = d.current_version_id/NULL-safe equivalent in both primary and fallback queries when metadata is joined.
Useful? React with 👍 / 👎.
| UPDATE pdr_ai_v2_document AS d | ||
| SET | ||
| current_version_id = v.id, | ||
| file_type = COALESCE(d.file_type, d.mime_type) |
There was a problem hiding this comment.
Backfill file_type with a non-null fallback MIME
The backfill sets file_type from COALESCE(d.file_type, d.mime_type), which still leaves file_type NULL for legacy rows where mime_type was NULL. The new versions API rejects uploads when file_type is missing, so these documents remain permanently non-versionable even after running the backfill. Use a concrete fallback (e.g., application/octet-stream) here, matching the v1 insert fallback logic.
Useful? React with 👍 / 👎.
No description provided.