STATE-WP-0070: identity headers, archive 0069, phase-2 workplan
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Has been cancelled

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.
This commit is contained in:
tegwick 2026-07-09 00:39:09 +02:00
parent 2f06751d4f
commit bb6bec9f10
10 changed files with 198 additions and 17 deletions

View file

@ -6,11 +6,13 @@ import urllib.error
import urllib.request
API_BASE = os.environ.get("API_BASE", "http://127.0.0.1:8000").rstrip("/")
_HEADERS = {"X-StateHub-Component": "state-hub.dashboard.token-summary"}
def fetch(url: str):
try:
with urllib.request.urlopen(url, timeout=10) as resp:
req = urllib.request.Request(url, headers=_HEADERS)
with urllib.request.urlopen(req, timeout=10) as resp:
return json.loads(resp.read())
except urllib.error.URLError:
return None

View file

@ -6,9 +6,11 @@ import urllib.request
import urllib.error
API_BASE = os.environ.get("API_BASE", "http://127.0.0.1:8000").rstrip("/")
_HEADERS = {"X-StateHub-Component": "state-hub.dashboard.workstreams-list"}
try:
with urllib.request.urlopen(f"{API_BASE}/workplans", timeout=10) as resp:
req = urllib.request.Request(f"{API_BASE}/workplans", headers=_HEADERS)
with urllib.request.urlopen(req, timeout=10) as resp:
data = json.loads(resp.read())
print(json.dumps(data))
except urllib.error.URLError as e:

View file

@ -7,6 +7,7 @@ import urllib.request
import urllib.error
API_BASE = os.environ.get("API_BASE", "http://127.0.0.1:8000").rstrip("/")
_HEADERS = {"X-StateHub-Component": "state-hub.dashboard.workplan-detail"}
ws_id = sys.argv[1] if len(sys.argv) > 1 else ""
@ -15,7 +16,8 @@ if not ws_id:
sys.exit(1)
try:
with urllib.request.urlopen(f"{API_BASE}/workplans/{ws_id}", timeout=10) as resp:
req = urllib.request.Request(f"{API_BASE}/workplans/{ws_id}", headers=_HEADERS)
with urllib.request.urlopen(req, timeout=10) as resp:
data = json.loads(resp.read())
print(json.dumps(data))
except urllib.error.HTTPError as e: