Skip to content

chore: batched code-review low findings (L1,L2,L4,L5,L6,L9)#123

Merged
nkcoder merged 2 commits into
mainfrom
chore/120-batched-low-cleanups
Jul 3, 2026
Merged

chore: batched code-review low findings (L1,L2,L4,L5,L6,L9)#123
nkcoder merged 2 commits into
mainfrom
chore/120-batched-low-cleanups

Conversation

@nkcoder

@nkcoder nkcoder commented Jul 1, 2026

Copy link
Copy Markdown
Owner

What & why

Batch of low-severity cleanups from the code review (issue #120). L8 (code-splitting CodeMirror) deferred; L3/L7 verified only (already handled by the docs pass).

Item Change
L1 ExecuteQuery formats a [16]byte value as a UUID only when the column's DataTypeOID == pgtype.UUIDOID, so unrelated 16-byte values aren't misrendered
L2 GetQueryHistory tail-reads the .jsonl backward in 64 KiB chunks for a positive limit instead of loading the whole file (also drops the old 1 MB per-line scanner cap)
L4 Removed dead Wails-template frontend/src/App.css (#logo/.input-box/.result; app mounts on #root) and its import
L5 Centralized backend magic numbers (maxQueryRows, poolMaxConns, introspectTimeout, queryTimeout — collapsing the 8× repeated 10*time.Second) and the frontend resize clamps
L6 Centralized the two localStorage keys into a STORAGE_KEYS object
L9 The 30s context-deadline error is rewritten to "query exceeded the 30s timeout" at every exit point in ExecuteQuery

Tests

  • New: TestQueryTimeoutError, TestExecuteQuery_UUIDFormatting_Integration, TestGetQueryHistory_TailOrder, TestGetQueryHistory_CrossesChunkBoundary
  • go test . + integration (UUID test passed against the demo DB), go vet clean
  • npm run build (tsc clean), 438/438 vitest passing

Closes #120

nkcoder added 2 commits July 2, 2026 07:57
- L1: ExecuteQuery formats [16]byte as UUID only when the column type OID
  is uuid (pgtype.UUIDOID), not for any 16-byte value
- L2: GetQueryHistory tail-reads the .jsonl backward in chunks for a
  positive limit instead of loading the whole file
- L4: remove dead Wails-template App.css (#logo/.input-box/.result) + import
- L5: centralize backend magic numbers (maxQueryRows, poolMaxConns,
  introspectTimeout, queryTimeout) and frontend resize clamps
- L6: centralize localStorage keys into STORAGE_KEYS
- L9: rewrite the 30s context-deadline error into a clearer message

L3/L7 verified only (already addressed by the docs pass); L8 deferred.

Closes #120
- Count only successfully-parsed entries toward `limit` so a corrupt
  trailing line no longer shrinks the result below `limit` while valid
  older entries remain (finding 1)
- Parse each chunk's newly-completed lines incrementally instead of
  re-splitting the whole accumulated buffer every chunk (finding 2)

Add TestGetQueryHistory_SkipsMalformedTail covering the regression.
@nkcoder nkcoder merged commit d2dd4d9 into main Jul 3, 2026
2 checks passed
@nkcoder nkcoder deleted the chore/120-batched-low-cleanups branch July 3, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minor cleanups (batched code-review Low findings L1–L9)

1 participant