Implement TREV-WP-0002 Stage 0 foundation: schemas, pure fold, golden Phase
Delivers the offline runnable specification foundation for the Trust Layer (TSD §3-§6), not a hosted Trust Service: - JSON Schemas for Phase Manifest, Ledger Entry, Extension Contract, and Conversion Attestation, encoding the Stage 0 working defaults (Q3 future license enum, Q6 single-currency Phases, Q8 required longstop_at). - src/target_revenue: pure Outstanding Target fold, SHA-256 hash-chain verification, Ed25519 signing helpers, extension conformance checks (including a core-term-redefinition heuristic), and conversion detection that never requires an attestation document to determine conversion status. - examples/phase-001: golden Phase package matching the concept doc's worked example, generated via scripts/generate_golden_phase.py so the hash chain is computed by the library itself, not hand-typed. - 32 passing pytest tests covering manifest/ledger/extension conformance, tamper/reorder detection, and the full lifecycle fold to conversion. - docs/adr/ADR-0001: proposed (not accepted) Stage 0 stack choice, per the WP-0002-T01 human-accept gate — implementation proceeded against the proposal as the workplan note permits, but the task stays open. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
658b1af00d
commit
57c7111cbc
28 changed files with 1751 additions and 7 deletions
108
schemas/phase_manifest.schema.json
Normal file
108
schemas/phase_manifest.schema.json
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://target-revenue.example/schemas/phase_manifest.schema.json",
|
||||
"title": "Phase Manifest",
|
||||
"description": "Stage 0 schema per specs/TechnicalSpecificationDocument.md §3.1 and specs/OpenQuestions-WorkingDefaults.md Q3/Q6/Q8. Field names and semantics are authoritative from spec/TargetRevenueLicenseConcept.md §16.",
|
||||
"type": "object",
|
||||
"required": ["framework", "license", "phase"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"framework": {
|
||||
"type": "string",
|
||||
"description": "Framework version tag, e.g. TRF-0.1."
|
||||
},
|
||||
"license": {
|
||||
"type": "string",
|
||||
"description": "TRSL version tag, e.g. TRSL-0.1."
|
||||
},
|
||||
"phase": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"milestone_release",
|
||||
"initial_target",
|
||||
"future_license",
|
||||
"degeneration_policy",
|
||||
"longstop_at",
|
||||
"ledger"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^trsl:phase:[a-zA-Z0-9._-]+$",
|
||||
"description": "Globally unique, immutable once published."
|
||||
},
|
||||
"milestone_release": {
|
||||
"type": "object",
|
||||
"required": ["name", "source_revision"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"source_revision": { "type": "string" },
|
||||
"artifact_sha256": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-f0-9]{64}$",
|
||||
"description": "Recommended; required if a built artifact (not just source) is governed."
|
||||
}
|
||||
}
|
||||
},
|
||||
"initial_target": {
|
||||
"type": "object",
|
||||
"required": ["amount", "currency"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"amount": { "type": "number", "exclusiveMinimum": 0 },
|
||||
"currency": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-Z]{3}$",
|
||||
"description": "ISO 4217 code. Working default Q6: one native currency per Phase."
|
||||
}
|
||||
}
|
||||
},
|
||||
"target_basis": {
|
||||
"type": "object",
|
||||
"description": "Recommended transparency metadata (working default Q5), not legally required.",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"estimated_effort_days": { "type": "number", "minimum": 0 },
|
||||
"daily_rate": { "type": "number", "minimum": 0 },
|
||||
"approved_direct_costs": { "type": "number", "minimum": 0 },
|
||||
"target_multiple": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"description": "Open decimal per working default Q4. Guidance classes {0,1,10,100,1000} are not a closed enum."
|
||||
}
|
||||
}
|
||||
},
|
||||
"future_license": {
|
||||
"type": "string",
|
||||
"enum": ["MIT", "Apache-2.0"],
|
||||
"description": "Working default Q3: closed enum for Stage 0."
|
||||
},
|
||||
"degeneration_policy": {
|
||||
"type": "string",
|
||||
"pattern": "^trsl:policy:[a-zA-Z0-9._-]+@[0-9]+(\\.[0-9]+)*$",
|
||||
"description": "e.g. trsl:policy:linear-longstop-v0@1.0 (working default Q7)."
|
||||
},
|
||||
"longstop_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "Required for Stage 0 per working default Q8. Full-remission / maximum-protection instant."
|
||||
},
|
||||
"ledger": {
|
||||
"type": "string",
|
||||
"description": "URL or relative path URI to the authoritative Target Ledger for this Phase."
|
||||
}
|
||||
}
|
||||
},
|
||||
"extensions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": "^trsl:extension:[a-zA-Z0-9._-]+@[0-9]+(\\.[0-9]+)*$"
|
||||
},
|
||||
"description": "Optional. Applicable monetization profiles/extensions for this Phase."
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue