REUSE-WP-0019-T04: reuse telemetry store and recording
Implements the hub side of the shared reuse-event schema (already drafted in WP-0018-T01, schemas/reuse-event.schema.json): a SQLite reuse_events table, POST /v1/reuse-events (token-auth), GET /v1/reuse-events?capability_id= (read-only). reuse_surface/plan_check.py: refactored record_outcome around a new shared post_or_fallback_reuse_event() helper -- tries the hub first, falls back to the local JSONL only on failure/unreachability, never both. New record_manual_reuse_event() backs a new CLI command, reuse-surface record-reuse, for retroactive facts recorded outside plan-check. Privacy/scope (repo slugs and capability ids only, no code, no secrets) is enforced structurally via the schema's additionalProperties: false, not just by convention. 21 new pytest cases, 145 total pass. Live-verified against a real running hub instance: POST/GET /v1/reuse-events directly, record-reuse and plan-check --record-outcome both posting successfully to the hub, and -- after actually killing the hub process -- confirmed the fallback path writes correctly to the local JSONL instead of erroring. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
2fcc91f2aa
commit
d181043717
12 changed files with 562 additions and 32 deletions
7
SCOPE.md
7
SCOPE.md
|
|
@ -80,11 +80,16 @@ The MVP registry foundation, CLI tooling (REUSE-WP-0003), federation stack
|
|||
get a reuse/extend/new verdict; `--file-request` bridges a `new` verdict to
|
||||
a State Hub capability request; `report gaps --check-capability-requests`
|
||||
surfaces open requests with no matching capability
|
||||
- **Get automatic hub refresh** (REUSE-WP-0019-T02) — a Forgejo push
|
||||
- **Get automatic hub refresh** (REUSE-WP-0019-T02/T03) — a Forgejo push
|
||||
webhook (`POST /v1/webhooks/forgejo`, HMAC-signed) recomposes the hub's
|
||||
federated index when a registered repo's `registry/indexes/` changes,
|
||||
with `composed_at`/`stale` visibility on `GET /v1/federated` and a
|
||||
scheduled fallback recompose if a webhook delivery is ever missed
|
||||
- **Record reuse telemetry** (REUSE-WP-0019-T04) — `plan-check
|
||||
--record-outcome` and `reuse-surface record-reuse` post facts to
|
||||
`POST /v1/reuse-events` when the hub is reachable, falling back to
|
||||
`registry/telemetry/plan-check-events.jsonl` otherwise (same schema
|
||||
either way); `GET /v1/reuse-events?capability_id=` aggregates them
|
||||
|
||||
Registry **tooling** availability is **A4** (CLI plus hosted hub HTTP API).
|
||||
Registry **authoring** remains Markdown-first; consumption combines entries, the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue