HUB-WP-0006-T06: seed legacy topic aliases and add RM_SLICE_TOPICSPINE

- hub_core/runtime/data/legacy_topic_aliases.json: checked-in, versioned
  (2026-10-13.1) seed of the 16 State Hub topics from the STATE-WP-0098-T01
  capture -> primary_domain facet, residual owner STATE-WP-0079, expiry
  2027-03-31T23:59:59Z. Never fetched live; topic UUIDs kept verbatim.
- legacy_topic_aliases.py: loader validated against the 1.0.0
  legacyTopicAlias schema; per-response active/expired status; underscore
  slugs emitted hyphenated (1.0.0 pattern forbids '_').
- RM_SLICE_TOPICSPINE setting (off|shadow|on, default off). off keeps the
  navigation output unchanged (aliases []); shadow/on serve the aliases and
  mark responses with X-RM-Slice-Topicspine. Documented as the A5 rollback
  switch in docs/runtime.md.
- tests/test_legacy_topic_aliases.py: seed, flag and local A5 comparison
  cases (C01, C02/C08, C03, C10) against fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 356991@bnt-lap001
Assistant-Session: 5d99ea69-ed55-4a1e-8d97-f4f312db247f
This commit is contained in:
tegwick 2026-10-13 23:33:42 +02:00
parent e8fb648f25
commit 9e4d5ba23c
10 changed files with 762 additions and 2 deletions

View file

@ -77,3 +77,32 @@ entry maps one State Hub topic UUID/slug to one derived facet and must name an
classification. Expired aliases return `410` until removed; there are no write
operations in the navigation OpenAPI surface. STATE-WP-0079 owns alias expiry
and the consumer route switch.
### Runtime alias source (HUB-WP-0006-T06)
The runtime serves aliases from one checked-in, versioned seed:
`hub_core/runtime/data/legacy_topic_aliases.json` (`alias_set_version`
`2026-10-13.1`). It holds the 16 active State Hub topics captured on
2026-10-13 by `GET /topics/?status=active` (State Hub packet
STATE-WP-0098-T01). Each alias maps `legacy_topic_id` to
`facet_kind = primary_domain` and `facet_value = topic.domain_slug`, with
`residual_owner = STATE-WP-0079` and `expires_at = 2027-03-31T23:59:59Z`.
hub-core never fetches topics from State Hub at runtime. Topic UUIDs are
identity and must not change while repositories carry `topic_id`. To renew
or retire aliases, edit the seed and bump `alias_set_version`.
The 1.0.0 `legacy_topic_slug` pattern forbids underscores. Three legacy
slugs (`inter_hub`, `vergabe_teilnahme`, `citation_evidence_mvp`) are
emitted with hyphens; the seed keeps the State Hub spelling. Comparisons
must normalise `_` to `-`. Emitting the exact spelling needs a contract
patch that widens the pattern.
`status` is computed per response: `expired` from `expires_at` onward.
Aliases are emitted unfiltered on every navigation response, so a facet
query still carries all of them. There is no per-alias route yet, so the
`410` behaviour above applies only once such a route exists.
Aliases are served only when `RM_SLICE_TOPICSPINE` is `shadow` or `on`
(see `docs/runtime.md`). With the default `off`, `legacy_topic_aliases`
stays `[]`.

View file

@ -66,6 +66,29 @@ canonical content hash. MCP exposes the same surface through
`query_repository_navigation` and `get_repository_navigation_facet`. No
classification-write endpoint exists.
### `RM_SLICE_TOPICSPINE` (A5 topic-spine rollback switch)
`RM_SLICE_TOPICSPINE` controls whether hub-core serves the A5 topic-spine
reads. These are the legacy topic aliases on the navigation responses. It
takes one of three values:
| Value | Behaviour |
| --- | --- |
| `off` (default) | Unchanged output: `legacy_topic_aliases` is `[]`, there are no extra headers, and the alias seed is not loaded. |
| `shadow` | Serves the checked-in aliases so the A5 comparison can run. Responses carry `X-RM-Slice-Topicspine: shadow` and `X-Legacy-Topic-Alias-Set: <version>`. Callers have not switched. |
| `on` | Same payload with header value `on`. hub-core is now the switched A5 read source. |
Any other value fails startup. In `shadow` and `on`, a bad alias seed also
fails startup. When the flag is not `off`, `/readyz` reports
`rm_slice_topicspine`.
**Rollback:** set `RM_SLICE_TOPICSPINE=off` and restart. State Hub's
`GET /topics/` and `GET /topics/{id}` remain the fallback throughout.
Confirm the rollback with packet case A5-C10. The flag does not re-point
callers; each caller owner switches its own base URL. Do not move the flag
from `off` in any environment until HUB-WP-0006-T06's switch window is
approved.
Workload projection uses a distinct injected `WorkloadProjectionClient` and
the authoritative `helixforge.workload-reference/v1` identity pair. Migration
`0004_workload_projection` stores only normalized transport rows and source