state-hub/tests
tegwick 3dbbc753bc
All checks were successful
CI Smoke / host-smoke (push) Successful in 1s
CI Smoke / container-smoke (push) Successful in 3s
CUST-WP-0061-T03: the promotion transition (statehub promote-intake)
The mechanism named in canon/standards/work-record-types_v0.1.md:
"Promotion is a first-class transition... manual transcription of an
intake item into other kinds is a process defect." This is what AWQ-010
needed and didn't have -- a human/agent had to notice, transcribe, and
re-register it by hand. One call now does what that manual pass did.

scripts/promote_intake.py: intake.routed -> workplan | task | decision |
engagement.
  - workplan: new ADR-001 file at workplans/{ID}-{slug}.md, registered
    against the hub (repo+topic resolution, POST /workplans, frontmatter
    id write-back)
  - task: appended as a ```task``` block to an existing --workplan-file,
    registered via POST /tasks, reuses the existing
    _inject_task_id_into_block writeback helper
  - decision: appended as a ```yaml``` block with a fresh
    {PREFIX}-DEC-{YYYY}-{NNN} id to --target-file, registered the same
    way C-32 registers decisions (reuses _inject_yaml_block_field)
  - engagement: appended as a ```yaml``` block with a fresh
    {PREFIX}-ENG-{YYYY}-{NNN} id -- file-only, no hub entity exists yet
    (same honest deferral as C-32), reported not silently skipped

In every case the intake is closed with outcome=promoted and
promoted_to=<new canonical id>; the new record carries an
origin: "intake:<id>" back-link.

Wired as `statehub promote-intake <intake-id> --to <kind> --repo-slug
<slug> --repo-path <path> --domain <domain> [--target-file ...]
[--workplan-file ...]`, matching the CLI shape named in the workplan text.

17 tests: pure helpers (_slugify, _next_number, _append_yaml_block,
frontmatter injection) offline; full promote_intake() flow with the hub
API mocked.

Live-verified against the real running API/DB and a real repo
(binky-control), not just mocks -- and the live proof caught a real bug:
the first workplan-promotion run silently produced a false success (the
intake was closed outcome=promoted, but /workplans/ actually 422'd on a
missing repo_id that the code never resolved, so no workstream was ever
created). Fixed to resolve repo_id via /repos/{slug} and to raise loudly
on registration failure instead of writing a half-registered file
silently; locked in as two regression tests. Re-verified clean:
workplan promotion (CLI direct + through `statehub promote-intake`
itself) and decision promotion both proven end-to-end against the live
hub, with all scratch artefacts (files + hub rows) cleaned up afterward.
No regressions: full state-hub suite (271 tests across
test_promote_intake, test_intake, test_work_record_registration,
test_work_record_check, test_routers_core, test_consistency_check,
test_consistency_sweep, test_mcp_smoke, test_mcp_write_tools) green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 01:06:01 +02:00
..
__init__.py feat(state-hub): integrate llm-connect as dependency (S3.1) 2026-02-27 08:32:17 +01:00
conftest.py STATE-WP-0070 T03: remove legacy workstream MCP aliases 2026-07-13 09:29:12 +02:00
test_capability_requests.py feat(classification-spine): implement STATE-WP-0065 repo-anchored model 2026-06-22 13:52:13 +02:00
test_classification.py feat(classification-spine): implement STATE-WP-0065 repo-anchored model 2026-06-22 13:52:13 +02:00
test_consistency_check.py feat(api): retire phase-1/2 /workstreams REST aliases with 410 stranglers 2026-07-10 13:31:57 +02:00
test_consistency_sweep.py feat(STATE-WP-0064): start parallel week with source-tagged sweep runners 2026-06-21 21:46:43 +02:00
test_cors.py feat: add workplan aliases and legacy meter 2026-06-04 08:25:31 +02:00
test_doi_scope_health.py scope refactoring 2026-05-01 01:47:14 +02:00
test_edge_outbox.py feat(statehub): add offline write buffer relay 2026-06-25 13:44:27 +02:00
test_edge_read_cache.py feat(edge): add offline read cache for allowlisted State Hub GET routes 2026-07-09 01:04:15 +02:00
test_edge_relay.py feat(statehub): add offline write buffer relay 2026-06-25 13:44:27 +02:00
test_ensure_gitignore_claude_rules.py Add gitignore-claude template and wire into registration flows 2026-07-08 15:06:18 +02:00
test_hub_core_imports.py feat: reuse hub-core base schemas 2026-06-07 16:42:54 +02:00
test_ingest_sbom.py feat(sbom): CUST-WP-0013 — expand SBOM infra to terraform, ansible, and tool manifests 2026-03-12 04:40:26 +01:00
test_intake.py CUST-WP-0061-T01: intake work-record entity (stage 3) 2026-07-21 00:27:45 +02:00
test_legacy_meter.py feat(api): retire phase-1/2 /workstreams REST aliases with 410 stranglers 2026-07-10 13:31:57 +02:00
test_lifecycle.py feat(tasks): adopt canonical task statuses 2026-05-26 01:32:50 +02:00
test_llm_connect_integration.py feat(state-hub): integrate llm-connect as dependency (S3.1) 2026-02-27 08:32:17 +01:00
test_mcp_legacy_deprecation.py STATE-WP-0070 T03: remove legacy workstream MCP aliases 2026-07-13 09:29:12 +02:00
test_mcp_queued_receipts.py feat(statehub): add offline write buffer relay 2026-06-25 13:44:27 +02:00
test_mcp_registration.py Rename MCP server identifier from state-hub to dev-hub 2026-06-22 20:46:14 +02:00
test_mcp_smoke.py STATE-WP-0070 T04 (partial): drop open_workstreams from /state/summary 2026-07-13 10:04:38 +02:00
test_mcp_write_tools.py STATE-WP-0070 T03: remove legacy workstream MCP aliases 2026-07-13 09:29:12 +02:00
test_policy_router.py feat: use hub-core policy router 2026-06-07 13:14:08 +02:00
test_promote_intake.py CUST-WP-0061-T03: the promotion transition (statehub promote-intake) 2026-07-21 01:06:01 +02:00
test_recently_on_scope.py feat(classification-spine): implement STATE-WP-0065 repo-anchored model 2026-06-22 13:52:13 +02:00
test_reconciliation.py feat(tasks): adopt canonical task statuses 2026-05-26 01:32:50 +02:00
test_register_from_classification.py feat(classification-spine): implement STATE-WP-0065 repo-anchored model 2026-06-22 13:52:13 +02:00
test_repo_sync.py feat(consistency): T04 push seal — closed-loop writeback for automated commits 2026-04-21 01:43:40 +02:00
test_routers_core.py STATE-WP-0070 T04 (partial): drop open_workstreams from /state/summary 2026-07-13 10:04:38 +02:00
test_routers_td_ep_contrib.py fix(api): normalize trailing slashes — no slash on param routes 2026-04-26 15:13:01 +02:00
test_services_router.py STATE-WP-0062 T5: docs, first-party↔repo test, mark workplan finished 2026-06-19 21:16:37 +02:00
test_statehub_register_cli.py Add gitignore-claude template and wire into registration flows 2026-07-08 15:06:18 +02:00
test_suggestions.py Finish CUST-WP-0011 and implement STATE-WP-0061 suggestion backlog. 2026-07-06 10:52:49 +02:00
test_summary_cache.py STATE-WP-0070 T04 (partial): drop open_workstreams from /state/summary 2026-07-13 10:04:38 +02:00
test_task_bulk_status_sync.py feat(classification-spine): implement STATE-WP-0065 repo-anchored model 2026-06-22 13:52:13 +02:00
test_task_flow_engine.py STATE-WP-0069 T06: add workplan flow entity and prefer open_workplans 2026-07-08 21:26:29 +02:00
test_todo_md_staleness.py Add GET /repos/todo-md-staleness for daily TODO.md review 2026-07-08 13:19:06 +02:00
test_token_events.py feat(classification-spine): implement STATE-WP-0065 repo-anchored model 2026-06-22 13:52:13 +02:00
test_token_passthrough.py feat(classification-spine): implement STATE-WP-0065 repo-anchored model 2026-06-22 13:52:13 +02:00
test_token_sources.py Fixed and improved token tracking 2026-05-23 13:59:05 +02:00
test_tpsc_router.py feat: use hub-core TPSC router 2026-06-07 14:08:55 +02:00
test_work_record_check.py Test coverage for C-31 work-record sidetrack detector (CUST-WP-0060 review) 2026-07-20 23:09:40 +02:00
test_work_record_registration.py C-32: fix-consistency registration for intake/decision work records (CUST-WP-0061-T02) 2026-07-21 00:48:10 +02:00
test_write_idempotency.py feat(statehub): add offline write buffer relay 2026-06-25 13:44:27 +02:00