reuse-surface/tests
tegwick e0a4de3310 REUSE-WP-0019-T02: hub recompose staleness tracking + Forgejo webhook
reuse_surface/hub/store.py: compose_state table tracking composed_at/stale,
updated only on a *forced* recompose (refresh=true, webhook, future
scheduled fallback) -- a plain GET still serves current best-effort data
but never silently reports itself as freshly composed.

reuse_surface/hub/webhooks.py: constant-time HMAC-SHA256 signature
verification (fails closed on an empty/unconfigured secret) and
path-only push-payload inspection (never parses file content, per design
principle 2 -- webhook only decides whether to trigger a pull-based
recompose).

New endpoint POST /v1/webhooks/forgejo, accepting both
X-Forgejo-Signature and X-Gitea-Signature headers since sibling repos
migrate independently. GET /v1/federated and POST /v1/federated/compose
now share an asyncio.Lock with the webhook so concurrent recompose
triggers coalesce instead of overlapping.

No separate /v1/recompose route was added -- POST /v1/federated/compose
already did that job from earlier hub work; specs/FederationHubAPI.md now
documents this explicitly instead of duplicating it.

28 new pytest cases (128 total pass). Live-verified: ran the actual hub
service locally and sent a real HMAC-signed webhook over HTTP, confirming
the full webhook-to-recompose path, signature rejection, and the
irrelevant-path no-op.

Does NOT deploy to the live reuse.coulomb.social hub -- that needs a
container rebuild/push/k8s rollout, a separate production-deployment
action out of scope here without explicit sign-off.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-07 18:24:55 +02:00
..
test_establish.py Implement REUSE-WP-0013 registry establish, update, and stats 2026-06-16 01:21:01 +02:00
test_federation.py Complete WP-0010: HTTP remote federation with cache 2026-06-15 02:28:44 +02:00
test_forge_host.py REUSE-WP-0019-T01: forge host abstraction + URL migration inventory 2026-07-07 18:14:30 +02:00
test_hub.py REUSE-WP-0019-T02: hub recompose staleness tracking + Forgejo webhook 2026-07-07 18:24:55 +02:00
test_hub_sync.py Implement REUSE-WP-0012 federation scale and intent alignment 2026-06-16 00:42:50 +02:00
test_interactive.py WP-0016 finished: interactive registry maintain with llm-connect automation 2026-06-18 04:00:39 +02:00
test_llm_bridge.py Implement REUSE-WP-0013 registry establish, update, and stats 2026-06-16 01:21:01 +02:00
test_maintain.py WP-0016 finished: interactive registry maintain with llm-connect automation 2026-06-18 04:00:39 +02:00
test_plan_check.py REUSE-WP-0018-T03: LLM semantic rerank for plan-check 2026-07-07 17:27:39 +02:00
test_registry.py Complete WP-0006 through WP-0009: registry expansion, catalog, graph, tests 2026-06-15 02:24:20 +02:00
test_registry_update.py Implement REUSE-WP-0013 registry establish, update, and stats 2026-06-16 01:21:01 +02:00
test_reports.py Add core-hub to roster and federation sources 2026-07-07 01:56:18 +02:00
test_statehub_bridge.py REUSE-WP-0018 T01/T02/T04/T06: plan-check deterministic matching + State Hub bridge 2026-07-07 00:57:18 +02:00
test_stats.py Add core-hub to roster and federation sources 2026-07-07 01:56:18 +02:00
test_webhooks.py REUSE-WP-0019-T02: hub recompose staleness tracking + Forgejo webhook 2026-07-07 18:24:55 +02:00