From 0d719594405956bef8e08fa54097c87415b36d34 Mon Sep 17 00:00:00 2001 From: f451-admin Date: Thu, 1 Oct 2026 22:56:46 +0200 Subject: [PATCH] Demo content from demo/developer-guide (684ae12) --- api/index.md | 34 ++++++++++++++++++++++++++++++++++ architecture/index.md | 25 +++++++++++++++++++++++++ markdown-and-editor/index.md | 12 ++++++++++++ 3 files changed, 71 insertions(+) diff --git a/api/index.md b/api/index.md index 3e4e838..5b5f624 100644 --- a/api/index.md +++ b/api/index.md @@ -71,6 +71,40 @@ the *current* SHA and content instead of silently overwriting it. The caller is expected to re-fetch, reconcile, and retry with the new `baseSha`. +## Release archive routes + +In a versioned space, `release_page` (and the review release) accepts an +`archive` flag that freezes the released version as a copy in Git — see +[[architecture]]. Spaces without versioning answer `409 +releases_require_versioning`. + +| Route | Returns | +|---|---| +| `GET /api/pages/:id/releases` | Frozen copies, newest first: `version`, `releasedAt`, `author`, `note`, `tampered`. The version list (`.../versions`) marks archived entries with `release: true`. | +| `GET /api/pages/:id/releases/:version` | The frozen copy: `html`, `headings`, `tags`, `relations`, `metadata` (auto fields resolve to the release's author and date), `classification`, and a `release` object with the entry above plus `current`, the living page's version. | +| `GET /media//?release=` | An attachment as it was frozen with that release. | + +Both `releases` routes need read access only, and `404` stays ambiguous. +The MCP tool `read_page` takes an optional `version` to read a frozen copy. + +## Classification checks + +A page's class comes from its frontmatter (see [[markdown-and-editor]]); the +API enforces it in four places: + +- **Space maximum.** A save or release above the space's `classification.max` + is refused with `422 classification_exceeds_space_max`. It is deliberately + not a `409`: the editor reads `409` as a SHA conflict. +- **Search and graph.** Strictly confidential pages are filtered out of + search before the `LIMIT` is applied and dropped from the graph's + neighbours; confidential hits come back without a snippet. +- **Token limit.** Each API token has a `maxClassification` (default + `internal`). Above it, `GET /api/pages/:id` answers `restricted: true` + without content. Every other page route, attachments, frozen copies and old + versions answer `403 token_classification_limit`. Release reads apply the + stricter of the living page and the frozen copy. +- **Browser sessions** have no limit; repository access decides. + > [!IMPORTANT] > This is the same mechanism whether the writer is a human in the browser > editor or an AI agent calling `update_page_draft` through MCP — see diff --git a/architecture/index.md b/architecture/index.md index c7ab59f..44a6a62 100644 --- a/architecture/index.md +++ b/architecture/index.md @@ -45,5 +45,30 @@ and permissions exclusively through the API's HTTP surface. | `packages/design-tokens` | The catalog of design tokens that drives the look and feel — see [[web-frontend]]. | | `packages/git-provider` | One interface, two implementations (Forgejo, GitHub): read/write files, commits, branches, pull requests, reviews. | +## Release archive in Git + +Releasing a page in a versioned space can freeze it: in the same commit as +the version bump, the API writes `/_releases//page.md` plus +copies of the attachments the page references. The frozen copies live in Git +like everything else. + +Postgres only holds a derived cache, `page_releases`. A full reindex rebuilds +it from the `_releases/` folders, marks copies that changed since release as +`tampered` and drops entries whose folder is gone. Losing the table loses +nothing — the same rule as for the rest of the index. + +No write route reaches `_releases/`: page folders are slugs without +underscores, and attachment paths are fixed to the page's own `_media/`. A +central guard doesn't exist yet; `isReleasePath` in the API is the helper for +future routes. + +## Classification checks + +Classes are plain frontmatter, read from `pages.frontmatter` — there is no +separate column, so the index stays derivable from Git. The ordering is +shared in `packages/markdown/src/classification.ts`. The API checks it on +save and release (space maximum), in search and the graph, and against the +API token's limit; see [[api]] for the exact responses. + See [[principles]] for why the lines are drawn exactly here, and [[repository-layout]] for the directories underneath each of these. diff --git a/markdown-and-editor/index.md b/markdown-and-editor/index.md index dc97466..7551335 100644 --- a/markdown-and-editor/index.md +++ b/markdown-and-editor/index.md @@ -28,6 +28,18 @@ any time and must come back unchanged. - `slug.ts`, `diff.ts`, `version.ts` — heading slugs, and support for page version comparison. +## The `classification` field + +The frontmatter field `classification` takes `public`, `internal`, +`confidential` or `strictly-confidential`. The values and their ordering live +in `packages/markdown/src/classification.ts`, shared by the API, the web app +and the editor. A page without the field falls back to the space's +`classification.default` from `_meta/schema.yaml`; the same block's `max` +caps what may be saved. In the editor, a select next to *Archive* sets the +field — "Space default" omits it from the file, and the select offers +nothing above the space maximum. Admin-facing description: in the Admin +Guide, page *Classifications*. + ## The editor `packages/editor/src/`: