PayCargo · AI-Sandbox · Step 6.u

6.uDoc Vault — versioned HTML documents, shared and annotated

A versioned home for the HTML documents the platform produces. Projects hold many files; every file versions independently and immutably; documents are shared to named Console members; readers annotate the exact version they read. Untrusted document CSS/JS runs only after a discipline check — so a report is a live artifact, not a flat export.
Block: 6.u (cartridge; global department) · State: Live in AI-Sandbox · Cartridge: cartridges/global/doc-vault/
Shipped
Cartridges generate rich HTML — audit reports, briefs, dashboards. Doc Vault is where those land: a project of versioned files, each rendered as a live document behind a security boundary, shared to named people, and pinned to version-anchored comments. It is also the publish target for automated writers (Foundation Audit, the Console MCP publish_evaluation tool).

Contents

  1. Data model: projects, files, immutable versions
  2. The discipline check (untrusted documents)
  3. Rendering in an opaque origin
  4. Sharing + version-anchored comments
  5. The system-publish path (automated writers)
  6. Files at a glance

1. Data model — projects, files, immutable versions

A project holds many files (folders, relative cross-links). Every file versions independently and immutably: nothing overwrites a version's bytes or its discipline report. Uploading a path that already exists appends a new version — a whole-folder re-upload bumps exactly the files that changed. No code path may update a V# item in place.

Relative links only

Cross-document links resolve against the project tree from the linking document's own folder (guides/claims.html, ../index.html). Root-relative (/guides/…) and origin-absolute links fail the discipline check — they break the moment a project is shared, re-hosted, or exported.

2. The discipline check — the document is untrusted

The platform's own users are the upload vector, and a document is untrusted content. The discipline check decides whether a version's scripts execute at all; its report is stored immutably with the version. Deterministic checks are authoritative for security; a Bedrock pass is advisory (findings + explanations) and authoritative for quality (e.g. the doc-theme palette). It fails closed: anything erroring or timing out saves the version with scripts disabled.

3. Rendering in an opaque origin

Bytes are fetched through the authenticated API and rendered via srcdoc into <iframe sandbox="allow-scripts"> — never allow-same-origin. With no separate serving hostname, that opaque origin is what keeps a live document away from Console cookies and tokens. Adding allow-same-origin, or serving documents as text/html on the Console origin, is a security regression that must not merge.

Non-negotiable

A cross-origin iframe silently suppresses window.confirm/alert/prompt (Chrome 92+). Every iframed cartridge inherits this — Doc Vault uses an in-app confirm dialog for destructive actions, never the native one (the bug that once made annotation-delete "do nothing").

4. Sharing + version-anchored comments

Documents are shared to named Console members — the share picker is a real-user directory keyed by cognito:username, sourced from the obs activity table (only users who have actually signed in). A share can be revoked inline. Readers annotate the exact version they were looking at: a comment is pinned to the V# it was made against, so it never silently re-attaches to a later revision. Annotate mode blocks click-through so annotating never triggers the document underneath.

5. The system-publish path (automated writers)

Automated producers don't have a signed-in user, so Doc Vault exposes a system-publish path: a direct lambda:InvokeFunction carrying { source:'system-publish', … }, checked before the HTTP gates — the IAM invoke permission is the authorization (the same proof-by-invoke pattern as the trash sweep). It ensures a _system-owned project by fixed projectId, optionally grants a viewer, then runs the same commit invariants (discipline check + append-only version).

Two producers use it today: Foundation Audit (audit reports) and the Console MCP publish_evaluation tool (scheduled-evaluator reviews). Both write through the identical gate a human upload passes.

6. Files at a glance

Why it matters

Everything the platform writes for a human — audits, reviews, briefs — needs a durable, versioned, shareable home with an audit trail. Doc Vault is that home, and the discipline check is what lets those documents stay live instead of flattened.