Files
alexmandClaude 3831b52a2b feat: ML-DSA-65, did:key, named hash algorithm, model provenance, log tiles and witnesses
- hashing.algorithm names the hash function in every document; a consumer refuses one it does not implement (doc.hash.algorithm)
- ML-DSA-65 (FIPS 204) is an implemented signature scheme: pure-Python reference in tools/oracle/mldsa.py checked against NIST ACVP vectors, a receipt signed by the new roster key dana, and signature vectors for key generation and a deterministic signature
- roster keys may carry a did:key, which the validator checks against the public key (doc.roster.did), and a witness purpose for parties that cosign log checkpoints
- model provenance: a correction's author and an annotation's generator name the model with provider, version and the hashes of its weights, prompt and parameters, and where it ran
- the transparency log gains the tlog-tiles static layout (fixtures/records/log/), a project settings.log with origin, witnesses and threshold, and an acceptance rule; the fixture checkpoint is cosigned by a witness
- store.sql: roster_keys accepts cose and ml-dsa-65 and gains a did column
- spec chapters 01, 08, 11, 18, 20 and 23, the rationale, glossary, fixture, vector and tool guides updated; stress harness covers ML-DSA

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-15 04:39:12 -04:00

156 lines
4.3 KiB
SQL

-- The team store: everything a team adds to its documents.
-- Normative: spec/13-database.md. Load sql/doc.sql first.
-- Portable to SQLite 3.37+, Dolt and PostgreSQL 12+, under the same rules as sql/doc.sql.
-- License: CC0-1.0.
CREATE TABLE roster_keys (
store VARCHAR(128) NOT NULL,
id VARCHAR(128) NOT NULL,
person TEXT NOT NULL,
role VARCHAR(16) NOT NULL CHECK (role IN ('owner', 'editor', 'reader', 'guest')),
scheme VARCHAR(16) NOT NULL CHECK (scheme IN ('ed25519', 'ssh', 'gpg', 'sigstore', 'cose', 'ml-dsa-65')),
public_key TEXT NOT NULL,
did VARCHAR(128),
purposes TEXT NOT NULL,
registered_at VARCHAR(20) NOT NULL,
revoked_at VARCHAR(20),
PRIMARY KEY (store, id)
);
CREATE TABLE projects (
project_key VARCHAR(128) NOT NULL,
store VARCHAR(128),
name TEXT NOT NULL,
description TEXT,
claims TEXT,
settings TEXT,
record TEXT NOT NULL,
PRIMARY KEY (project_key)
);
CREATE TABLE members (
project_key VARCHAR(128) NOT NULL,
person VARCHAR(256) NOT NULL,
role VARCHAR(8) NOT NULL CHECK (role IN ('owner', 'editor', 'reader', 'guest')),
signing_keys TEXT NOT NULL,
PRIMARY KEY (project_key, person)
);
CREATE TABLE project_documents (
project_key VARCHAR(128) NOT NULL,
doc_key VARCHAR(257) NOT NULL,
reason TEXT NOT NULL,
tags TEXT,
reading_status TEXT,
PRIMARY KEY (project_key, doc_key)
);
CREATE TABLE reading_paths (
project_key VARCHAR(128) NOT NULL,
id VARCHAR(128) NOT NULL,
title TEXT NOT NULL,
steps TEXT NOT NULL,
PRIMARY KEY (project_key, id)
);
CREATE TABLE layers (
id VARCHAR(256) NOT NULL,
project_key VARCHAR(128),
label TEXT NOT NULL,
purpose TEXT NOT NULL,
audience VARCHAR(8) CHECK (audience IN ('novice', 'student', 'expert', 'mixed')),
visibility VARCHAR(8) NOT NULL CHECK (visibility IN ('private', 'team', 'public')),
license TEXT NOT NULL,
record TEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE annotations (
id VARCHAR(256) NOT NULL,
layer VARCHAR(256) NOT NULL,
body_kind VARCHAR(24) NOT NULL CHECK (body_kind IN ('gloss', 'claim-link', 'symbol', 'comment', 'caveat', 'question', 'exercise', 'citation-context', 'prerequisite', 'crosslink', 'translation', 'description', 'generated')),
status VARCHAR(10) NOT NULL CHECK (status IN ('proposed', 'confirmed', 'rejected', 'withdrawn')),
receipt VARCHAR(32),
creator VARCHAR(256) NOT NULL,
created VARCHAR(20) NOT NULL,
record TEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE INDEX annotations_layer ON annotations (layer);
-- Derived from annotation targets, so a reader finds the annotations on a node.
CREATE TABLE annotation_targets (
annotation VARCHAR(256) NOT NULL,
ord INTEGER NOT NULL,
doc_key VARCHAR(257),
node VARCHAR(128),
target_annotation VARCHAR(256),
PRIMARY KEY (annotation, ord)
);
CREATE INDEX annotation_targets_node ON annotation_targets (doc_key, node);
CREATE TABLE datasets (
id VARCHAR(128) NOT NULL,
doc_key VARCHAR(257),
content_hash VARCHAR(64) NOT NULL,
descriptor TEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE dataset_values (
dataset VARCHAR(128) NOT NULL,
resource VARCHAR(128) NOT NULL,
row_key VARCHAR(128) NOT NULL,
field VARCHAR(128) NOT NULL,
printed VARCHAR(64),
origin_kind VARCHAR(10) NOT NULL CHECK (origin_kind IN ('reported', 'digitized', 'computed', 'measured')),
anchor TEXT,
PRIMARY KEY (dataset, resource, row_key, field)
);
CREATE TABLE digitizations (
id VARCHAR(32) NOT NULL,
doc_key VARCHAR(257) NOT NULL,
panel VARCHAR(16) NOT NULL,
page_fp VARCHAR(64),
method VARCHAR(8) NOT NULL CHECK (method IN ('manual', 'traced', 'proposed')),
confirmation VARCHAR(32),
dataset VARCHAR(128),
record TEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE views (
id VARCHAR(128) NOT NULL,
project_key VARCHAR(128),
spec TEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE policies (
id VARCHAR(32) NOT NULL,
project_key VARCHAR(128),
signer VARCHAR(128) NOT NULL,
made_at VARCHAR(20) NOT NULL,
valid_until VARCHAR(20),
record TEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE submissions (
id VARCHAR(32) NOT NULL,
exercise VARCHAR(256) NOT NULL,
student VARCHAR(64) NOT NULL,
submitted_at VARCHAR(20) NOT NULL,
record TEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE grades (
submission VARCHAR(32) NOT NULL,
score VARCHAR(32) NOT NULL,
max_score VARCHAR(32) NOT NULL,
record TEXT NOT NULL,
PRIMARY KEY (submission)
);