Skip to content

Feature/doc versions and unified LLM library#281

Open
ezhu15 wants to merge 2 commits intomainfrom
feature/doc_versions
Open

Feature/doc versions and unified LLM library#281
ezhu15 wants to merge 2 commits intomainfrom
feature/doc_versions

Conversation

@ezhu15
Copy link
Copy Markdown
Collaborator

@ezhu15 ezhu15 commented Apr 13, 2026

No description provided.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
launch-stack Ready Ready Preview, Comment Apr 13, 2026 11:32pm
pdr-ai-v2 Ready Ready Preview, Comment Apr 13, 2026 11:32pm

@Deodat-Lawson
Copy link
Copy Markdown
Owner

love it! @codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +265 to +269
.set({
currentVersionId: BigInt(inserted.id),
url: documentUrl,
mimeType,
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants