Repository navigation
ADR 002 Async Processing MongoDB Queue
Superseded. Never implemented, and its premise never held in this environment. The pipeline that replaced it is Extraction-Pipeline.
File processing — text extraction, OCR, rule-based classification — took 1 to 120+ seconds per document against a 20-second upload target, so it had to run asynchronously.
An earlier proposal used pg-boss, a PostgreSQL-backed queue. That was rejected because eagle-api was MongoDB-only and adding PostgreSQL for one feature was expensive overhead. eagle-api already ran MongoDB change streams for the Typesense sync.
Processing used a MongoDB document-state plus change-stream worker pattern, with no additional queue infrastructure.
- Documents carried
processingStatus(pending,processing,processed,failed,dead_letter), timestamps, an error string, a retry count and the id of the claiming worker. - A worker watched for
pendingdocuments and claimed each one with an atomicfindOneAndUpdate, which prevents two workers taking the same job. - Failures moved to a dead-letter state after three retries.
- Monitoring was a MongoDB count query; no dashboard or broker was needed.
Upload volume was 50-200 documents per day at peak, well below the point where a distributed queue earns its operating cost.
The pattern depends on MongoDB change streams, which Cosmos DB for MongoDB API does not support.
The watcher exits when db.command({hello:1}) reports no setName, and the Mongo API never
reports one, so the design was inert from the day it was written. The Mongo API account was deleted
on 2026-08-04 and the mongodb driver was removed from the repository.
Extraction instead runs off the platform and posts markdown to POST /api/documents/:id/chunks,
which is idempotent, and Azure AI Search indexers pull from Cosmos on a PT5M schedule. There is
no queue.
- Environment Reality & Gotchas
- Architecture
- Seeding — filling Cosmos from Track and Eagle
- Sources and Status — every source, one state
- Search & Retrieval — overview
- Search Index Reference
- Search Query Construction
- Search Measurements
- Extraction Pipeline
- Extraction Quality — coverage, word-joining, tiling
- Identity Model — which id means what
- Attribute-Level Access — field-visibility levels, catalog
- Sync Architecture — how records get in
- Eagle Mirror Reference — mirrored kinds, refusals, drift classes
- ENGAGE Rows Reference — ENGAGE-owned comment periods, reconcile
- Public-Read Backfill — filling and repairing the mirror containers
-
Short Links —
/s/{code}redirect and/api/links -
Recent Uploads —
/api/documents/recent-uploads, eagle-public homepage panel - Reports — comment export and BCGW CSV reads
-
User Data — saved map areas, preferences,
/meroutes -
Bulk Download —
/api/bulk-downloads, zip jobs - Bulk Download: Operations — enable, poison-queue runbook
- Document Intake — upload link, malware scan, release
- Connecting an Application to DEMI
- Azure Environments
- Document Backup — archive copy of originals, run and check
- Document Backup: Revert and Drill — put documents back from the archive
- PDF Titles — public name written into stored PDFs, run, restore
- Secret Sync — Key Vault, secret-sync Function app, required names
-
Operating DEMI in Azure — deploy, verify
- Operating the DEMI Data Plane — devbox access, probes, audit and cost reads
- Edge ban detector — hourly timer, modes, kill switch, soak and promote
-
CI Workflows — every GitHub Actions workflow, trigger, identity, roles
- CI Deploy Workflows — eagle-demi staging and production deploys
- CI Admin Frontend Workflows — eagle-demi-admin checks and deploys
- Release Process — cutting, tagging, shipping and rolling back a version
- Runbook: Search Outage — index/app schema drift, diagnose, fix, roll back
- BC Gov Landing Zone
- Business Rules
- EPIC.search Business Rules — where DEMI differs from EPIC.search
- 001: Typesense for DFL Search — superseded
- 002: Async Processing (MongoDB Queue) — superseded
- 003: Rule-Based Classification
- 004: Read ACL Authorization Model
- 005: Cosmos Full-Text Search Ruled Out
- 006: AI Summarization over BM25
- 007: Service-to-Service Credentials
- 008: Audit and Usage Analytics Store
- 009: Track Feed — proposed
- 010: Attribute-Level Access Control
- 011: Public Read Surface
- 012: Public Config Surface
- 013: Stored Project Summaries — proposed
- 014: Sync-out to Eagle
- 015: Malware scanning on intake