Repository navigation
The dashboard uploads a file for the server's extractor and follows its ingest job - #283
Merged
Merged
Conversation
…ts ingest job Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…bound Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…osing stops the following; the picker hides nothing the server reads Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…goes on; a failure is said once Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…alog's address and file stay put Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…busy form is frozen Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…mments say the cancellable upload Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…said to go on, not offered again Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ds nothing; the miss count resets Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… follow is tested not to reload Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…elds; replace mode and the card's refusal are tested Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
This was referenced Nov 6, 2026
Merged
Merged
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.
Related: #157
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
The dashboard's Library and a repository's documents add a file by uploading it for the server's extractor and following its ingest job to the revision it publishes. Each file is badged beforehand with the format this deployment reads it as, or refused when no extractor reads it; the browser no longer parses PDFs or Word files.
Why
The issue's plan has the dashboard upload originals and call
knowledge.ingest, with progress, capability badges, and browser extraction as a preview at most. The Library's add dialog and the repository docs dialog still did the extraction themselves:.docx;knowledge.upsert, with the original as base64 in the JSON body.A file added from the dashboard therefore got the browser's text, not the extractor's sections, tables, locators and coverage. It also capped files at 25 MB and read no other format (no
.pptx,.xlsx, SQL or TOML structure). #282 lets the server say which formats a deployment reads (knowledge.formats); this PR uses it.Design
API (
frontend/src/api.ts,api/knowledge.ts):postFilesends aFileas the raw body (application/octet-stream) on the same request path as every call: the token, the inflight counter and the typed errors.uploadKnowledgeFile(/v1/knowledge.upload),ingestKnowledge,knowledgeIngestStatusandknowledgeFormats. A server that predatesknowledge.formatsanswers404, which reads as "not listed" (null).addKnowledgeloses its original-bytes options. Pasted text has no original.Helpers (
frontend/src/lib/fileIngest.ts):fileVerdictnames the format a file is read as, as the server'sformat_ofdoes: its extension, then its media type, then the default. It refuses a legacy Office name, an empty file, a file overmax_upload_bytes, or a format no extractor reads (available: false): each is what the upload or the ingest would refuse. An extractor that could not be asked (available: null) refuses nothing: the badge says so, and an ingest sent waits for it.ingestFileuploads, ingests and pollsknowledge.ingest_statusuntil the job ends, reporting each step in words (ingestStep): queued, extracting, embedding, publishing, then ready with its revision and chunks, partial, or failed with its code.ingestClock.sleepis the one pause between polls (1 s), which tests replace. A failed poll (a replica restarting, a rate limit, a dropped connection) is tried again; after three in a row it throwsFollowLost. The job is queued and goes on, so both dialogs then close saying it goes on, with the same message closing gives (one per dialog; for a replaced document it names its new revision), instead of offering to send the file again; neither reloads the list then, since nothing has published yet.Components (
frontend/src/flows/FileIngest.tsx):useKnowledgeFormatsreads the formats when a dialog opens.PickedFileshows the file's name and size with its format badge: success, danger ("not read here") or neutral ("extractor not answering").AllowPartialis theallow_partialcheckbox.IngestProgressis a polite live region.accept: a name no format claims is read as the default format (.json,.yaml,.xml, a file with no extension), and an extractor that is not answering refuses nothing.fileVerdictsays what will happen instead.Library dialog (
AddDocumentDialog):source_uri, so a file becomes the document's next revision.IngestPhase). While the bytes upload, Cancel cancels the upload: nothing is queued yet, and a stalled upload cannot lock the dialog. Theknowledge.ingestcall, which may queue the job and keeps the default request bound, holds the dialog (Cancel disabled, Escape and outside clicks refused). Once the job is followed the dialog can close; closing (or leaving the page) stops the following, and the toast says the document is in the Library once it publishes and the list is reloaded. While busy the form is frozen: the address fields, allow-partial, the tabs and the paste text.Repository docs dialog (
RepoDocAddDialog):humanizeError, so a dropped connection reads as the lost-connection sentence (the work may have committed) in file and paste mode alike.expected_revision: 0. The address is made free against the documents the card listed (its first 20); one another document holds past those failsrevision_conflict, shown in the dialog, instead of publishing over it. That matches the paste path'sknowledge.add, which refuses a taken address.onAdded(title, lost)). Paste stays a text write.Removed:
extractPdfText,extractDocxText,readDocumentFile, base64);pdfjs-distandmammothdependencies and their module declarations;lib/docFiles.tskeepsslugify.Errors: the upload's own refusals,
PAYLOAD_TOO_LARGE(413) andUNSUPPORTED_FILE(415), get sentences ("Too large:", "This file type is not read:") for when the formats could not be read first or a proxy caps the body lower.Copy and docs: the empty Library's line says the server extracts the file; the Library row of
docs/features/dashboard.mdsays how a file is added.Alternatives considered:
Scope and risk
Compatibility, rollout and rollback
knowledge.formatsthe badge is absent and nothing is refused before sending; the job's own failure is shown.Tests
frontend/src/lib/fileIngest.test.ts:FollowLostnaming the job.frontend/src/api/knowledge.test.ts: the upload sends theFileas the body,application/octet-stream, its name and type in the query;expected_revisionis sent only when set; a404fromknowledge.formatsreads as nothing listed.frontend/src/flows/AddDocumentDialog.test.tsx:.pptxno extractor reads is refused before anything is sent;frontend/src/views/RepoDocs.test.tsx: a writer's file is uploaded and ingested under the address made from its name, withexpected_revision: 0; a file whose address another document holds is refused withrevision_conflict's reason; a partial publish's toast names what was lost; closing while following toasts and stops the polls; a dropped connection shows the lost-connection sentence in file and paste mode; a pending upload's title is frozen and a dropped file ignored, and the ingest call holds the dialog; Cancel during the upload closes the dialog and ingests nothing once the bytes land; polls that keep failing close it saying the job goes on, the list not reloaded; a format no extractor reads is refused before anything is sent; the suite resets every mock it uses before each test; the paste test still passes.frontend/src/lib/format.test.ts: the upload's two refusal codes are worded.npm --prefix frontend run test(1,888),run build,run budget, and the Playwright suite (E2E_PORT=… npm --prefix frontend run e2e, 495 passed) pass.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. Checked: the dialogs against the server's upload, ingest and formats ops in the tests above, the Playwright suite, and a review at every push.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code