feat(curation): save the documents of a tenant, one commit per save #61

Merged
crapougnax merged 1 commit from feat/38-tenant-curation-api into develop 2026-11-19 19:25:53 +00:00
Owner

Refs #38 (step 4a, first part: the server side)

Routes (tenant URL, members read, tenant admin and curator write)

Route Does
GET /t/<tenant>/api/tenant/documents/<theme>/<slug> Reads a document, converted to OKF v0.2 when written before
PUT …/documents/<theme>/<slug> Saves a change: title, description, type, tags, thematics, facets, rights, body
POST …/documents/<theme> Creates a document, its file named after its title once and for all

One save, one commit (TenantDocuments, src/instance/tenant-documents.ts)

  • Written through writeStudioDocument (#52): required keys, rights, themes and facet vocabularies of the tenant. Facet values are made canonical; those set aside come back as rejected.
  • Authored by the curator (name and address), pushed at once with the token of the tenant. A save that changes nothing makes no commit.
  • The same commit regenerates the index of the theme and content/index.md (okf_version: "0.2", the only index with a frontmatter).
  • Provenance: saving an existing document adds the curator to verified; creating one sets generated to the curator. The file name never changes with the title.
  • A tenant without soa cannot save (409).

Atomic writes (TenantWorkspaceInterface.change)

  • Saves of a tenant run one after the other.
  • Refused push because the repository moved: discard() (@quatrain/git 1.0.3), then the change is applied again on top, once.
  • Whatever fails (profile 422, name taken 409, repository 502), nothing of the change stays in the working copy.

Also: an undeclared theme takes its label from the # heading of its index, since a v0.2 index has no frontmatter. Docs: section 9 of docs/MULTI-TENANCY.md (EN, FR).

Next PR: the curation page (document page from the Library, form with facets and rights, creation of a document and of a theme).

Checks: yarn test 229/229 (12 new, against a real local git remote: concurrent push, refused push, profile refusal leaving a clean working copy). yarn build passes. tsc --noEmit: the same 11 errors as on develop.

🤖 Generated with Claude Code

Refs #38 (step 4a, first part: the server side) **Routes** (tenant URL, members read, tenant `admin` and `curator` write) | Route | Does | |---|---| | `GET /t/<tenant>/api/tenant/documents/<theme>/<slug>` | Reads a document, converted to OKF v0.2 when written before | | `PUT …/documents/<theme>/<slug>` | Saves a change: `title`, `description`, `type`, `tags`, `thematics`, `facets`, `rights`, `body` | | `POST …/documents/<theme>` | Creates a document, its file named after its title once and for all | **One save, one commit** (`TenantDocuments`, `src/instance/tenant-documents.ts`) - Written through `writeStudioDocument` (#52): required keys, rights, themes and facet vocabularies of the tenant. Facet values are made canonical; those set aside come back as `rejected`. - Authored by the curator (name and address), pushed at once with the token of the tenant. A save that changes nothing makes no commit. - The same commit regenerates the index of the theme and `content/index.md` (`okf_version: "0.2"`, the only index with a frontmatter). - Provenance: saving an existing document adds the curator to `verified`; creating one sets `generated` to the curator. The file name never changes with the title. - A tenant without `soa` cannot save (409). **Atomic writes** (`TenantWorkspaceInterface.change`) - Saves of a tenant run one after the other. - Refused push because the repository moved: `discard()` (`@quatrain/git` 1.0.3), then the change is applied again on top, once. - Whatever fails (profile 422, name taken 409, repository 502), nothing of the change stays in the working copy. Also: an undeclared theme takes its label from the `# heading` of its index, since a v0.2 index has no frontmatter. Docs: section 9 of `docs/MULTI-TENANCY.md` (EN, FR). Next PR: the curation page (document page from the Library, form with facets and rights, creation of a document and of a theme). Checks: `yarn test` 229/229 (12 new, against a real local git remote: concurrent push, refused push, profile refusal leaving a clean working copy). `yarn build` passes. `tsc --noEmit`: the same 11 errors as on `develop`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(curation): save the documents of a tenant, one commit per save (#38)
All checks were successful
Build and Publish OCI Image / Build & Push ARM64 OCI Image (pull_request) Successful in 56s
c8233ff250
Curation routes under the tenant URL read, change and create the
documents of the tenant repository through the OKF v0.2 profile. Every
save is one commit authored by the curator, pushed at once with the
token of the tenant, holding the document and the regenerated indexes
of its theme and of the root. A curator saving an existing document is
recorded in verified; one creating it, in generated. Facet values are
brought to the vocabularies of the tenant.

The workspace gains change(): saves of a tenant run one after the
other; when the repository moved before the push, the working copy is
discarded back to it and the change applied again, once; whatever
fails, nothing of the change stays behind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crapougnax merged commit 71e24d4420 into develop 2026-11-19 19:25:53 +00:00
crapougnax deleted branch feat/38-tenant-curation-api 2026-11-19 19:25:54 +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!61
No description provided.