Skip to content

Separate document row preparation from publication - #1317

Draft
zlareb1 wants to merge 2 commits into
mainfrom
feat/mcp-worker-document-preparation
Draft

zlareb1 wants to merge 2 commits into
mainfrom
feat/mcp-worker-document-preparation

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Split document and chunk row preparation from publication. Manual document add uses the same chunking, embeddings, revision, original, and write order. Preparing rows does not publish a document. The helper returns the typed rows required by the existing inserts.

This prepares the knowledge write path for external source refresh. Refresh must commit its document revision and checkpoint together; that writer is a separate change. Related to #1190 and #1310.

Test plan

  • Run tests/unit/test_knowledge_chunk_rows.py and tests/unit/test_knowledge_dedup.py on the proposed source (58 passed).
  • Check Ruff lint and formatting and git diff --check.
  • Complete required hosted CI at 906d2573f9fc972176b187a29c4857addd1cc1cc.

Review and CI

The first entire-source review identified a blocking return type error at 5057ce3ab31c9a4e0952802e4170c3b9c8dd0a2b. The hosted type check failed. A bounded mypy comparison with the two actual row stores removed all three type errors caused by losing the row types. It used a limited import graph and does not replace the hosted type check. Fresh independent review approved the corrected head with no findings. The hosted Ruff and mypy check passed. The remaining required checks are pending.

Release notes

Not for changelog. No wire, configuration, or schema change. Revert the change to restore the single function.

Authorship

AI-generated (Codex).

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
(cherry picked from commit 7aca0882170f44984f25535092ff9d27f0872d8f)
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 25, 2026 9:39am UTC
loom-telemetry Error Error Nov 25, 2026 9:39am UTC

Request Review

@zlareb1

zlareb1 commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Independent review covered all five hunks in server/knowledge/app/writes.py at 5057ce3ab31c9a4e0952802e4170c3b9c8dd0a2b. It found one blocking type error: the extracted helper's generic dictionary return annotation loses DocumentInsertRow and ChunkInsertRow, which the insert calls require. The checkout's 58 focused runtime tests passed, but the hosted type check failed. The source fix is to use the existing row types in the signature. Review and required checks will repeat on the corrected head.

Return the document and chunk row types required by the existing insert calls.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@zlareb1

zlareb1 commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Fresh independent review of 906d2573f9fc972176b187a29c4857addd1cc1cc against c8b37383cc31a6b7a539058186dd9c4eab079a6d covered the one changed file and both hunks. Approved the source change; no findings.

The reviewer compared the manual add preflight, original resolution, embedding and row builders, and publication and cleanup spans against the base. The same document and chunk types reach the existing inserts. The publication and cleanup block is unchanged. The change adds no worker entry point or wire or storage change.

Ruff and whitespace checks passed. The two focused knowledge files passed 58 tests. The bounded type comparison removed the three affected typing errors; it does not replace normal hosted CI. This review did not run services or the full suite. The normal required checks must still pass on this head.

@zlareb1

zlareb1 commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

The required run for 906d2573f9fc972176b187a29c4857addd1cc1cc finished red. Hosted type checks and the Postgres storage jobs passed on 16 and 18.

The unit shard fails test_no_new_tunable_constant on server/memory/store/code_links.py::_PATH_HINT_ROWS, outside this PR's sole changed file. The integration isolation gate is also red. Its cause has not been assigned. Required CI remains in force; the PR stays draft.

This branch has not been deployed

No deployments
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.

1 participant