Skip to content

feat(dashboard): report document imports to the status island (#2004) - #2042

Merged
doobidoo merged 3 commits into
doobidoo:mainfrom
jilsnshah:feat/upload-status-island-2004
Nov 16, 2026
Merged

doobidoo merged 3 commits into
doobidoo:mainfrom
jilsnshah:feat/upload-status-island-2004

Conversation

@jilsnshah

@jilsnshah jilsnshah commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

A document import now reports to the status island as its own row, named after the file, so its progress is visible from every tab and not only while the Documents tab is open.

Why

Closes #2004

monitorUploadProgress(uploadId) polled GET /api/documents/status/{upload_id} every two seconds, but the answer only reached the Documents tab's upload history.

What I did, following the issue:

  • monitorUploadProgress() hands every poll answer to a new _reportUpload(uploadId, answer), which reports source upload-<uploadId> with the file name as label ({ fallback: filename }, no key).
  • queued: busy with progress: 'unknown'. processing: busy with progress from the answer.
  • completed: success without settle, so the row leaves by itself after five seconds.
  • failed: error with dismissible: true and the first entry of errors as text. If errors is empty, the new catalog text island.upload.failed ("Import failed") is used instead.
  • Each import has its own source id, so two parallel imports show as two rows.
  • A failed poll goes to the existing catch, which retries after five seconds and reports nothing, so the row keeps its last state.
  • Every call goes through a this.statusIsland null check, so the dashboard keeps working without the island.

One behaviour change in the poll loop: it used to stop at progress >= 100 or an end state. process_batch_upload() sets progress = 100 before it sets status, so a poll could catch a batch at 100% that was still processing, and then it would stop. With the island that would leave a busy row at 100% forever. The poll now stops only on completed or failed.

How it was verified

New cases at the end of tests/web/test_status_island.cjs. They run the real monitorUploadProgress() / _reportUpload() from app.js against the real island model (StatusIsland.createModel()). Only apiCall (returns the UploadStatus shape from web/api/documents.py) and setTimeout (run by hand) are stubbed:

  • queued, then 25%, then 75%, then completed: label { fallback: 'notes.pdf' }, the right state, progress and key at each step; the confirmation has no settle and leaves on expiry; polling stops and the history reloads once;
  • a batch answering processing at 100% is polled again and ends as success;
  • a failed import shows errors[0], is dismissible, does not expire by itself, and goes away when closed; empty errors falls back to island.upload.failed;
  • two imports at once are two rows (upload-a, upload-b) with their own labels and percentages;
  • a poll that throws keeps the last state (busy 40%), retries after 5000 ms, and the next answer moves the bar;
  • works with statusIsland = null; every key used exists in en.json.
# with the src/ change stashed: fails
$ node --test tests/web/test_status_island.cjs
# pass 33
# fail 8

# on this branch
$ node --test tests/web/test_status_island.cjs
# pass 41
# fail 0

tests/web in a python:3.12-slim container (Node 20, pip install -e ".[dev]"):

$ pytest -q tests/web
811 passed

bash scripts/pr/pre_pr_check.sh (same container):

15 of 16 checks pass. The quality gate step was skipped (no local analysis model).
[3/9] Test suite: FAIL, only because tests/test_memory_distill.py errors at collection:
  FileNotFoundError: [Errno 2] No such file or directory: 'curl'
The slim image has no curl. A clean origin/main checkout gives the same error in the
same image, so it has nothing to do with this change. (The gate ran the full suite.)

Screenshots

The dashboard (index.html, app.js, status-island.js, style.css from this branch) in headless Chromium. /api was answered by stubs and the import answers came through the real monitorUploadProgress() poll. The stub has no event stream, so the connection row was set to "Connected" by hand. Panel open in every shot.

Two imports running (quarterly-report.pdf at 45%, team-handbook.md at 80%):

Light Dark
1440px progress-light-1440.png progress-dark-1440.png
360px progress-light-360.png progress-dark-360.png

One import failed (stays, with Close), the other still running:

Light Dark
1440px failed-light-1440.png failed-dark-1440.png
360px failed-light-360.png failed-dark-360.png

Changelog fragment

changelog.d/2004.added.md

Notes for the reviewer

  • New catalog keys island.upload.queued ("Waiting to start"), island.upload.processing ("Importing"), island.upload.completed ("Imported"), island.upload.failed ("Import failed"). None of the existing keys fit an import. I added all four to all eleven catalogs with translations, not English placeholders. A native speaker should check them.
  • A single-file import has no measured percentage before it ends. process_document_upload() leaves progress at 0 until completion (only batches update it per file), so a single file shows busy at 0% and then the confirmation. I kept the issue's mapping (progress from the answer) and did not change the backend. If you would rather show 'unknown' while a single upload is at 0, or show chunks_processed in the text, that is a small follow-up.
  • The failure text is the server's errors[0] as is, with no catalog key, as the issue asks. For a batch it starts with the file name, so the panel shows the name twice (see the failed screenshots).
  • The upload-started toast and the Documents tab history are unchanged.

Agent Disclosure

This PR was generated by an AI coding agent (Claude Code, Anthropic). The submitting account is operated by Jils Shah (@jilsnshah).
Human review of this PR: none beyond the submitter asking for it. The code, tests and screenshots were produced and checked by the agent (results above). The submitter has not reviewed the diff line by line.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Document imports now report progress in the shared status island.

  • Document imports now show a separate status row for each file.

No new actionable issues were found. The previous partial-import finding is fixed.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Poll[Poll upload status] --> Report[Update the upload row]
  Report --> State{Upload status}
  State -->|Queued or processing| Wait[Wait and poll again]
  Wait --> Poll
  State -->|Completed without errors| Success[Show success then remove row]
  State -->|Failed or completed with errors| Error[Keep error until closed]
Loading

Reviews (3) · Last reviewed commit: "Merge branch 'main' into feat/upload-sta..." · Reviewed by Greptile

…oo#2004)

monitorUploadProgress() now hands every GET /api/documents/status/{id}
answer to the status island as its own source, upload-<id>, labelled
with the file name: busy while queued (unknown progress) or processing
(measured progress), success without settle when completed, and a
dismissible error with the first server error when failed. Parallel
imports are separate rows; a failed poll keeps the last state.

The poll now stops only on completed or failed, so a batch that reaches
100% before it is marked completed still ends with a confirmation.

Adds island.upload.{queued,processing,completed,failed} to all eleven
catalogs and node tests that drive the real poll against the real
island model.

Closes doobidoo#2004
…sland (doobidoo#2004)

process_batch_upload() answers "completed" once any chunk was stored,
even when other files or chunks failed. Such an import showed
"Imported" and left the island after five seconds, so readers on other
tabs never learned that content was missing.

A completed import whose errors list is not empty now reports a
dismissible error with the first error, under the new catalog key
island.upload.partial ("Imported with errors: {error}") in all eleven
catalogs. Adds a completed-with-errors node test.
@doobidoo
doobidoo enabled auto-merge (squash) November 16, 2026 16:32
@doobidoo
doobidoo merged commit faf9a81 into doobidoo:main Nov 16, 2026
23 checks passed
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.

dashboard: report document imports to the status island

2 participants