Workspace ticket #171: the customer's document store, registry side, part A. Decided 2026-10-20: same store, new view; roles as for the company profile (the portal checks them); the Factory pulls through a later API (part B); no K-00001 data on stage, only a synthetic dummy test of the staff import.
Data (migration 0022)
documents:
area: legal_web / product_public / internal. NULL means BreakPilot's deliveries ("Unterlagen"), which are unchanged.
legal_kind: the 8 folders, as the workspace and the Factory name them (impressum, dse, cookie, agb, widerruf, barrierefreiheit, entsorgung, vsbg).
processing_status: none / pending / ready / failed, plus a reason.
external_id: the Factory's tenant_document_id, unique per tenant.
document_preparations: the delivered chunk file (LANE_B_UNIFIED_V5: format, revision, pin, unit count, image digests) and/or the cookie-banner capture. Each part has its object and SHA-256; a part that isn't delivered again stays as stored.
store_assets: images per tenant, content-addressed.
API
Route
What
GET /v1/tenants/{id}/store
Documents by area and folder order, with processing status and a summary of the preparation
POST /v1/tenants/{id}/store/documents
Customer upload: area, legal_kind, product_id (internal only, a product of the workspace), title, process, file (pdf/docx/txt/html). Legal and product documents get pending; an internal one only when process=on (confidential documents leave for the Factory only on request)
GET …/store/documents/{doc}/original
The original inline
GET …/prepared, …/consent-banner, …/store/assets/{sha}
Chunk file, capture, image
POST /v1/admin/tenants/{id}/store/import
Staff import of a bundle, named staff member only
Fail-closed: every delivery hashes the object into a temporary file and compares it with the stored SHA-256 before sending anything. A mismatch returns 502 digest_mismatch, with no bytes. HTML originals carry a sandboxing CSP.
Import: a .tar.gz in the Factory's run layout (index, objects/, captures, chunks/, figure_assets/, manifest). The prod import of K-00001 later takes exactly this path.
Refused: unsafe paths, links, more than 20,000 files, more than STORE_IMPORT_MAX_MB (default 2 GiB).
Every file is checked against its digest.
Keyed on tenant_document_id, so it can be rerun: whatever already exists unchanged is skipped.
A preparation with a missing image is not taken; the original still is.
The answer has an outcome per document (imported / exists / unchanged / absent / rejected + reason), never content.
Audit events: store.uploaded and store.imported, without content. Lists of "Unterlagen" show only area NULL. Deleting a store document also removes its prepared files.
Tests (synthetic data only)
Upload rules, including no bytes stored on a refused upload.
Delivery: correct bytes and headers, a tampered object returns 502 with no bytes, a missing object returns 404, nothing before delivery.
Tenant isolation: another workspace's user gets 404 everywhere; "Unterlagen" can't be reached via the store routes.
Import:
6 documents: legal txt originals, PDF with page image and figure, capture, unknown folder, missing image, absent original;
a rerun creates nothing new;
unsafe archives are refused;
the size limit holds.
The store contract on memory and Postgres (order, external-ID uniqueness, merging of the parts, images per tenant, delete).
Migration up/down.
go test -short ./... passes.
Next
Portal A (tree, original, upload, admin import) for the dummy test on stage, then Portal B (prepared view) and Registry B (the Factory's pull API plus its service client, with the user's go).
Workspace ticket #171: the customer's document store, registry side, part A. Decided 2026-10-20: **same store, new view**; roles as for the company profile (the portal checks them); the Factory pulls through a later API (part B); **no K-00001 data on stage**, only a synthetic dummy test of the staff import.
## Data (migration 0022)
- `documents`:
- `area`: `legal_web` / `product_public` / `internal`. NULL means BreakPilot's deliveries ("Unterlagen"), which are unchanged.
- `legal_kind`: the 8 folders, as the workspace and the Factory name them (`impressum, dse, cookie, agb, widerruf, barrierefreiheit, entsorgung, vsbg`).
- `processing_status`: `none / pending / ready / failed`, plus a reason.
- `external_id`: the Factory's `tenant_document_id`, unique per tenant.
- `document_preparations`: the delivered chunk file (LANE_B_UNIFIED_V5: format, revision, pin, unit count, image digests) and/or the cookie-banner capture. Each part has its object and SHA-256; a part that isn't delivered again stays as stored.
- `store_assets`: images per tenant, content-addressed.
## API
| Route | What |
|---|---|
| `GET /v1/tenants/{id}/store` | Documents by area and folder order, with processing status and a summary of the preparation |
| `POST /v1/tenants/{id}/store/documents` | Customer upload: `area`, `legal_kind`, `product_id` (internal only, a product of the workspace), `title`, `process`, `file` (pdf/docx/txt/html). Legal and product documents get `pending`; an internal one only when `process=on` (confidential documents leave for the Factory only on request) |
| `GET …/store/documents/{doc}/original` | The original inline |
| `GET …/prepared`, `…/consent-banner`, `…/store/assets/{sha}` | Chunk file, capture, image |
| `POST /v1/admin/tenants/{id}/store/import` | Staff import of a bundle, named staff member only |
**Fail-closed:** every delivery hashes the object into a temporary file and compares it with the stored SHA-256 before sending anything. A mismatch returns 502 `digest_mismatch`, with no bytes. HTML originals carry a sandboxing CSP.
**Import:** a `.tar.gz` in the Factory's run layout (index, `objects/`, captures, `chunks/`, `figure_assets/`, manifest). The prod import of K-00001 later takes exactly this path.
- Refused: unsafe paths, links, more than 20,000 files, more than `STORE_IMPORT_MAX_MB` (default 2 GiB).
- Every file is checked against its digest.
- Keyed on `tenant_document_id`, so it can be rerun: whatever already exists unchanged is skipped.
- A preparation with a missing image is not taken; the original still is.
- The answer has an outcome per document (`imported / exists / unchanged / absent / rejected` + reason), never content.
Audit events: `store.uploaded` and `store.imported`, without content. Lists of "Unterlagen" show only area NULL. Deleting a store document also removes its prepared files.
## Tests (synthetic data only)
- Upload rules, including no bytes stored on a refused upload.
- Delivery: correct bytes and headers, a tampered object returns 502 with no bytes, a missing object returns 404, nothing before delivery.
- Tenant isolation: another workspace's user gets 404 everywhere; "Unterlagen" can't be reached via the store routes.
- Import:
- 6 documents: legal txt originals, PDF with page image and figure, capture, unknown folder, missing image, absent original;
- a rerun creates nothing new;
- unsafe archives are refused;
- the size limit holds.
- The store contract on **memory and Postgres** (order, external-ID uniqueness, merging of the parts, images per tenant, delete).
- Migration up/down.
- `go test -short ./...` passes.
## Next
Portal A (tree, original, upload, admin import) for the dummy test on stage, then Portal B (prepared view) and Registry B (the Factory's pull API plus its service client, with the user's go).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Workspace ticket #171 (decided 2026-10-20): the tenant's own documents
live next to BreakPilot's deliveries ("Unterlagen") in the same table and
bucket, in three areas, with the original and the prepared version the
Factory delivers.
- migration 0022: documents get area (legal_web / product_public /
internal; NULL = Unterlagen), legal_kind (the 8 folders as the workspace
and Factory name them), processing_status (none/pending/ready/failed),
external_id (the Factory's tenant_document_id, unique per tenant);
document_preparations (chunk file and/or cookie-banner capture with
digest, format, revision, pin, image digests); store_assets (images per
tenant, content-addressed)
- GET /v1/tenants/{id}/store; POST …/store/documents (customer upload:
legal folder, product of an internal document; legal and product
documents wait for the Factory, an internal one only on request);
GET …/original, …/prepared, …/consent-banner and …/store/assets/{sha}:
every byte is hashed and compared before anything is sent (fail-closed,
502 digest_mismatch), HTML originals sandboxed
- POST /v1/admin/tenants/{id}/store/import (named staff only): a .tar.gz in
the Factory's run layout; unsafe paths and links refused, every file
checked against its digest, keyed on tenant_document_id so it can run
again; per-document outcome, never content
- Unterlagen lists stay as they were (area NULL only); deleting a store
document removes its prepared files; storage gains Get
- OpenAPI for the seven routes; tests on memory and Postgres with
synthetic data only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Workspace ticket #171: the customer's document store, registry side, part A. Decided 2026-10-20: same store, new view; roles as for the company profile (the portal checks them); the Factory pulls through a later API (part B); no K-00001 data on stage, only a synthetic dummy test of the staff import.
Data (migration 0022)
documents:area:legal_web/product_public/internal. NULL means BreakPilot's deliveries ("Unterlagen"), which are unchanged.legal_kind: the 8 folders, as the workspace and the Factory name them (impressum, dse, cookie, agb, widerruf, barrierefreiheit, entsorgung, vsbg).processing_status:none / pending / ready / failed, plus a reason.external_id: the Factory'stenant_document_id, unique per tenant.document_preparations: the delivered chunk file (LANE_B_UNIFIED_V5: format, revision, pin, unit count, image digests) and/or the cookie-banner capture. Each part has its object and SHA-256; a part that isn't delivered again stays as stored.store_assets: images per tenant, content-addressed.API
GET /v1/tenants/{id}/storePOST /v1/tenants/{id}/store/documentsarea,legal_kind,product_id(internal only, a product of the workspace),title,process,file(pdf/docx/txt/html). Legal and product documents getpending; an internal one only whenprocess=on(confidential documents leave for the Factory only on request)GET …/store/documents/{doc}/originalGET …/prepared,…/consent-banner,…/store/assets/{sha}POST /v1/admin/tenants/{id}/store/importFail-closed: every delivery hashes the object into a temporary file and compares it with the stored SHA-256 before sending anything. A mismatch returns 502
digest_mismatch, with no bytes. HTML originals carry a sandboxing CSP.Import: a
.tar.gzin the Factory's run layout (index,objects/, captures,chunks/,figure_assets/, manifest). The prod import of K-00001 later takes exactly this path.STORE_IMPORT_MAX_MB(default 2 GiB).tenant_document_id, so it can be rerun: whatever already exists unchanged is skipped.imported / exists / unchanged / absent / rejected+ reason), never content.Audit events:
store.uploadedandstore.imported, without content. Lists of "Unterlagen" show only area NULL. Deleting a store document also removes its prepared files.Tests (synthetic data only)
go test -short ./...passes.Next
Portal A (tree, original, upload, admin import) for the dummy test on stage, then Portal B (prepared view) and Registry B (the Factory's pull API plus its service client, with the user's go).
🤖 Generated with Claude Code
251cddf3d3to94da0e0013