state-hub/docs/evidence/workstream-caller-inventory-20260708.md
tegwick bb6bec9f10
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Has been cancelled
STATE-WP-0070: identity headers, archive 0069, phase-2 workplan
Add X-StateHub-Component to fix-consistency and other State Hub REST callers for
legacy-meter attribution. Archive STATE-WP-0069; open STATE-WP-0070 for
meter-gated phase-2 retirement. Task POST bodies use workplan_id only.
2026-07-09 00:39:09 +02:00

3.7 KiB

Workstream caller inventory — 2026-07-08

Post STATE-WP-0069 hunt. Live legacy-meter (7-day window) showed ~150k calls on legacy REST keys; most lacked X-StateHub-Component identity (unknown bucket).

Migrated in this pass (REST → /workplans/)

Caller Repo Was Now
scripts/consistency_check.py state-hub /workstreams/* /workplans/* (prior commit)
scripts/consistency_check.py task queries state-hub ?workstream_id= ?workplan_id=
scripts/cleanup_stale_tasks.py state-hub GET /workstreams/ GET /workplans/
scripts/validate_repo_adr.py state-hub /workstreams/{id}, list /workplans/*
custodian_cli.py state-hub CRUD/list /workstreams/ /workplans/
dashboard/src/data/workstreams.json.py state-hub GET /workstreams GET /workplans
dashboard/src/data/workstreams/[id].json.py state-hub GET /workstreams/{id} GET /workplans/{id}
dashboard/src/extensions.md state-hub apiFetch("/workstreams/") apiFetch("/workplans/")
mcp_server/server.py legacy resource state-hub _get("/workstreams") _get("/workplans")
context_resolvers/state_hub.py activity-core index, detail, tasks /workplans/index, /workplans/{id}, ?workplan_id=
cya/shell_session.py can-you-assist GET /workstreams/? GET /workplans/?

Intentional legacy (keep until meter clears)

Surface Notes
api/routers/workstreams.py Compat router; metered with Deprecation
api/routers/workstream_dependencies.py Legacy dependency aliases
MCP tool names create_workstream, etc. Aliases call /workplans/ internally
MCP param aliases workstream_id Accepted on tools; REST uses workplan_id where updated
activity-core progress sinks Fixedworkplan_id only on POST /progress/ (commit after f171bb0)
railiance-platform/scripts/credential.py Dual-write scope fields
Dashboard routes /workstreams Nav URL compat only; workstreams.md already polls /workplans/
tests/test_legacy_meter.py, test_routers_core.py Regression coverage for legacy routes

Likely remaining production traffic sources

  1. Remote fix-consistency on railiance01 / cluster nodes still on pre-e0c954d checkout.
  2. Dashboard data loaders on deployed hosts before this migration ships.
  3. activity-core k8s prompts still document /workstreams/workplan-index in YAML (docs only until rolled).
  4. External MCP clients (Claude Code create_workstream in ~/.claude.json) — tool aliases hit /workplans/ but old REST clients may remain.
  5. POST bodies with workstream_id on /tasks/, /decisions/, /progress/ (metered separately).

Next verification

python scripts/capture_legacy_meter_evidence.py --days 7

Expect GET /workstreams/* window counts to fall after deploy + one full fix-consistency sweep cycle on all hosts.

Identity headers (2026-07-09)

Scripts now send X-StateHub-Component for legacy-meter attribution:

Component key Caller
state-hub.fix-consistency scripts/consistency_check.py
state-hub.custodian-cli custodian_cli.py
state-hub.cleanup-stale-tasks scripts/cleanup_stale_tasks.py
state-hub.validate-repo-adr scripts/validate_repo_adr.py
state-hub.dashboard.workstreams-list dashboard data loader
state-hub.dashboard.workplan-detail dashboard detail loader
state-hub.dashboard.token-summary token summary loader

Remote deploy note: railiance01 ~/state-hub was at 050cbbc (pre-migration); git pull failed with permission denied on .git/FETCH_HEAD — operator action required to update the sweep host.