test: cover session CLI and review row geometry#317
Conversation
Greptile SummaryThis PR adds test coverage for three areas: the Hunk session CLI HTTP request mapping and formatter output, CLI error formatting, and planned review row geometry calculations. The tests are new files only — no production code is modified.
Confidence Score: 5/5Test-only addition with no changes to production code; safe to merge. All three new test files accurately reflect the production implementations they cover. Fetch and env-var state is properly isolated between tests. The geometry assertions in plannedReviewRows.test.ts were manually verified against the measurePlannedSectionGeometry walk and match exactly. No production logic was modified. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[cli.test.ts] -->|mocks globalThis.fetch| B[HttpHunkSessionCliClient]
B -->|POST /session-api| C[Daemon request envelope]
B -->|GET /session-api/capabilities| D[readHunkSessionDaemonCapabilities]
C --> E{action}
E --> F[list / get / context / review]
E --> G[navigate / reload]
E --> H[comment-add / apply / list / rm / clear]
A -->|asserts exact request bodies| C
A -->|asserts formatted strings| I[Formatter functions]
M[errors.test.ts] -->|sets HUNK_DEBUG| N[formatCliError]
N --> O{error type}
O -->|HunkUserError| P[hunk: message + details]
O -->|Error + DEBUG=1| Q[full stack trace]
O -->|Error, no debug| R[hunk: message]
O -->|non-Error| S[hunk: String value]
T[plannedReviewRows.test.ts] --> V[measurePlannedSectionGeometry]
V --> W{row kind}
W -->|hunk-header, showHunkHeaders=false| X[height=0, anchor still set]
W -->|collapsed diff-row| Y[bodyHeight++, hunkBounds unchanged]
W -->|inline-note / note-guide-cap| Z[height>0, extends hunkBounds]
Reviews (1): Last reviewed commit: "test: cover session CLI and review row g..." | Re-trigger Greptile |
Summary
Tests
bun run format:checkbun run typecheckbun run lintbun test --coverage --coverage-reporter=lcov --reporter=dots ./src ./packages ./scripts ./test/cli ./test/sessionThis PR description was generated by Pi using OpenAI GPT-5 Codex