refactor(session): canonicalize comment navigation - #896
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR moves comment-navigation canonicalization into the session broker and simplifies the application bridge to forward navigation inputs directly.
Confidence Score: 4/5The ambiguous navigation-target regression should be fixed before merging because direct session API requests can now silently navigate to a hunk instead of the requested line. The server accepts and forwards simultaneous hunk and line targets, and removing bridge canonicalization changes the effective target from the exact line to the hunk without rejecting the ambiguous request. Files Needing Attention: src/app/session/bridge.ts, src/session/broker/brokerServer.ts Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Session API client
participant Broker as Session broker
participant Bridge as Application bridge
participant UI as Terminal navigation
Client->>Broker: navigate selector and target
Broker->>Broker: Resolve comment ID or normalize fields
Broker->>Bridge: navigate_to_hunk
Bridge->>UI: Forward navigation input
UI-->>Bridge: Navigated selection
Bridge-->>Broker: Command result
Broker-->>Client: JSON result
Prompt To Fix All With AI### Issue 1
src/app/session/bridge.ts:100-101
**Exact line target loses precedence**
When a direct session API request contains both `hunkNumber` and exact `side`/`line` coordinates, the broker forwards both and this bridge now passes them through unchanged. `navigateToLocation` gives `hunkIndex` precedence, so the request silently selects the hunk instead of revealing the requested line.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "refactor(session): canonicalize comment ..." | Re-trigger Greptile |
859e353 to
8314aca
Compare
Context
Follow-up cleanup for #845, now merged. This branch is rebased directly onto
main.Problem
The comment-ID navigation path resolves both a hunk hint and exact line coordinates in the daemon, then relies on the terminal bridge to discard the hunk hint. That sends conflicting target information across a boundary and gives a generic bridge command feature-specific normalization behavior.
Approach
filePath+side+line, allowing the terminal to derive the containing hunk and reveal the exact row;This preserves separate CLI and daemon validation: the CLI owns user-facing errors, while the daemon continues to defend its wire boundary.
Validation
bun test src/app/cli.test.ts src/app/session/bridge.test.ts src/session/broker/brokerServer.helpers.test.ts— 173 passedbun test test/session/cli.test.ts -t "navigate works"— 1 passedbun run typecheckbun run lintbun run format:checkbun run check:docsbun run check:changelogbun run deps:checkThis PR description was generated by Pi using GPT-5.6 Sol