Repository navigation
Publish shared demo corpus with retained revisions - #451
Merged
Merged
Conversation
| from alembic import op | ||
| import sqlalchemy as sa | ||
|
|
||
| revision: str = "4d5e6f7a8b9c" |
| import sqlalchemy as sa | ||
|
|
||
| revision: str = "4d5e6f7a8b9c" | ||
| down_revision: str = "3c4d5e6f7a8b" |
| max_tokens: int, | ||
| temperature: float, | ||
| usage_task: str, | ||
| ) -> str: ... |
| ) -> UploadedResultBundle: | ||
| raise NotImplementedError | ||
|
|
||
| def build_raw_key(self, *, job_id: str, relative_path: str, raw_prefix: str | None = None) -> str: ... |
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.
Summary
Demo selection previously created a private copy for each user. We publish each source once into twelve dedicated PostgreSQL tables in
__knowhere_demo__, with stable document IDs, retained revisions/assets, shared retrieval and caller-specific statistics. Optimized batched publication is now the only implementation.Maintainers use the existing V1/V2 upload, confirmation and Worker parser flow. API and Worker validate the server-owned corpus target; FORCE RLS rejects unapproved writes and both services reject database roles that bypass RLS. Publication atomically switches the revision, manifests and global generation. Document, chunk, media, agent tools and citation reads honor captured revision pins.
Real SpaceX validation exposed two failures addressed here: hierarchy JSON truncation silently produced a single Root chunk, and agent context compaction removed useful evidence and caused repeated reads. Bounded hierarchy batches validate every heading, retry malformed output and fail the import if recovery is exhausted. The OpenAI harness retains successful evidence while compacting old discovery results.
Client migration
POST /api/v1/demo/materializationsreturns 410DEMO_MATERIALIZATION_REMOVED. Existing private copies remain accessible through ordinary APIs.canonical_document_idandjob_result_id; use the shared namespace directly. Hide a demo source locally instead of archiving the shared document. Mixed private/demo retrieval needs separate requests.job_result_idwhen opening historical citations, chunks, originals and assets. Old static chunk IDs are not stable after reparsing.no-store. Explicit preparing sources return 409; an empty demo corpus returns 503. The initial migration seeds directory metadata without READY content.{ "namespace": "__knowhere_demo__", "query": "What are SpaceX's launch capabilities?", "include_document_ids": ["<catalog canonical_document_id>"], "use_agentic": false }Verification
Deployment Notes
KNOWHERE_PUBLICATION_STRATEGY. SetDEMO_MAINTAINER_USER_IDSand use a NOSUPERUSER/NOBYPASSRLS runtimeDATABASE_URL; the default maintainer set is empty.4d5e6f7a8b9cwith separate management credentials (MIGRATION_DATABASE_URL). It stops on private documents already using the reserved namespace. Grant runtime DML permissions after migration.See
docs/shared-demo-rollout.mdfor backup/runtime grants, upload examples, recovery commands, client migration and rollback, anddocs/shared-demo-validation-20261003.mdfor measured results and limitations.Checklist