Skip to content

feat(control-plane): badge documents an in-flight retain op is updating - #3102

Merged
nicoloboschi merged 5 commits into
mainfrom
feat/documents-updating-indicator
Jul 31, 2026
Merged

feat(control-plane): badge documents an in-flight retain op is updating#3102
nicoloboschi merged 5 commits into
mainfrom
feat/documents-updating-indicator

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

What

Show in the Documents table which documents are being rewritten by an in-flight retain operation, and keep the table live.

  • "Updating" badge on any row whose document_id has a pending/processing retain op (a soft pill with a gently pulsing dot).
  • Auto-refresh the table on a timer (8s idle / 4s while something's in flight) so new/updated documents, counts, and badges appear without a manual reload.
  • Last-refresh indicator next to the count — a live relative label (Refreshed 3 seconds ago, localized via Intl.RelativeTimeFormat) so you can see the auto-refresh working.

How

Operations already expose document_id, but only file ops populated it — plain retains/reprocesses left it null while pending. The engine now stamps result_metadata.document_id for single-document retains (submit_async_retain, via new document_id fields on BatchRetainParent/ChildMetadata), so reprocesses and single-document async retains surface their target. Multi-document batches leave it unset (matched per single-document child) so no row is misattributed.

No endpoint/response-shape change (the document_id field already existed on the operations list) → no OpenAPI/client regen. No new migration (extra content inside the existing result_metadata JSON).

Tests

  • Two engine regression tests: single-document retain surfaces document_id; a multi-document batch does not misattribute one.
  • documentUpdating + lastRefreshed added to all 10 locales (message-parity tests pass).

Verified

  • lint.sh, tsc, eslint, message-parity tests all pass.
  • End-to-end against a live API: reprocessing a document makes its batch_retain/retain ops report the document_id, while consolidation/refresh_mental_model correctly stay null.

Cross-check the documents table against pending/processing retain operations:
when an in-flight op targets a document already in the list, that document is
being rewritten — badge its row as 'Updating' (with a spinner) and poll until
the op finishes, then refresh its content.

Operations already expose document_id, but only file uploads populated it.
Populate result_metadata.document_id for single-document retains too (engine:
BatchRetainParent/ChildMetadata + submit_async_retain), so reprocesses and
single-document async retains surface their target. Multi-document batches leave
it unset (matched per single-document child) to avoid misattributing a row. No
API response-shape change, so no client/OpenAPI regen.

Adds 'documentUpdating' to all 10 locales and two engine regression tests.
The badge previously only appeared once an in-flight op was already detected,
and detection only ran on load / bank-switch / upload-refresh — so from an idle
table you had to catch the moment or reload. Run the (light) operations check on
every poll tick while the view is open; keep the heavier document refresh gated
to when something is actually in flight. Also kick detection right after a
reprocess so its badge shows immediately.
…s table

Badge: drop the spinning icon for a gentle pulsing dot on a soft neutral (muted)
pill instead of the loud saturated-blue spinner.

Table: auto-refresh on a timer (every 8s idle, 4s while something is in flight)
so new/updated documents, counts, and badges appear without a manual reload —
not only while an op is already detected in flight.
Stamp the wall-clock time on each list refresh and render it beside the count
('N total documents · Refreshed 14:41:32') so the auto-refresh is visible. Adds
'lastRefreshed' to all 10 locales.
Show the refresh time as a live relative label ('Refreshed 3 seconds ago') that
ticks every second — a self-contained component with its own 1s ticker so only
the label re-renders, localized via Intl.RelativeTimeFormat (no per-unit i18n
keys). Baseline-align the count row so the smaller label lines up with the
count text.
@nicoloboschi
nicoloboschi merged commit 3868c8d into main Jul 31, 2026
103 checks passed
@nicoloboschi
nicoloboschi deleted the feat/documents-updating-indicator branch July 31, 2026 13:48
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