Skip to content

fix(ingest): replace DEMO-DOC-ID fallback with empty state - #3653

Merged
PetrefiedThunder merged 3 commits into
mainfrom
muse/remove-demo-doc-id
Oct 28, 2026
Merged

PetrefiedThunder merged 3 commits into
mainfrom
muse/remove-demo-doc-id

Conversation

@PetrefiedThunder

@PetrefiedThunder PetrefiedThunder commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up flagged by Codex in its review of #3622 (non-blocking finding: the DEMO-DOC-ID fallback in frontend/src/app/ingest/page.tsx).

Change

  • The completed-ingest panel renders NormalizedDocumentViewer only when the ingest response has a non-empty document_id. Otherwise it shows a muted empty state ("No normalized document is available for this ingest."). The page no longer makes up a placeholder id.
  • New src/__tests__/pages/ingest-normalized-viewer.test.tsx covers three cases: document_id absent, document_id empty, and a real id passed through. Ids are generated at runtime with crypto.randomUUID().

Verification

  • vitest: the new file passes 3/3. Sibling ingest suites pass 29/29.
  • eslint on the touched files: 0 errors. There is 1 warning, which already existed at page.tsx:182 in code this PR doesn't touch.

Based on origin/main. #3622 is still open, and a test merge of the two branches shows no conflict.


Note

Low Risk
UI-only ingest completion behavior with no auth or API contract changes; reduces risk of misleading document previews.

Overview
After URL ingest completes, the completed panel no longer fabricates a document id from doc_id, job_id, or the DEMO-DOC-ID placeholder. NormalizedDocumentViewer renders only when the ingest response includes a non-empty document_id; otherwise users see a muted message: No normalized document is available for this ingest.

Tests were updated to match: an existing CSV/URL scenario that completes without document_id now asserts the empty state instead of a fake viewer receipt, and a new ingest-normalized-viewer suite covers absent, empty, and valid document_id cases.

Reviewed by Cursor Bugbot for commit ff2daa4. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Christopher Sellers <1@christophersellers.com>
@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
regengine Ready Ready Preview Oct 28, 2026 2:32pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T14:40:20.841060Z bd036ef PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 5144d59 and ff2daa4.

Files selected for processing: 2
  • frontend/src/__tests__/pages/ingest-csv.test.tsx
  • frontend/src/app/ingest/page.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Walkthrough

The completed-ingest page now renders the normalized viewer only when the response contains a non-empty document_id. Otherwise, it displays a message that no normalized document is available. Tests cover missing, empty, and present document IDs.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: Minimal · up to ff2da

The change consistently handles missing, empty, and valid document IDs with corresponding test coverage.

Pre-merge checks: Passed 5
Check name Status Explanation
Description check Passed The description clearly explains the change, test coverage, verification results, and risk. It omits the template headings for Type of Change, Checklist, and Related Issues, but the main required cont…
Title check Passed The title is concise and accurately identifies the main change: removing the DEMO-DOC-ID fallback and using an empty state for ingest.
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the change, test coverage, verification results, and risk. It omits the template headings for Type of Change, Checklist, and Related Issues, but the main required context is present.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ Bundle Size Report

Metric Size
Total JS 5579.8KB (5.44MB)
Total CSS 131.9KB
Limit 10.0MB

Bundle is within the 10.0MB limit.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

PR Blocker Checklist

Head SHA: ff2daa4601e87b04cfc9f85c67436b3e6f0354f9

Status: Ready

  • All review threads resolved
  • No reviews requesting changes
  • No blocked review engines

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Vercel preview: https://regengine-kb90xunm0-petrefiedthunders-projects.vercel.app

Access is via Vercel login (Deployment Protection).

@PetrefiedThunder PetrefiedThunder left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REVIEW: PASS gemini 5144d59

Code Review: RegEngine #3653

1. Correctness

  • Derived State: completedDocumentId cleanly derives ingestMutation.data?.document_id during render without unnecessary effects or state synchronization.
  • Defensive Guard: The check typeof completedDocumentId === 'string' && completedDocumentId.length > 0 properly handles undefined, null, and empty string inputs, ensuring <NormalizedDocumentViewer /> is only mounted when a valid identifier exists.
  • Empty State: Renders an accessible, appropriately styled fallback message (text-small text-re-text-tertiary) when no document ID is present.

2. Security & Tenant Isolation

  • Elimination of Mock Fallback: Removes the hardcoded fallback 'DEMO-DOC-ID', which previously risked leaking demo state, triggering cross-tenant lookup anomalies, or polluting audit evidence.
  • Safe Handling: Sourced exclusively from authenticated mutation response data with no client-side injection vectors.

3. Tests

  • Coverage: Adds comprehensive unit tests covering:
    • Missing/absent document_id (verifies fallback message and absence of viewer).
    • Empty string document_id (verifies fallback message and absence of viewer).
    • Valid document_id (verifies viewer renders with exact document ID).
  • Tooling & Secret Scanning: Uses vi.hoisted for Vitest mock hoisting and includes // pragma: allowlist secret for the auth mock to satisfy CI secret scanners (detect-secrets).

VERDICT: PASS

Resolve ingest page conflict: keep #3653 empty-state fallback (no
DEMO-DOC-ID) and keep #3665 activeSaveError callout in the completed
panel. Update ingest-csv test expectations accordingly.

Signed-off-by: Christopher <131207452+PetrefiedThunder@users.noreply.github.com>
@PetrefiedThunder

Copy link
Copy Markdown
Collaborator Author

REVIEW: PASS hermes ff2daa4

Merge ff2daa4 (PR + origin/main 4823440) keeps both sides of ingest/page.tsx: Muse empty state (completedDocumentId = document_id only; no DEMO-DOC-ID / job_id fallback; "No normalized document is available for this ingest.") and #3665 activeSaveError Callout. ingest-csv.test.tsx asserts empty state + no viewer receipt. No hermes commits on branch. Preview badges intact; no FDA/compliance-guarantee claims; DEMO-DOC-ID only in a test comment.

Local (SSD, load~7): vitest ingest-csv + ingest-normalized-viewer 19/19; tsc --noEmit exit 0; eslint touched files 0 errors (1 preexisting react-hooks/set-state-in-effect warning at page.tsx:221 from merged main). CI at post: CodeQL Analyze + Semgrep still queued/pending; Bugbot/Vercel pass; PR Blocker fail (expected pre-PASS). No push/merge.

This branch was successfully deployed

1 active deployment
Preview — ff2daa46 Deployed Oct 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant