Skip to content

Add the host-agnostic ingest pipeline as @corbits/granola/ingest - #6

Merged
TheGreatAxios merged 3 commits into
mainfrom
ingest-pipeline
Aug 3, 2026
Merged

Add the host-agnostic ingest pipeline as @corbits/granola/ingest#6
TheGreatAxios merged 3 commits into
mainfrom
ingest-pipeline

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Moves Scout's Granola ingestion pipeline upstream as a new ./ingest export: webhook event → fetch note → resolve bucket → persist transcript → knowledge capture → bucket-type handler.

The pipeline was already chat-agnostic behind its lifecycle seam (Scout CL-5116); this genericizes the two remaining host couplings into ports:

  • GranolaTranscriptStore<TRef> (hasTranscript/persist) replaces the concrete artifacts engine; TRef is opaque and threads through to bucket handlers and knowledge capture.
  • GranolaKnowledgeCapture<TRef> replaces the concrete knowledge plane; enrichment, never a gate.
  • The host principal never reaches the pipeline — host adapters close over it.

Also carries the onNoteNotGenerated lifecycle hook: a 404 on note.access_granted is documented Granola behavior (ungenerated note added to a folder), distinct from real fetch failures.

12 pipeline tests; tsc --noEmit clean. Scout-side consumption: corbitsdev/scout will follow with a pin bump (CL-5240).

Moves Scout's Granola ingestion pipeline (webhook event -> fetch note ->
resolve bucket -> persist transcript -> knowledge capture -> bucket-type
handler) upstream, where any host can use it. The pipeline was already
chat-agnostic behind its lifecycle seam; this move genericizes the two
remaining host couplings into injected ports:

- transcripts: GranolaTranscriptStore<TRef> (hasTranscript/persist) in
  place of a concrete artifacts engine; TRef is opaque and threads
  through to bucket handlers and knowledge capture
- captureKnowledge: GranolaKnowledgeCapture<TRef> in place of a concrete
  knowledge plane; enrichment, never a gate

Hosts keep their lifecycle rendering, storage adapters, and bucket
handlers; the host principal never reaches the pipeline (adapters close
over it). Includes the not-generated-yet 404 handling for
note.access_granted.
- test:ingest script + test-ingest CI job, mirroring test-tools/test-ingress
- GranolaBucketHandlerContext/GranolaBucketHandler now generic over TAnchor
  (defaulted to GranolaThreadAnchor), removing the unsound double-cast at
  the handler dispatch site in pipeline.ts
- ARCHITECTURE.md and CONTRIBUTING.md now describe src/ingest as the third
  face and its dependency direction
@TheGreatAxios

Copy link
Copy Markdown
Contributor Author

Pushed three changes from a review pass on this branch:

  1. CI coverage for the new tests — added test:ingest script and a test-ingest CI job, mirroring test-tools/test-ingress exactly.
  2. Fixed the TAnchor unsoundnessGranolaBucketHandlerContext/GranolaBucketHandler are now generic over TAnchor (defaulted to GranolaThreadAnchor, so existing call sites keep compiling unchanged), and the anchor as unknown as GranolaThreadAnchor double-cast in pipeline.ts is gone. No behavior change — bun test (73/73), bun run typecheck, and bun run check-deps are all clean.
  3. Docs now describe three faces — ARCHITECTURE.md and CONTRIBUTING.md cover src/ingest, its dependency direction, and the new test:ingest job.

@TheGreatAxios
TheGreatAxios merged commit d0cac2a into main Aug 3, 2026
6 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.

1 participant