teleo-infrastructure/diagnostics
m3taversal 61007042bc fix(claims): proper-prefix slug fallback + event-loop unblock
Ganymede review 2026-05-11 — three issues addressed.

MUST-FIX — prefix fallback broken in both directions:
  Old code used common-prefix matching with a 32-char anchor. This admitted
  two failure modes:

  1. False-positive: stems "X-A" and "X-B" (sharing 50+ char prefix) both
     pass the threshold for a request "X-C-something". Loop picks whichever
     iterates first — dict iteration = filesystem walk order = non-deterministic
     which claim gets served. Two instances with identical data could disagree.

  2. False-negative: a 24-char stem proper-prefix of a longer request never
     reaches the 32-char anchor. Returns 404 despite the correct match
     sitting right there in by_stem.

  Fix: require norm_req.startswith(norm_stem). Proper prefix is much stronger
  than common prefix — drop the anchor to 16 chars without admitting noise.
  Pull to module constant _PREFIX_ANCHOR_MIN.

  Verified against real KB collisions (semaglutide pair, liquidity-weighted-price
  pair, attractor-digital-feudalism short-stem case):
    - Common-prefix XYZZY collision: 200 -> 404 (correct)
    - Proper-prefix match: resolves to shorter B stem (correct, deterministic)
    - 27-char proper-prefix request: 404 -> 200 (correct)
    - All 4 yesterday's long-slug repros: still 200

WARNING — _build_indexes blocks event loop for ~3.3s on cold cache:
  Routed through asyncio.to_thread. Warm-cache overhead negligible (dict
  access), cold-cache concurrent requests no longer stall.

NITS:
  - _split_frontmatter catches yaml.YAMLError specifically, logs WARNING
    with file path. Bare Exception was hiding KB integrity drift.
  - _INDEX_CACHE_TTL bumped 60s -> 300s to match commit-message intent.
  - PREFIX_ANCHOR_MIN pulled to module constant with calibration comment.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 13:12:49 +01:00
..
activity_endpoint.py feat(activity): Timeline data gaps — type filter + commit_type classifier + source_channel reshape 2026-04-23 19:51:58 +01:00
activity_feed_api.py feat(activity-feed): add kind + target_url, fix research-session pseudo-slugs 2026-05-11 12:36:25 +01:00
alerting.py fix: sync all code from VPS — repo is now authoritative source of truth 2026-04-15 13:18:01 +01:00
alerting_routes.py fix: sync all code from VPS — repo is now authoritative source of truth 2026-04-15 13:18:01 +01:00
app.py fix(diagnostics): wire /api/leaderboard into app.py + fix rolling-window SQL 2026-04-27 13:30:26 +01:00
backfill_submitted_by.py Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
claims_api.py fix(claims): proper-prefix slug fallback + event-loop unblock 2026-05-11 13:12:49 +01:00
contributor_profile_api.py feat: filter system accounts from leaderboard, add primary_ci field 2026-04-21 11:33:47 +01:00
daily_digest.py Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
daily_digest_routes.py Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
dashboard-v2.html Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
dashboard_agents.py Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
dashboard_epistemic.py fix: sync all code from VPS — repo is now authoritative source of truth 2026-04-15 13:18:01 +01:00
dashboard_health.py Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
dashboard_ops.py Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
dashboard_portfolio.py fix: apply Ganymede review fixes to portfolio code 2026-04-20 17:00:02 +01:00
dashboard_prs.py fix: sync all code from VPS — repo is now authoritative source of truth 2026-04-15 13:18:01 +01:00
dashboard_routes.py sync: dashboard_routes.py from VPS — digest + contributor-graph endpoints 2026-04-21 11:01:15 +01:00
leaderboard_routes.py fix(diagnostics): wire /api/leaderboard into app.py + fix rolling-window SQL 2026-04-27 13:30:26 +01:00
research_routes.py fix: sync all code from VPS — repo is now authoritative source of truth 2026-04-15 13:18:01 +01:00
research_tracking.py fix: sync all code from VPS — repo is now authoritative source of truth 2026-04-15 13:18:01 +01:00
response_audit_routes.py Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
review_queue.py fix: sync all code from VPS — repo is now authoritative source of truth 2026-04-15 13:18:01 +01:00
review_queue_routes.py Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
shared_ui.py sync VPS state: portfolio dashboard + fetch_coins.py 2026-04-20 16:55:36 +01:00
teleo-diagnostics.service epimetheus: sync VPS-deployed code to repo — Mar 18-20 reliability + features 2026-03-20 20:17:27 +00:00
tier1_metrics.py Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
tier1_routes.py Consolidate pipeline code from teleo-codex + VPS into single repo 2026-04-07 16:52:26 +01:00
vitality.py fix: sync all code from VPS — repo is now authoritative source of truth 2026-04-15 13:18:01 +01:00
vitality_routes.py fix: sync all code from VPS — repo is now authoritative source of truth 2026-04-15 13:18:01 +01:00