Add 8-hour default window for legacy-meter deploy monitoring
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 5s
Build and Publish Multi-Context Image / build-and-push (push) Failing after 1m15s

Expose hours query param on /legacy-meter/summary and weekly-review;
capture_legacy_meter_evidence.py defaults to --hours 8 (--days 7 for
weekly retirement gate). Re-capture post-deploy evidence with tighter window.
This commit is contained in:
tegwick 2026-07-09 01:35:51 +02:00
parent 674479dcc7
commit e302ca9f59
7 changed files with 252 additions and 90 deletions

View file

@ -1,30 +1,12 @@
{
"captured_at": "2026-07-08T23:08:23.293570+00:00",
"captured_at": "2026-07-08T23:35:18.486286+00:00",
"api_base": "http://127.0.0.1:8000",
"days": 7,
"workplan": "STATE-WP-0069",
"retired_interfaces": [
{
"id": "8051fb40-66c9-4dc4-a413-13e8573e04a3",
"interface_key": "event_subject:org.statehub.workstream.completed",
"interface_kind": "event_subject",
"legacy_since": "2026-06-04T06:09:42.198193Z",
"replacement_ref": "org.statehub.workplan.completed",
"owner_component": "state-hub.events",
"status": "retired",
"replacement_verified": true,
"manual_hold": false,
"hold_reason": null,
"notes": "Retired by STATE-WP-0069 closeout",
"retired_at": "2026-07-08T21:38:52.773601Z",
"created_at": "2026-06-04T06:09:42.198193Z",
"updated_at": "2026-07-08T21:38:52.761243Z"
}
],
"workplan": "STATE-WP-0070",
"retired_interfaces": [],
"weekly_review": {
"generated_at": "2026-07-08T23:08:23.276946Z",
"window_start": "2026-07-01T23:08:22.803913Z",
"window_end": "2026-07-08T23:08:22.803913Z",
"generated_at": "2026-07-08T23:35:18.459774Z",
"window_start": "2026-07-08T15:35:18.219148Z",
"window_end": "2026-07-08T23:35:18.219148Z",
"cadence": "weekly",
"activity_core_handoff": {
"activity_id": "statehub-legacy-interface-review",
@ -67,18 +49,18 @@
}
},
"window": {
"calls": 54,
"calls": 17,
"tenant_count": 1,
"user_count": 1,
"component_count": 1,
"tenants": {
"unknown": 54
"unknown": 17
},
"users": {
"unknown": 54
"unknown": 17
},
"components": {
"state-hub.events": 54
"state-hub.events": 17
}
},
"last_seen_at": "2026-07-08T20:49:12.839383Z",
@ -214,23 +196,23 @@
}
},
"window": {
"calls": 24897,
"calls": 1752,
"tenant_count": 1,
"user_count": 1,
"component_count": 1,
"tenants": {
"unknown": 24897
"unknown": 1752
},
"users": {
"unknown": 24897
"unknown": 1752
},
"components": {
"unknown": 24897
"unknown": 1752
}
},
"last_seen_at": "2026-07-08T21:14:39.652776Z",
"retirement_candidate": false,
"retirement_reason": "24897 call(s) in review window"
"retirement_reason": "1752 call(s) in review window"
},
{
"interface": {
@ -265,23 +247,17 @@
}
},
"window": {
"calls": 4,
"tenant_count": 1,
"user_count": 1,
"component_count": 1,
"tenants": {
"unknown": 4
},
"users": {
"unknown": 4
},
"components": {
"unknown": 4
}
"calls": 0,
"tenant_count": 0,
"user_count": 0,
"component_count": 0,
"tenants": {},
"users": {},
"components": {}
},
"last_seen_at": "2026-07-03T05:20:34.534439Z",
"retirement_candidate": false,
"retirement_reason": "4 call(s) in review window"
"retirement_candidate": true,
"retirement_reason": "no measured usage in review window"
},
{
"interface": {
@ -316,23 +292,23 @@
}
},
"window": {
"calls": 82774,
"calls": 7653,
"tenant_count": 1,
"user_count": 1,
"component_count": 1,
"tenants": {
"unknown": 82774
"unknown": 7653
},
"users": {
"unknown": 82774
"unknown": 7653
},
"components": {
"unknown": 82774
"unknown": 7653
}
},
"last_seen_at": "2026-07-08T21:14:20.781103Z",
"retirement_candidate": false,
"retirement_reason": "82774 call(s) in review window"
"retirement_reason": "7653 call(s) in review window"
},
{
"interface": {
@ -367,23 +343,23 @@
}
},
"window": {
"calls": 41448,
"calls": 3892,
"tenant_count": 1,
"user_count": 1,
"component_count": 1,
"tenants": {
"unknown": 41448
"unknown": 3892
},
"users": {
"unknown": 41448
"unknown": 3892
},
"components": {
"unknown": 41448
"unknown": 3892
}
},
"last_seen_at": "2026-07-08T21:14:12.747005Z",
"retirement_candidate": false,
"retirement_reason": "41448 call(s) in review window"
"retirement_reason": "3892 call(s) in review window"
},
{
"interface": {
@ -418,23 +394,74 @@
}
},
"window": {
"calls": 128,
"calls": 46,
"tenant_count": 1,
"user_count": 1,
"component_count": 1,
"tenants": {
"unknown": 128
"unknown": 46
},
"users": {
"unknown": 128
"unknown": 46
},
"components": {
"unknown": 128
"unknown": 46
}
},
"last_seen_at": "2026-07-08T20:49:12.335710Z",
"retirement_candidate": false,
"retirement_reason": "128 call(s) in review window"
"retirement_reason": "46 call(s) in review window"
},
{
"interface": {
"id": "4a70583c-1e41-4ec1-99a9-728856a7d79c",
"interface_key": "rest_api:POST /progress/ workstream_id",
"interface_kind": "rest_api",
"legacy_since": "2026-07-08T23:35:09.148333Z",
"replacement_ref": "POST /progress/ with workplan_id",
"owner_component": "state-hub.api",
"status": "legacy",
"replacement_verified": true,
"manual_hold": false,
"hold_reason": null,
"notes": null,
"retired_at": null,
"created_at": "2026-07-08T23:35:09.148333Z",
"updated_at": "2026-07-08T23:35:09.148333Z"
},
"all_time": {
"calls": 1,
"tenant_count": 1,
"user_count": 1,
"component_count": 1,
"tenants": {
"unknown": 1
},
"users": {
"unknown": 1
},
"components": {
"unknown": 1
}
},
"window": {
"calls": 1,
"tenant_count": 1,
"user_count": 1,
"component_count": 1,
"tenants": {
"unknown": 1
},
"users": {
"unknown": 1
},
"components": {
"unknown": 1
}
},
"last_seen_at": "2026-07-08T23:35:09.125218Z",
"retirement_candidate": false,
"retirement_reason": "1 call(s) in review window"
},
{
"interface": {
@ -520,23 +547,23 @@
}
},
"window": {
"calls": 40,
"calls": 18,
"tenant_count": 1,
"user_count": 1,
"component_count": 1,
"tenants": {
"unknown": 40
"unknown": 18
},
"users": {
"unknown": 40
"unknown": 18
},
"components": {
"unknown": 40
"unknown": 18
}
},
"last_seen_at": "2026-07-08T20:38:05.903144Z",
"retirement_candidate": false,
"retirement_reason": "40 call(s) in review window"
"retirement_reason": "18 call(s) in review window"
},
{
"interface": {
@ -630,6 +657,51 @@
"retirement_candidate": true,
"retirement_reason": "no measured usage in review window"
},
{
"interface": {
"id": "e4c140ec-7479-46f9-b185-4b533f19d639",
"interface_key": "rest_api:GET /workstreams/workplan-index",
"interface_kind": "rest_api",
"legacy_since": "2026-06-04T05:20:58.321869Z",
"replacement_ref": "/workplans/index",
"owner_component": "state-hub.api",
"status": "legacy",
"replacement_verified": true,
"manual_hold": false,
"hold_reason": null,
"notes": null,
"retired_at": null,
"created_at": "2026-06-04T05:20:58.321869Z",
"updated_at": "2026-06-04T05:20:58.321869Z"
},
"all_time": {
"calls": 30,
"tenant_count": 1,
"user_count": 1,
"component_count": 1,
"tenants": {
"unknown": 30
},
"users": {
"unknown": 30
},
"components": {
"unknown": 30
}
},
"window": {
"calls": 0,
"tenant_count": 0,
"user_count": 0,
"component_count": 0,
"tenants": {},
"users": {},
"components": {}
},
"last_seen_at": "2026-07-03T05:20:34.534439Z",
"retirement_candidate": true,
"retirement_reason": "no measured usage in review window"
},
{
"interface": {
"id": "281fd706-b192-4194-8055-2d8733c115f9",
@ -676,5 +748,6 @@
"retirement_reason": "no measured usage in review window"
}
]
}
},
"hours": 8
}

View file

@ -35,7 +35,8 @@ git log -1 --oneline # expect 5a92923 or newer
statehub fix-consistency --all --remote --api-base http://127.0.0.1:8000
# 4. Verify legacy-meter attribution (from any host with hub API access)
python ~/state-hub/scripts/capture_legacy_meter_evidence.py --days 7
python ~/state-hub/scripts/capture_legacy_meter_evidence.py
# Default 8-hour window; use --days 7 for weekly cadence
# Expect component bucket state-hub.fix-consistency; declining GET /workstreams/*
```
@ -47,8 +48,8 @@ python ~/state-hub/scripts/capture_legacy_meter_evidence.py --days 7
(`POST /consistency/sweep/remote-all` exit_code 0, 2026-07-08T23:08Z)
- [x] Weekly legacy-meter review shows `state-hub.fix-consistency` (not only `unknown`)
(`docs/evidence/legacy-meter-weekly-review-20260709.json`, 5 attributed calls)
- [ ] `GET /workstreams/*` 7-day window counts trend down week-over-week
(deploy complete 2026-07-09; re-capture after one full week for ≥50% drop gate)
- [ ] `GET /workstreams/*` counts trend down in 8-hour capture windows post-deploy
(default `capture_legacy_meter_evidence.py`; weekly `--days 7` for retirement gate)
## Rollback

View file

@ -43,7 +43,7 @@ on legacy REST keys; most lacked `X-StateHub-Component` identity (`unknown` buck
## Next verification
```bash
python scripts/capture_legacy_meter_evidence.py --days 7
python scripts/capture_legacy_meter_evidence.py # default 8h; --days 7 for weekly
```
Expect `GET /workstreams/*` window counts to fall after deploy + one full

View file

@ -104,7 +104,8 @@ Deferred until seven consecutive zero-usage review windows per key:
Evidence capture:
```bash
python scripts/capture_legacy_meter_evidence.py --days 7
python scripts/capture_legacy_meter_evidence.py # default 8h post-deploy monitoring
python scripts/capture_legacy_meter_evidence.py --days 7 # weekly retirement gate
# writes docs/evidence/legacy-meter-weekly-review-YYYYMMDD.json
```