Skip to content

H-6363: Add /ingest route to HASH frontend#8566

Draft
lunelson wants to merge 4 commits intomainfrom
ln/h-6363-ingest-route
Draft

H-6363: Add /ingest route to HASH frontend#8566
lunelson wants to merge 4 commits intomainfrom
ln/h-6363-ingest-route

Conversation

@lunelson
Copy link
Contributor

@lunelson lunelson commented Mar 23, 2026

🌟 What is the purpose of this PR?

Add an /ingest route to the HASH frontend that proxies to the Mastra API from the internal repo, enabling PDF upload and discovery pipeline results viewing.

🔗 Related links

  • H-6363 — Add a route to HASH app for current prototype
  • H-6290 — End-to-end MVP atop HASH of unstructured ingest (parent)

🚫 Blocked by

  • Nothing

🔍 What does this change?

  • Add /ingest upload page with Ark UI FileUpload drag-and-drop zone and SSE progress display
  • Add /ingest/results page with roster/claims sidebar and PDF page viewer with bbox overlays
  • Add Next.js rewrites to proxy /api/ingest/*localhost:4111/discovery-runs/* (Mastra API)
  • Add /api/ingest-fixtures/* rewrite for fixture data
  • Add "Ingest" sidebar link under Agents section, gated on workers feature flag
  • Add @ark-ui/react dependency (version-aligned at 5.26.2 with ds-components and petrinaut)
  • Add useIngestRun hook for upload + SSE EventSource progress streaming
  • Add contract types mirroring internal repo's pipeline schemas (RunStatus, IngestRunView, etc.)
  • Add .gitignore for memory/ directory (AI-generated working docs)

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are in a state where docs changes are not yet required but will be

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

  • Components are a first pass ported from the internal repo prototype — data shapes and design will evolve
  • Requires Mastra API (port 4111) from internal repo to be running for upload/results to work

🐾 Next steps

  • H-6364: Temporal wiring + UI redesign (stacked PR)
  • Ingest UI redesign with assertion-centric entity cards (per design reference)
  • hash-api GraphQL integration (pending team discussion)

🛡 What tests cover this?

  • turbo lint:tsc --filter=@apps/hash-frontend — type checking
  • yarn fix:eslint — zero lint errors
  • yarn fix:format — formatting clean

❓ How to test this?

  1. Start HASH external services: yarn external-services up -d
  2. Start graph + API + frontend: yarn start:graph, yarn dev:backend, yarn dev:frontend
  3. Start Mastra API from internal repo: TEMPORAL_NAMESPACE=HASH yarn dev:api
  4. Log in as alice@example.com / password
  5. Navigate to /ingest — upload panel renders within sidebar layout
  6. Upload a PDF — progress streaming appears (requires Temporal workers running)

📹 Demo

@vercel
Copy link

vercel bot commented Mar 23, 2026

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

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Mar 25, 2026 5:47pm
petrinaut Ready Ready Preview, Comment Mar 25, 2026 5:47pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign Ignored Ignored Preview Mar 25, 2026 5:47pm
hashdotdesign-tokens Ignored Ignored Preview Mar 25, 2026 5:47pm

@github-actions github-actions bot added area/deps Relates to third-party dependencies (area) area/apps > hash* Affects HASH (a `hash-*` app) area/infra Relates to version control, CI, CD or IaC (area) type/eng > frontend Owned by the @frontend team area/apps labels Mar 23, 2026
Copy link
Contributor Author

lunelson commented Mar 23, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@lunelson lunelson changed the title codex ignores H-6363: Add /ingest route to HASH frontend Mar 23, 2026
@cursor
Copy link

cursor bot commented Mar 25, 2026

PR Summary

Medium Risk
Adds new UI routes and a Next.js rewrite proxy that forwards uploads and SSE progress/events to an external Mastra API, which could affect routing/network behavior if misconfigured. Changes are otherwise isolated to a new feature area and a gated sidebar link.

Overview
Adds a new Ingest feature in the frontend: an /ingest page to upload PDFs and stream pipeline progress via SSE, plus an /ingest/results page that loads fixture/run views and supports click-to-highlight evidence with page-image bbox overlays.

Updates next.config.js with rewrites to proxy /api/ingest* and /api/ingest-fixtures* to the Mastra API origin (configurable via MASTRA_API_ORIGIN), adds an Ingest nav item under the workers/agents section, and introduces @ark-ui/react (plus a fix:format script) for the drag-and-drop upload UI.

Written by Cursor Bugbot for commit 456597a. This will update automatically on new commits. Configure here.

@graphite-app graphite-app bot requested review from a team March 25, 2026 14:26
@augmentcode
Copy link

augmentcode bot commented Mar 25, 2026

🤖 Augment PR Summary

Summary: Adds a new ingest experience to the HASH frontend, including an upload page and a results viewer backed by a proxied Mastra API.

Changes:

  • Add Next.js rewrites to proxy /api/ingest* and /api/ingest-fixtures* to the Mastra discovery endpoints (configurable via MASTRA_API_ORIGIN).
  • Introduce /ingest upload UI using Ark UI FileUpload, plus an SSE-driven progress hook (useIngestRun).
  • Add /ingest/results page with roster + claims sidebar, selection→evidence resolver, and a PDF page viewer with bbox overlays.
  • Add TypeScript contract types mirroring the internal pipeline schemas and routing helpers for fixtures vs runs.
  • Add an “Ingest” sidebar link under Agents (gated by the workers feature flag), plus a Biome format script and a memory/ ignore entry.

Notes: Upload/results require the Mastra API to be running (default localhost:4111); fixtures are available via the fixture rewrite.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 5 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

lunelson and others added 4 commits March 25, 2026 18:17
Port the discovery pipeline UI from the internal agent-workflows prototype
into the main HASH frontend as an /ingest route. Adds:

- PDF upload with Ark UI FileUpload + SSE progress streaming
- Results view with roster/claims sidebar and PDF page viewer with bbox overlays
- Next.js rewrites to proxy /api/ingest/* to Mastra API (port 4111)
- Sidebar navigation link under Agents section

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Git-ignore the memory/ directory used for AI-generated working documents
(roadmaps, plans, research notes). Excluded from linters/formatters
automatically via gitignore integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

return () => {
abortController.abort();
};
}, [source]);
Copy link

Choose a reason for hiding this comment

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

Missing router.isReady guard causes spurious initial fetch

Medium Severity

On the first render in Next.js, router.query is an empty object before hydration. The source useMemo evaluates with undefined query params, defaulting to { kind: "fixture", fixtureId: DEFAULT_FIXTURE_ID }. This triggers the useEffect to fetch the default fixture endpoint — even when the actual URL has ?runId=.... After hydration, router.query populates, source recomputes, and a second fetch fires (aborting the first). The result is a wasted network request to the fixture endpoint, which may flash an error if that endpoint isn't available, and a brief flicker of loading state. Guarding on router.isReady before computing source or running the fetch effect would prevent this.

Additional Locations (1)
Fix in Cursor Fix in Web

@@ -0,0 +1 @@
environments/
Copy link

Choose a reason for hiding this comment

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

Unrelated .codex gitignore accidentally included in PR

Low Severity

The .codex/.gitignore file ignoring environments/ appears unrelated to the PR's purpose of adding an /ingest route. The PR description explicitly lists a .gitignore for memory/ but doesn't mention this .codex change. It looks like a developer tooling artifact that was inadvertently staged alongside the feature work.

Fix in Cursor Fix in Web

Comment on lines +111 to +115
{
title: "Ingest",
path: "/ingest",
activeIfPathMatches: /^\/ingest/,
},
Copy link
Member

Choose a reason for hiding this comment

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

I would not add this to the sidebar now as the page will be broken in production. The internal API is not accessible to the frontend in production so the current approach will never work there, and this is only for local development purposes at the moment – can we remove this?

@lunelson lunelson marked this pull request as draft March 26, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants