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:
tegwick 2026-07-28 18:47:29 +02:00
parent 658b1af00d
commit 57c7111cbc
28 changed files with 1751 additions and 7 deletions

View file

@ -0,0 +1,10 @@
{
"phase": "trsl:phase:example-001",
"milestone_release": "release-1.0",
"conversion_timestamp": "2027-06-01T00:00:00Z",
"future_license": "MIT",
"final_development_credit": 67000.0,
"final_remission_credit": 33000.0,
"final_outstanding_target": 0.0,
"ledger_checkpoint": "trsl:entry:example0010006"
}

View file

@ -0,0 +1,24 @@
{
"id": "trsl:extension:cost-plus-operations",
"version": "1.0",
"value": {
"description": "Hosted and monitored operation of the software: compute, storage, networking, monitoring, backup, and incident response."
},
"pricing": {
"method": "cost-plus, default 50% surcharge over eligible operations cost"
},
"allocation": {
"rule": "Development allocation defaults to 0% of the operations price. A Phase may explicitly declare a nonzero development_allocation on the surcharge portion; absent that declaration, none of this revenue counts toward the Phase target.",
"default_rate": 0.0
},
"recognition": {
"event": "payment-settled"
},
"reversal": {
"rule": "Refunds reverse proportionally; chargebacks reverse fully via a compensating credit-reversal entry."
},
"evidence": {
"requirement": "Settled payment reference; eligible operations cost breakdown recommended for disputed amounts."
},
"status": "registered"
}

View file

@ -0,0 +1,24 @@
{
"id": "trsl:extension:development-license",
"version": "1.0",
"value": {
"description": "Commercial-use rights and early commercial access to the protected Milestone Release."
},
"pricing": {
"method": "fixed-fee-per-entitlement"
},
"allocation": {
"rule": "100% of the collected development fee, net of tax, refunds, and chargebacks, becomes Development Credit for the identified Phase.",
"default_rate": 1.0
},
"recognition": {
"event": "payment-settled"
},
"reversal": {
"rule": "Refunds and chargebacks generate a compensating credit-reversal ledger entry for the reversed amount."
},
"evidence": {
"requirement": "Settled payment reference (processor transaction id) at minimum (working default Q10 tier E1); contract and invoice recommended for high-value credits (E2)."
},
"status": "registered"
}

View file

@ -0,0 +1,23 @@
{
"id": "trsl:extension:phase-sponsorship",
"version": "1.0",
"value": {
"description": "Financial support explicitly directed at a named Phase, rather than the project generally."
},
"pricing": {
"method": "declared-amount, negotiated per sponsorship agreement"
},
"allocation": {
"rule": "The sponsoring party and the licensor explicitly declare the development_allocation fraction of the sponsorship amount at the time the sponsorship is recorded. Unrestricted general project sponsorship is not assigned to any Phase by default."
},
"recognition": {
"event": "payment-settled"
},
"reversal": {
"rule": "A withdrawn or refunded sponsorship generates a compensating credit-reversal entry for the previously declared development_allocation."
},
"evidence": {
"requirement": "Sponsorship agreement or written declaration stating the target Phase and declared allocation, plus settled payment reference."
},
"status": "registered"
}

View file

@ -0,0 +1,24 @@
{
"id": "trsl:extension:service-with-development-allocation",
"version": "1.0",
"value": {
"description": "Installation, migration, configuration, integration, customization, support, or training service engagement."
},
"pricing": {
"method": "time-and-materials or fixed-fee, per service agreement"
},
"allocation": {
"rule": "Development allocation defaults to 0%. When a reusable deliverable from the engagement is incorporated into the governed Milestone Release, the reusable portion is explicitly split out and declared as development_allocation; customer-specific configuration is never allocated.",
"default_rate": 0.0
},
"recognition": {
"event": "payment-settled"
},
"reversal": {
"rule": "Refunds and chargebacks generate a compensating credit-reversal entry for the reversed amount."
},
"evidence": {
"requirement": "Settled payment reference; a statement identifying the reusable deliverable is required whenever a nonzero allocation is claimed."
},
"status": "registered"
}

View file

