Services & ownership
Current ownership includes direct Next app SQL and document jobs inside product-worker. Future boundaries are labelled.
Ownership follows the service that reads or changes a resource. The table distinguishes running processes from capabilities that still need implementation.
| Component | Status | Responsibility |
|---|---|---|
| Next app | Implemented | Browser UI, Clerk sessions, same-origin gateway and some direct product database access |
| Product API | Partial | Workspace commands and authorization; some app routes still access product data directly |
| Product worker | Implemented | Durable task execution, document jobs, evidence checks and provider accounting |
| Document engine | Implemented | Ingestion and export jobs inside the product worker |
| Separate document service | Target | No independent process or service contract is implemented |
| Document parser | Implemented | Separate process for bounded parsing and OCR |
| Legal Core | Partial | Search and pinned source reads are implemented; specialist analytics and classification execution remain incomplete |
| Corpus worker | Partial | Prepared source/global imports and indexing exist; full acquisition/enrichment pipelines do not |
| Public Legal API | Partial | Preview facade; production integration management is incomplete |
| MCP adapter | Target | No implemented server in this repository |
Why these boundaries matter
Section titled “Why these boundaries matter”Private document jobs need the same tenant scope, revision checks and accounting as the task that requested them. Keeping those jobs inside the product worker lets them use the existing product transactions; the parser only receives the bytes it needs. It does not decide who may read a project.
Product-to-legal access goes through workload-authenticated HTTP. The separate legal database roles prevent a product query from bypassing legal publication and content checks. Enforcement is in services/legal-core-api/internal/auth/, corpus readable views and TestLegalBaseline in internal/migrations/postgres_integration_test.go.
DBOS and the model gateway are embedded worker packages. Durable execution explains committed work; Model gateway owns provider-call behavior. Moving all product SQL behind Product API is a target refactor, not an existing security guarantee.