Repository navigation
feat(frontend): inspect retrieved chunks in the dashboard - #44
Conversation
Add a retrieval preview tab with optional channel scope, ranked chunks, raw distances and effective settings. Cover loading, retries, cancellation and safe rendering with offline tests. Configure the missing Tailwind PostCSS plugin and capture desktop and narrow fixture views. Co-authored-by: OpenAI Codex <noreply@openai.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Captured offline at commit The frontend gate lists the eight new retrieval tests and the seven existing conversation tests. The backend gate passed all 153 tests. These existing preview cases exercise the shared retrieval policy used by the new tab. The existing Chroma fixture printed this before/after cutoff transcript during the gate. Fixed-vector squared L2 distances prove policy parity, not production relevance. {
"before_cutoff": {
"question": "How do I reset VPN?",
"channel_id": "CTARGET",
"top_k": 2,
"max_distance": null,
"items": [
{
"content": "Reset VPN via IT portal",
"metadata": {
"channel_id": "CTARGET",
"message_ts": "1.0",
"source": "slack"
},
"distance": 1.0
},
{
"content": "Ask IT for VPN access",
"metadata": {
"channel_id": "CTARGET",
"message_ts": "2.0",
"source": "slack"
},
"distance": 4.0
}
]
},
"after_cutoff": {
"question": "How do I reset VPN?",
"channel_id": "CTARGET",
"top_k": 2,
"max_distance": 1.0,
"items": [
{
"content": "Reset VPN via IT portal",
"metadata": {
"channel_id": "CTARGET",
"message_ts": "1.0",
"source": "slack"
},
"distance": 1.0
}
]
},
"note": "Fixed-vector squared L2 distances prove policy parity, not production relevance."
}Cutoff unset. The following is the actual local HTTP request and response. $ curl --silent --show-error --include --request POST http://127.0.0.1:18143/api/retrieval/preview --header 'Content-Type: application/json' --data '{"question":"How do I reset VPN?","channel_id":"CTARGET"}'
HTTP/1.1 200 OK
date: Sat, 14 Nov 2026 02:24:58 GMT
server: uvicorn
content-length: 345
content-type: application/json
{"question":"How do I reset VPN?","channel_id":"CTARGET","top_k":2,"max_distance":null,"items":[{"content":"Reset VPN via IT portal","metadata":{"channel_id":"CTARGET","message_ts":"1.0","source":"slack"},"distance":1.0},{"content":"Ask IT for VPN access","metadata":{"channel_id":"CTARGET","message_ts":"2.0","source":"slack"},"distance":4.0}]}Cutoff set to 1. The following is the actual local HTTP request and response. $ curl --silent --show-error --include --request POST http://127.0.0.1:18143/api/retrieval/preview --header 'Content-Type: application/json' --data '{"question":"How do I reset VPN?","channel_id":"CTARGET"}'
HTTP/1.1 200 OK
date: Sat, 14 Nov 2026 02:22:30 GMT
server: uvicorn
content-length: 221
content-type: application/json
{"question":"How do I reset VPN?","channel_id":"CTARGET","top_k":2,"max_distance":1.0,"items":[{"content":"Reset VPN via IT portal","metadata":{"channel_id":"CTARGET","message_ts":"1.0","source":"slack"},"distance":1.0}]}Fixture backend lifecycle recorded in Fixture backend lifecycle recorded in Desktop and narrow screenshots are committed under |
|
Completed the existing scheduled-run slice and merged it as a6eac10. No additional code changes were needed. The merged main tree is identical to the branch tree verified below.
Reviewed the existing desktop screenshot and the fixture-based behaviour proof. The prior run successfully captured desktop/mobile views and local API transcripts; no capture method was blocked. These captures were retained rather than regenerated because the code did not change. The merge closed child #43. Parent #5 stays open. The remote branch was deleted, and its clean previous worktree was detached before removing the local branch. Release PR #12 was skipped. No live Slack connection, messages, real tokens or Socket Mode were used in this run. The remaining backlog means the schedule stays active. |
The dashboard now has a Retrieval tab for inspecting ranked chunk text, source metadata, raw distances and effective settings with optional channel scope. It handles loading, empty results, retries and cancellation, and clears stale results when inputs change.
Part of #5. Closes #43. Parent #5 stays open.
The first browser capture exposed missing Tailwind compilation across the dashboard. This slice includes the PostCSS configuration and the matching
@tailwindcss/postcss4.1.18 dependency, so existing utility classes render as intended. This affects styling across all tabs; navigation wraps on narrow screens. The setup follows the official Next.js integration.Verified offline with the repository gates.
UV_PYTHON=3.13 UV_FROZEN=1 mise run installpassed. Frozen mode preserves the Python lockfile.UV_PYTHON=3.13 UV_FROZEN=1 SLACK_BOT_TOKEN=xoxb-fixture-only SLACK_SIGNING_SECRET=fixture-only PYTEST_ADDOPTS=-rP mise run test-backendpassed all 153 tests, including the existing local Chroma cutoff transcript. Existing dependency deprecation warnings remain.mise run test-frontendpassed all 15 tests, including 8 new retrieval cases. They exercise the actual API client through the dashboard with mocked fetch, covering trimmed and omitted channel scope, rank and raw distance preservation, zero and unset cutoffs, duplicate submission prevention, empty results, retry, stale result clearing, cancellation on tab exit and plain text rendering.mise run test-runtimepassed all 7 offline tests.cd frontend && mise exec -- bun run buildpassed, including TypeScript checking and static page generation.NEXT_PUBLIC_API_URL=http://127.0.0.1:18143 mise run dev-frontend -- --hostname 127.0.0.1 --port 18144started successfully for the browser capture.PYTHONPATH="$PWD/.tmp/proof:$PWD/backend" UV_PYTHON=3.13 UV_FROZEN=1 RETRIEVAL_MAX_DISTANCE=1 mise run dev-backend -- --host 127.0.0.1 --port 18143reached application startup and shut down cleanly. Repeated with the cutoff unset. The temporary harness uses local SQLite and Chroma, fixed embeddings, mocked Slack authentication and guards blocking Slack API calls, Socket Mode, generation and remote connections. It is the harness recorded in PR #42's proof, copied into this worktree's.tmp/proof/.git diff --checkpassed.Desktop and narrow browser capture succeeded against the fixture backend. The 390-pixel viewport had a 390-pixel document width, with no horizontal overflow. Browser checks also confirmed an empty result for
CMISSING, a visible retry after stopping the backend, and successful recovery after restarting it. Captures were saved under.tmp/proof/and copied into the retrieval documentation for durable review.View the narrow screen capture.
For
How do I reset VPN?scoped toCTARGET, local curl returned HTTP 200 with two chunks at squared L2 distances 1 and 4 when the cutoff was unset. With cutoff 1, it returned only the first chunk. These fixture distances demonstrate the UI reflecting the existing policy; they do not measure production relevance. Test names, actual curl responses and startup output are recorded in the proof comment.No capture method was blocked. Live Slack verification is excluded by the schedule's safety rule. No real tokens, messages or Socket Mode were used. No backend API, retrieval ranking or database schema changed. The management API still needs trusted access controls; channel scope is a filter, not authorisation. Preview calls can incur embedding costs with a real provider, and cancelling the browser request cannot guarantee cancellation of backend embedding work already started. Authentication and tuning controls remain outside this slice.
GitHub CI is green for this commit, including tests and all three container builds, CodeQL and Socket checks.