Skip to content
This repository was archived by the owner on May 26, 2026. It is now read-only.

feat(kora): KR-FE-PROMOTION-PREVIEW-AND-INVESTIGATION-DRILL-AND-LOGGED-ONLY-MEGABUCKET — 3 deliverables#194

Merged
rafe-walker merged 1 commit into
feature/phase2-upgradesfrom
feat/kora-KR-FE-PROMOTION-PREVIEW-AND-INVESTIGATION-DRILL-AND-LOGGED-ONLY-MEGABUCKET
May 24, 2026
Merged

feat(kora): KR-FE-PROMOTION-PREVIEW-AND-INVESTIGATION-DRILL-AND-LOGGED-ONLY-MEGABUCKET — 3 deliverables#194
rafe-walker merged 1 commit into
feature/phase2-upgradesfrom
feat/kora-KR-FE-PROMOTION-PREVIEW-AND-INVESTIGATION-DRILL-AND-LOGGED-ONLY-MEGABUCKET

Conversation

@rafe-walker

Copy link
Copy Markdown
Owner

Summary

Three operator-trust + decision-support FE features that together raise the cockpit's "Kora is a teammate, not a black box" quality.

Drift-guard pin summary

Pin Test Asserts
_DRILL_DOWN_SUPPORTED_SEAMSSeamName Literal test_supported_seams_drift_guard Every seam in the drill-down allowlist must exist in the audit-sink's SeamName (otherwise read_audit_entries silently returns [] for it)
Preview-template response shape ↔ FE type test_preview_response_type_declared + the page wiring tests All 7 BE fields (rendered_reply, rendered_with_missing_markers, referenced_fields, missing_or_degraded_fields, would_fall_through_to_reasoning_engine, snapshot_present, snapshot_computed_at) declared in PhrasebookPreviewTemplateResponse
Drill-down URL shape ↔ deep-link call sites test_kora_actions_row_links_to_drill_down + test_probe_investigations_card_links_to_drill_down The literal /investigations/${encodeURIComponent(item.caller_session_id)} appears in both source pages — a route rename breaks both deep-link entries together rather than silently rotting one

No FE/BE enum value drift introduced (the 3 deliverables are shape/route/path additions, not new enum constants).

STOP-ASKs resolved inline

  1. Snapshot-preview rendering needs a new endpoint shape (§4 bullet 1) — built POST /api/phrasebook/slack_dm/preview-template accepting just the template, returning render + missing-field list + freshness timestamp. ~75 LoC; reuses _walk_snapshot + _extract_phrasebook_snapshot_refs from existing code.

  2. Drill-down JOIN performance at realistic audit volume (§4 bullet 2) — each per-seam read scans the audit JSONL once; total cost is O(file_size × supported_seam_count). At today's audit volume (low-MB files, ~10 supported seams) this is fast enough that pagination would be premature. Endpoint deliberately doesn't paginate; if file size grows past ~50 MB we'll revisit with a cursor.

  3. "Suggest pattern" UI affordance (§4 bullet 3) — rendered disabled-with-tooltip explaining KR-FE-PATTERN-SUGGESTION is the follow-on. Operator sees the surface coming; no functionality implied that isn't there. Drift-guard test test_suggest_pattern_stub_is_disabled keeps it that way.

Screenshots

All 3 in web/docs/promotion-preview-and-investigation-drill-and-logged-only-megabucket/:

  • promotion_preview.png — Deliverable A: two proposals, one with clean interpolation (green), one with missing-field warning (yellow + named fields)
  • logged_only_analyzer.png — Deliverable B: explainer card + 3 logged-only events with disabled "Suggest pattern" stub
  • investigation_drill_down.png — Deliverable C: full 5-event timeline (wake → tool_call → autofix → completed → DM) for probe:fly:service_unhealthy

Test plan

  • tsc -b clean
  • vite build clean (1.9 MB bundle; no new warnings)
  • 28 new tests pass (preview endpoint matrix + drill-down JOIN + classifier + drift-guards + FE page pins)
  • Full tests/kora_cli/ regression run: 0 new failures introduced; pre-existing failures (cron_profiles + model_switch + panel_view inventory snapshot of 34) confirmed identical on base via stash
  • Operator smoke: open a pending proposal → see green-check preview
  • Operator smoke: edit a proposal's template to reference a missing snapshot field → preview re-renders to yellow warning with field name
  • Operator smoke: open /email-intent-log/logged-only → see un-acted-on events; "Suggest pattern" tooltip explains forward-compat
  • Operator smoke: click "drill" on a KoraActions row → drill-down page loads with full session timeline + raw-JSON expansion