@ -0,0 +1,86 @@
[
{
"id": "trsl:entry:example0010001",
"phase": "trsl:phase:example-001",
"type": "development-credit",
"amount": 25000,
"currency": "USD",
"recognized_at": "2026-09-01T09:00:00Z",
"extension": {
"id": "trsl:extension:development-license",
"version": "1.0"
},
"evidence_reference": "confidential:evidence:example-001-dc-0001",
"previous_entry_hash": "GENESIS"
},
{
"id": "trsl:entry:example0010002",
"phase": "trsl:phase:example-001",
"type": "development-credit",
"amount": 10000,
"currency": "USD",
"recognized_at": "2026-09-15T09:00:00Z",
"extension": {
"id": "trsl:extension:phase-sponsorship",
"version": "1.0"
},
"evidence_reference": "confidential:evidence:example-001-dc-0002",
"previous_entry_hash": "5a67c0dc3407de30db7db5183fc3f609ae687dd529336b74fcba4a6ba75580c9"
},
{
"id": "trsl:entry:example0010003",
"phase": "trsl:phase:example-001",
"type": "development-credit",
"amount": 2000,
"currency": "USD",
"recognized_at": "2026-10-01T09:00:00Z",
"extension": {
"id": "trsl:extension:service-with-development-allocation",
"version": "1.0"
},
"evidence_reference": "confidential:evidence:example-001-dc-0003",
"previous_entry_hash": "d9bc08b582a1ffb59adc818b93bf0946619f4a18bde8d4fa96ef07249a2ce58e"
},
{
"id": "trsl:entry:example0010004",
"phase": "trsl:phase:example-001",
"type": "remission-credit",
"amount": 18000,
"currency": "USD",
"recognized_at": "2026-12-01T00:00:00Z",
"extension": {
"id": "trsl:policy:linear-longstop-v0",
"version": "1.0"
},
"evidence_reference": "confidential:evidence:example-001-rc-0001",
"previous_entry_hash": "1285da9f580663a8a3fce847ed64fc81c14b29d566243a7f65eb6b4237f5bf4a"
},
{
"id": "trsl:entry:example0010005",
"phase": "trsl:phase:example-001",
"type": "development-credit",
"amount": 30000,
"currency": "USD",
"recognized_at": "2027-03-01T09:00:00Z",
"extension": {
"id": "trsl:extension:development-license",
"version": "1.0"
},
"evidence_reference": "confidential:evidence:example-001-dc-0004",
"previous_entry_hash": "244af54599234f8320e3f3f294d1e0890e62bbf1f1c5f4dd27b0d96abc9f330a"
},
{
"id": "trsl:entry:example0010006",
"phase": "trsl:phase:example-001",
"type": "remission-credit",
"amount": 15000,
"currency": "USD",
"recognized_at": "2027-06-01T00:00:00Z",
"extension": {
"id": "trsl:policy:linear-longstop-v0",
"version": "1.0"
},
"evidence_reference": "confidential:evidence:example-001-rc-0002",
"previous_entry_hash": "5c360e5510dd860d68198abf80d25d5bf7509b0527cd5acc5f5bea93d31b5e3b"
}
]

View file

@ -0,0 +1,32 @@
{
"framework": "TRF-0.1",
"license": "TRSL-0.1",
"phase": {
"id": "trsl:phase:example-001",
"milestone_release": {
"name": "release-1.0",
"source_revision": "abc123",
"artifact_sha256": "44cd1493bd179c1207c7025c1372cdad89aac114e151db27aba2bdf3d55c688a"
},
"initial_target": {
"amount": 100000,
"currency": "USD"
},
"target_basis": {
"estimated_effort_days": 1,
"daily_rate": 1000,
"approved_direct_costs": 0,
"target_multiple": 100
},
"future_license": "MIT",
"degeneration_policy": "trsl:policy:linear-longstop-v0@1.0",
"longstop_at": "2031-08-01T00:00:00Z",
"ledger": "examples/phase-001/ledger.json"
},
"extensions": [
"trsl:extension:development-license@1.0",
"trsl:extension:cost-plus-operations@1.0",
"trsl:extension:phase-sponsorship@1.0",
"trsl:extension:service-with-development-allocation@1.0"
]
}