state-hub/workplans/STATE-WP-0100-hub-write-attribution.md
tegwick 783a3d39c1
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
STATE-WP-0100: registered in the hub; write back ids, regenerate WORK-RECORDS
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: sonnet
Assistant-Process: 328925@bnt-lap001
Assistant-Session: 14b795fd-c632-4c01-8d28-e7e490c7b0ed
2026-10-25 00:24:28 +02:00

107 lines
3.2 KiB
Markdown

---
id: STATE-WP-0100
type: workplan
title: "Attributable actor and session on State Hub writes (SI-15)"
domain: infotech
repo: state-hub
status: proposed
owner: claude-code
topic_slug: infotech
created: "2026-10-24"
updated: "2026-10-25"
flavor: implementation
related: [NK-WP-0054]
state_hub_workstream_id: "8cb52e0c-bb19-5de5-b2b0-fee4a60a2ef0"
---
Proposed from hub message 05ba80d7 (net-kingdom, rule SI-15 accountable automation). Design and
recommendation: `docs/hub-write-attribution-design.md`. Founder decided on 2026-10-25: option A
is phase 1 with no `hub_core` schema change; commit correlation by equal session and run id only
(commit verifier deferred); phase 3 verifies tokens in observe mode only (enforcement is a later
founder decision); no backfill. Phase 3 depends on net-kingdom/key-cape minting agent tokens and
is not ours to schedule.
## Founder decision on the design
```task
id: STATE-WP-0100-T01
status: done
priority: high
state_hub_task_id: "f18c2d5f-185d-5b81-bc44-121da1b7114e"
```
Founder answered the five questions in section 10 of the design on 2026-10-25; recorded there.
## Header contract and schema
```task
id: STATE-WP-0100-T02
status: todo
priority: high
state_hub_task_id: "73ff2799-3a2a-5f85-b92e-88b1e0ff3047"
```
Prerequisite: T01 (done). Publish the header names, `assurance` values and the `write_attribution`
table shape in `docs/schemas/`; agree with net-kingdom, hub_core and MCP maintainers.
## Sidecar table (no `hub_core` change), middleware and read endpoint
```task
id: STATE-WP-0100-T03
status: wait
priority: high
state_hub_task_id: "2d793f06-cd51-5f95-9e81-449cc025faa6"
```
Prerequisite: T02. Alembic migration, header validation, post-handler hook for all mutating
routes, `GET /attribution/`, tests per section 8 of the design. Unattributed writes are accepted.
## Client helpers
```task
id: STATE-WP-0100-T04
status: wait
priority: medium
state_hub_task_id: "341ecd70-1488-508c-9b0a-ec9c7669a0d7"
```
Prerequisite: T03. `statehub` CLI, both MCP servers and the edge relay/outbox set and preserve
the actor headers (`STATEHUB_ACTOR`, `STATEHUB_ACTOR_TYPE`, `STATEHUB_SESSION`).
## Legacy author count (optional, read-only)
```task
id: STATE-WP-0100-T05
status: wait
priority: low
state_hub_task_id: "2c745e05-1d7a-5e90-b415-07b23ea28e05"
```
Founder decision 4 (2026-10-25): no backfill. Only a read-only count of distinct author strings
to size a possible later mapping; the mapping file and `assurance=legacy` backfill are dropped.
## Commit-trailer correlation (deferred)
```task
id: STATE-WP-0100-T06
status: cancel
priority: low
state_hub_task_id: "1dfefb83-202c-5e98-a73c-add8d71efa9b"
```
Cancelled by founder decision 2 (2026-10-25): session id and run id equality only. The
asynchronous commit verifier and `commit_ref` (Option B) are deferred; revisit if signed commits
are introduced.
## Token verification (gated)
```task
id: STATE-WP-0100-T07
status: wait
priority: medium
state_hub_task_id: "db9920eb-55cb-56cc-82e4-c50174940054"
```
Prerequisite: net-kingdom/key-cape agent-token availability (KEY-WP-0043). Observe-mode only per
founder decision 3 (2026-10-25): bearer verification per IAM Profile v0.3, record
`assurance=token`, never reject. Enforcement is a separate later founder decision, not in this plan.