Next CC#2 dispatch

Extend PromotionReviewPage to support the 3 new promotion-loop types (router-tuning / tool-trimming / probe-fix-envelopes) once CC#1's NousResearch#416 lands. The current ProposalCard assumes phrasebook-shaped fields (pattern + reply_template); the new loop types will need shape-discrimination + per-type editor variants. SnapshotPreview can stay phrasebook-only or fan out if any new type proves snapshot-bound.

🤖 Generated with Claude Code

…D-ONLY-MEGABUCKET — 3 deliverables

Three operator-trust + decision-support FE features that together
raise the cockpit's "Kora is a teammate, not a black box" quality.

A) KR-FE-PROMOTION-PREVIEW (CC#2's own #191 recommendation)
   * New BE endpoint POST /api/phrasebook/slack_dm/preview-template
     accepts an arbitrary reply_template + returns rendered output
     against the LIVE snapshot, missing-field list, fall-through
     reason, snapshot freshness timestamp.
   * SnapshotPreview component in PromotionReviewPage's ProposalCard
     renders the live preview in both view + edit modes; 300ms debounce
     re-renders as operator edits the template.
   * Green chip "✓ all placeholders interpolate cleanly" / Yellow
     warning "would fall through to reasoning engine — N placeholders
     missing or 'unknown'" with the exact field list.

B) KR-FE-EMAIL-LOGGED-ONLY-ANALYZER (CC#1 PR #180 follow-on, task NousResearch#400)
   * New page /email-intent-log/logged-only filtering
     intent.email_to_sea_ticket → action="logged_only" client-side.
   * Why-this-view explainer card framing the page as both a triage
     surface (Kora missed something) AND training-data lens for
     the eventual KR-PROMOTE-EMAIL-INTENT loop.
   * "Suggest pattern" CTA stubbed disabled-with-tooltip — operator
     sees the surface coming without implying it's wired (flagged
     in PR + STOP-ASK as future bucket KR-FE-PATTERN-SUGGESTION).
   * No new BE endpoint — reuses /api/email-intent/recent.

C) KR-FE-INVESTIGATION-DRILL-DOWN
   * New BE endpoint GET /api/investigations/{caller_session_id:path}
     joins EVERY audit row + slack_dm_log entry sharing the session
     id into one oldest-first chronological timeline. Per-seam
     projections reuse existing per-seam panel helpers for privacy
     parity. Allowlist (_DRILL_DOWN_SUPPORTED_SEAMS) gates which
     seams can surface — drift-guarded against SeamName Literal.
   * New page /investigations/:callerSessionId with per-row card,
     per-seam icon, deep-link to per-seam panel, expandable raw-JSON
     toggle.
   * Deep-links wired from KoraActionsPage rows + ProbeInvestigations
     cards (Search-icon "drill" chip next to each caller_session_id).
   * Kind classifier (probe / email / promotion / other) drives the
     page header icon + title.

Drift-guard pin: _DRILL_DOWN_SUPPORTED_SEAMS ↔ SeamName Literal,
pinned by test_supported_seams_drift_guard so a "supported" seam
that's not in SeamName (== returns []) is caught at CI.

Tests: 28 new tests (preview endpoint behaviour matrix + drill-down
JOIN + session-id classifier + drift-guards + FE page pins).
Full kora_cli suite: my changes introduce zero new failures;
pre-existing failures (cron_profiles + model_switch + panel_view
inventory snapshot) confirmed identical on base branch via stash.

Screenshots: web/docs/promotion-preview-and-investigation-drill-and-logged-only-megabucket/.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rafe-walker rafe-walker merged commit e48cf61 into feature/phase2-upgrades May 24, 2026
@rafe-walker rafe-walker deleted the feat/kora-KR-FE-PROMOTION-PREVIEW-AND-INVESTIGATION-DRILL-AND-LOGGED-ONLY-MEGABUCKET branch May 24, 2026 07:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant