target-revenue/workplans
tegwick 28f0f429b2 Implement hosted Conversion Attestation publication (WP-0006-T06)
migrations/0003_attestations.sql: one row per Phase, no UPDATE/DELETE
grant for trf_app (a published attestation is permanent).

src/target_revenue/attestation.py: publish_attestation() is idempotent
(existing row returned unchanged, never regenerated) and derives
conversion_timestamp from the ledger itself via _find_conversion_prefix(),
which finds the earliest prefix where the fold reaches Outstanding
Target = 0 rather than trusting entries[-1] or wall-clock publish time -
so a later unrelated entry can never change an already-converged Phase's
recorded conversion moment. Raises NotConvertedError rather than
fabricating a conversion. Reuses conversion.generate_attestation()
unchanged. Guarded the psycopg import behind TYPE_CHECKING so the pure
helper stays testable under plain system Python.

service/app.py adds GET /phases/{id}/attestation (unauthenticated,
publish-on-first-observation).

tests/test_attestation.py (3 tests, no Docker/Postgres) proves the
earliest-crossing behavior. 6 new Docker-gated tests in
test_ledger_hosting.py cover pre-conversion 404, the core
legal-technical property that /metrics facts/calculations/forecasts
are identical whether or not /attestation was ever called, one-time
publication, signature verification, and DB-level UPDATE/DELETE
rejection.
2026-07-29 21:50:02 +02:00
..
TREV-WP-0001-license-prior-art-research.md Accept TRSL V1C1 (WP-0001-T06): objective Commercial Use definition 2026-07-29 19:30:41 +02:00
TREV-WP-0002-trust-service-foundation.md Accept ADR-0001 and close TREV-WP-0002 2026-07-29 02:07:22 +02:00
TREV-WP-0003-normative-core-extraction.md Accept WP-0003-T06: normative extract review complete 2026-07-29 20:22:01 +02:00
TREV-WP-0004-global-jurisdiction-research.md Close WP-0004/WP-0005 with alpha/beta legal-review deferral 2026-07-29 20:46:49 +02:00
TREV-WP-0005-enforcement-network-research.md Close WP-0004/WP-0005 with alpha/beta legal-review deferral 2026-07-29 20:46:49 +02:00
TREV-WP-0006-trust-service-implementation.md Implement hosted Conversion Attestation publication (WP-0006-T06) 2026-07-29 21:50:02 +02:00
TREV-WP-0007-degeneration-policy-and-canonical-profiles.md chore(consistency): write back state hub workstream/task IDs for WP-0006/0007/0008 2026-07-29 20:28:08 +02:00
TREV-WP-0008-governance-and-pilot-rollout.md Close WP-0004/WP-0005 with alpha/beta legal-review deferral 2026-07-29 20:46:49 +02:00