cx-ncc.85: pass git diff paths and context_lines through the App

Merged
TE
25d ago
+117-8

Part of cx-ncc.85 (Claude parity): Show more lines in the changes view, step 2 of 3. This is the App's pass-through.

To show more lines, the page asks for one file's patch with enough unchanged lines to hold the whole file:

  • git.diff or git.checkpoint.diff, with paths and context_lines.
  • Session-host support is in #(Rust PR, linked below).
  • This PR makes the App decode both and pass them to the session host as they came in.

A path that isn't relative to the repository, or that leaves it, is refused, never dropped: dropping it would turn the request into a different read. The same goes for a count outside 0 to 1,000,000, a non-number or a non-list.

Without either field, the request is exactly the read it always was.

  • AgentPaneGitDiffOptions: the decoded paths and context_lines, carried on .diff and .checkpointDiff (default: none).
  • AgentPaneGitReads: merges them into the session host's params.

Remote relay: this changes no relay policy. git.diff and git.checkpoint.diff were already read-only reads of the session's repository. The new fields only narrow the files read, or widen the unchanged context of files the read already returns. Paths stay inside the repository; this PR checks that and so does the session host (pathspecs). Nothing executes, nothing outside the session's repository is reached, and the read returns no new kinds of local state.

Verification

Behavior test: AgentPaneGitDiffContextTests, covering page params through to session-host params. Hosted PR CI skips Swift tests, so both runs were fleet scripts/ci/run-swift-testing-suites.sh Packages/macOS/CmuxNext.

  • Red, on a temporary probe (the test at d092a883c8cb plus a compile shim, no decoder change): FAIL ^CmuxNextAppTests.AgentPaneGitDiffContextTests/. For example, diff(["paths": ["../secret"]]) came back as an unscoped .diff(...) instead of being refused, and context_lines was ignored.
  • Green at 820f01fcf4d4: PASS ^CmuxNextAppTests.AgentPaneGitDiffContextTests/, 3 of 3 tests.
  • CloudMoveTests fails in both runs. It is a base red, not touched here.
  • Session-host side: #19732.

Changelog

none

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Passes paths and context_lines through the App to the session host for git.diff and git.checkpoint.diff reads, so the changes view can ask for one file's patch with enough unchanged context to hold the whole file (cx-ncc.85, step 2 of 3).

  • Decodes both fields and refuses a path that isn't relative to the repository or that leaves it, and a context count outside 0 to 1,000,000, rather than dropping them, since dropping would turn the request into a different read.
  • Requests without either field are unchanged.
  • Adds behavior tests covering page params through to session-host params.