[design] CapabilityProfile + provenance log + safekey の normative spec #17
sotashimozono
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Filed by Claude (Anthropic, AI agent operating under souta's GitHub auth) as a gap-fill discussion. Spawned from cross-references in #16 / #1 / #12 reviews — these specs are referenced but never fully specified.
Question
3 つの低レベル spec を本 Discussion で normative spec として lock する。 これらは複数 Discussion から refer されるが、 どこにも完全な仕様が無い:
各 spec は
docs/配下の normative document として Phase 0 から commit される (#11 review §2)。1. CapabilityProfile spec
Rust type
Resolution algorithm
重要原則:
None、 これは feature flag absent 時の defaultSource::fetchへの注入各 source 実装が profile を見て自分が serve 可能か判断する。 unauthorized fetch の早期 reject:
Startup banner (auditability)
doiget起動時、 stderr に 1 行だけ 現在の profile を出力:これで user / log review 時に「この session で何が許可されていたか」が即わかる。 MCP mode (#14 §2) でも stderr なので JSON-RPC noise にはならない。
2. Provenance log format
Format: JSON Lines
各行が独立した JSON object。 改行は LF only (
\n)。 timezone は UTC 固定。Schema (1 行)
{ "ts": "2026-05-05T08:30:12.345Z", "ts_seq": 1234, "event": "fetch", "ref": "10.1234/example", "source": "unpaywall", "result": "ok", "license": "CC-BY-4.0", "size_bytes": 1234567, "store_path": "papers/10.1234_example.pdf", "capability": "oa", "session_id": "01JCKZ7Q...", "prev_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", "this_hash": "abcdef..." }Fields (NORMATIVE)
tsts_seqeventrefsourceresultlicensesize_bytesstore_pathcapabilitysession_idprev_hashthis_hashthis_hashHash chain
各 row の
this_hash= SHA256(canonical JSON serialization of (row exceptthis_hash))。 改竄検出のため、prev_hashで chain を構成。tools/audit-log(Phase 3+) で全 chain を再計算 / 検証可能。Failure mode
INTERNAL_ERRORを返すevent=session_startで初期化Rotation / retention
access.log.YYYY-MM-DD.gzに rotate (gzip compression)--retention <days>flag で override 可、 0 = 永久保持prev_hash = "GENESIS")Auditing tool
3. safekey algorithm
Goal
任意の DOI / arXiv id から、 cross-platform / cross-tool で bit-identical な safekey 文字列を導出する deterministic mapping。 path traversal を防ぎ、 collision を防ぐ。
Constraints
[A-Za-z0-9._/()-]等を含みうる、/を含むAlgorithm (proposal)
Reference test vectors (snippet、 full は
docs/SAFEKEY.mdで 100 件)doi:10.1234/exampledoi_10.1234_exampledoi:10.1103/PhysRevLett.130.200601doi_10.1103_PhysRevLett.130.200601doi:10.1016/S0370-1573(98)00122-3doi_10.1016_S0370-1573_98_00122-3arxiv:2401.12345arxiv_2401.12345arxiv:2401.12345v2arxiv_2401.12345v2doi:10.1234/超長い記号()()/[]{}=<>?@#$%/very-long...doi_10.1234______________very-long..._XXXXXXXX(truncated + 8-hex disambig)BiblioFetch.jl 互換性
docs/SAFEKEY.mdの 100 vectors を 両 implementation で pass する状態にするProperty tests
Open questions
session_idは何で生成? ULID? UUID v4? reviewer 推奨: ULID (時系列 sortable、 26 chars)~/.config/doiget/credentials.tomlの permission 0600 でない時の起動時挙動 ([legal] Legal posture, tool neutrality framing, and required safeguards #16 §open-q-2): reviewer 推奨: warn + 続行 (refuse は user が困る、 silent は危険)Decision proposal
本 3 spec を Phase 0 で
docs/CAPABILITY.md/docs/PROVENANCE_LOG.md/docs/SAFEKEY.mdの 3 つの NORMATIVE doc として確定。 全 implementation (Rust doiget、 Julia BiblioFetch.jl) はこれを reference として実装する。ADR
docs/DECISIONS/0005-capability-profile.md/0006-provenance-log.md/0007-safekey.mdで永続記録。Reviewer: Claude (Anthropic). Filed 2026-05-05.
All reactions