fix(worker): resolve SQLAlchemy mapper error and missing app.current_…#14
Merged
yuzushi-dev merged 1 commit intomainfrom Apr 22, 2026
Merged
fix(worker): resolve SQLAlchemy mapper error and missing app.current_…#14yuzushi-dev merged 1 commit intomainfrom
yuzushi-dev merged 1 commit intomainfrom
Conversation
…tenant GUC Two bugs caused all document processing to fail since April 16: 1. Chunk model not imported at runtime in tasks.py — only under TYPE_CHECKING, so SQLAlchemy could not resolve Document.chunks relationship after the deep singleton reset. Fixed by importing Chunk explicitly at module level. 2. configure_worker_session() only set app.is_super_admin but not app.current_tenant. RLS policies require both GUCs to be set or any SELECT on tenant tables raises UndefinedObject 42704. Fixed by adding the current_tenant GUC set and passing tenant_id from the task. feat(admin): add View Source link to document detail page (ZTD-1826) Show a View Source button in the document header when metadata.source_url is present, linking to the original documentation page.
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.
…tenant GUC
Two bugs caused all document processing to fail since April 16:
Chunk model not imported at runtime in tasks.py — only under TYPE_CHECKING, so SQLAlchemy could not resolve Document.chunks relationship after the deep singleton reset. Fixed by importing Chunk explicitly at module level.
configure_worker_session() only set app.is_super_admin but not app.current_tenant. RLS policies require both GUCs to be set or any SELECT on tenant tables raises UndefinedObject 42704. Fixed by adding the current_tenant GUC set and passing tenant_id from the task.
feat(admin): add View Source link to document detail page (ZTD-1826)
Show a View Source button in the document header when metadata.source_url is present, linking to the original documentation page.