feat(ingestion): submit files to a tenant, originals by hash, draft records #63

Merged
crapougnax merged 1 commit from feat/38-ingestion into develop 2026-11-19 20:11:40 +00:00
Owner

Refs #38 (step 4b, first part: taking files in)

Submission POST /t/<tenant>/api/tenant/ingestion (curators; multipart theme + up to 20 files: PDF, text, Markdown, HTML, DOCX, ODT, EPUB, 50 MB each)

  • Each original goes to the S3 storage of the tenant under originals/sha256/<hash> (TenantStorage, credentials read from the sealed secrets inside the tenant scope, endpoint checked against local and private addresses before each call). The same content is stored once.
  • A file whose content a document already cites is not taken again; the answer links that document. Documents written before OKF v0.2 count, through their fileHash.

Draft records (TenantIngestion.process)

  • A queue task writes status: draft, rights: unknown, generated.by: process:ingestion, the original as first source (resource, sha256, media_type), an empty body; title from the file name; a free slug (-2, -3…).
  • One commit, authored by the curator who submitted the file, with the indexes; nothing when a document already cites the original.

Queue (ingestion.sqlite under TENANT_DATA_PATH)

  • One topic per tenant, one task at a time; GET /t/<tenant>/api/tenant/ingestion lists the tasks of the tenant.
  • Each task carries a scope envelope (tenant + curator) reopened by scopeForEnvelope: a tenant suspended, or a curator removed, since the submission is refused.

Library: Déposer des fichiers (curators): theme, drop zone, what became of each file, the recent tasks refreshed every 3 s.

Docs: section 10 of docs/MULTI-TENANCY.md (EN, FR).

Next: 4b-2, the analysis by the language model of the tenant (text extraction, summary, metadata, facets), then 4b-3, the À revoir page.

Checks: yarn test 245/245 (11 new: storage by hash, duplicates including legacy fileHash, draft record and its commit, free slugs, foreign task refused, per-tenant topics). yarn build passes. tsc --noEmit: the same 11 errors as on develop. Not tried against a real S3 nor in a browser.

🤖 Generated with Claude Code

Refs #38 (step 4b, first part: taking files in) **Submission** `POST /t/<tenant>/api/tenant/ingestion` (curators; multipart `theme` + up to 20 `files`: PDF, text, Markdown, HTML, DOCX, ODT, EPUB, 50 MB each) - Each original goes to the S3 storage of the tenant under `originals/sha256/<hash>` (`TenantStorage`, credentials read from the sealed secrets inside the tenant scope, endpoint checked against local and private addresses before each call). The same content is stored once. - A file whose content a document already cites is not taken again; the answer links that document. Documents written before OKF v0.2 count, through their `fileHash`. **Draft records** (`TenantIngestion.process`) - A queue task writes `status: draft`, `rights: unknown`, `generated.by: process:ingestion`, the original as first source (`resource`, `sha256`, `media_type`), an empty body; title from the file name; a free slug (`-2`, `-3`…). - One commit, authored by the curator who submitted the file, with the indexes; nothing when a document already cites the original. **Queue** (`ingestion.sqlite` under `TENANT_DATA_PATH`) - One topic per tenant, one task at a time; `GET /t/<tenant>/api/tenant/ingestion` lists the tasks of the tenant. - Each task carries a scope envelope (tenant + curator) reopened by `scopeForEnvelope`: a tenant suspended, or a curator removed, since the submission is refused. **Library**: *Déposer des fichiers* (curators): theme, drop zone, what became of each file, the recent tasks refreshed every 3 s. Docs: section 10 of `docs/MULTI-TENANCY.md` (EN, FR). Next: 4b-2, the analysis by the language model of the tenant (text extraction, summary, metadata, facets), then 4b-3, the *À revoir* page. Checks: `yarn test` 245/245 (11 new: storage by hash, duplicates including legacy `fileHash`, draft record and its commit, free slugs, foreign task refused, per-tenant topics). `yarn build` passes. `tsc --noEmit`: the same 11 errors as on `develop`. **Not tried against a real S3 nor in a browser.** 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(ingestion): submit files to a tenant, originals by hash, draft records (#38)
All checks were successful
Build and Publish OCI Image / Build & Push ARM64 OCI Image (pull_request) Successful in 1m3s
f8999d2cef
Curators submit files from the Library to a theme. Each original goes to
the object storage of the tenant under originals/sha256/<hash>, stored
once; a file whose content a document already cites, including through
the fileHash of a document written before OKF v0.2, is not taken again.

A task of the ingestion queue, one topic per tenant, then writes the
draft record: status draft, rights unknown, produced by
process:ingestion, the original as first source; one commit authored by
the submitting curator, with the indexes. Each task reopens the scope of
its tenant and curator, so a suspended tenant or a removed curator is
refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crapougnax merged commit b74e27fb74 into develop 2026-11-19 20:11:40 +00:00
crapougnax deleted branch feat/38-ingestion 2026-11-19 20:11:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
modaka/studio!63
No description provided.