Repository navigation
refactor(proxy-capture): centralize typed diagnostic queries - #139015
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 5, 2026, 7:11 AM ET / 11:11 UTC. ClawSweeper reviewWhat this changesMoves capture session listings, diagnostic queries, and legacy blob-reference lookup into the existing typed reader while preserving diagnostic output and database ownership. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful maintainer-owned refactor absent from current main. No concrete introduced correctness or security defect was identified in the inspected paths. Priority: P3 Review scores
Verification
How this fits togetherProxy capture stores observed network exchanges for troubleshooting. The CLI and QA Lab request session summaries, traffic diagnostics, and payloads from this store. flowchart LR
A[Captured network exchanges] --> B[Capture database]
C[CLI or QA Lab request] --> D[Capture store]
D --> E[Typed diagnostic reader]
E --> F[Preset and session filter]
F --> B
B --> G[Native SQLite results]
G --> H[Diagnostic output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +47, Tests +101, Other 0. Total +148 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep diagnostic query construction in the existing reader while preserving native execution, public result shapes, and both store constructors. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR reorganizes existing queries rather than claiming a broken user behavior; the inspected tests check behavioral equivalence. Is this the best way to solve the issue? The owner boundary is appropriate: it reuses the existing typed reader and avoids the generic executor's different failure handling. Full dependency-level confirmation remains unavailable in this review environment. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 49ecde890905. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Resolved the dependency-verification item from the latest ClawSweeper review. I directly inspected installed Kysely 0.29.5 builders/parsers, aggregate handling, the default and SQLite compilers, and our synchronous binding helper. These queries compile through Kysely and still execute through the existing native The retained actual-store baseline/candidate proof covers 84 preset comparisons, 14 limit cases, and 15 corruption/error cases across both constructors. It preserves The first hosted run timed out in the unchanged provider-destroy fixture. Its focused tests and original 3,815-test group passed locally; one unchanged failed-job retry is now green. The original hosted timeout's initiating await was not established, so this is not a claim that its root cause was repaired. No test assertion or timeout was weakened. Exact-head CI is green on |
|
Merged via squash.
|
What Problem This Solves
Capture session lists, diagnostic presets and legacy blob lookup maintained handwritten SQL and positional bindings in the write store while related reads already had a typed owner. The missing-ack query also repeated its optional session filter across outer and inner SQL.
Why This Change Was Made
Move these queries into the existing capture read owner using generated Kysely types. Six preset execution paths become one; a shared filtered event query keeps both sides of missing-ack scoped together. Explicit preset branches retain their grouping, counts, thresholds, aliases and order. The store delegates while retaining legacy file handling and both constructor contracts.
Native call-local get/all execution remains because the generic query executor would change corruption recovery and borrowed database lifetime. The public standalone reader and schema are unchanged. Session summaries retain native null fields despite the existing optional-only SDK type; correcting that public type is a separate compatibility decision.
Production grows by 47 lines to express the typed projection/owner boundary while removing repeated SQL fragments and bindings. A descriptor framework or new executor/cache would add concepts solely to reduce line count, so the domain branches remain explicit. Tests grow by 101 lines, consolidating the older duplicate-send checks into broader constructor-paired coverage; the removed assertion baseline shrinks from 23 to 16.
User Impact
Capture diagnostics keep their current results and output shapes. Empty sessions still count zero events; nullable labels and separate hash groups remain intact; scoped missing-ack results are not suppressed by another session. Legacy blob files still require an event reference. This changes query ownership without enabling another database or changing data, cleanup, retention or recovery policy.
Evidence
Independent Codex review completed nine passes with no P0–P2 findings. Direct installed Kysely and Node SQLite contracts were inspected.