(panel): read-only Changes view from git status, same for local and remote sessions - #280
Merged
Merged
Conversation
…emote sessions Closes #251. A pure parser for porcelain v2 + numstat, one runner interface with a local execFile and a remote ssh implementation (every token single-quoted, no backtick), two IPCs resolving the session's real cwd (recorded cwd locally, descriptor cwd remotely), and a Changes mode in the right-hand panel: files changed with counters, branch and ahead/behind, click for a read-only diff. Refresh on open, on the button and when the session goes idle — no polling.
…out cap, id validation Review follow-up. Every git invocation runs with --literal-pathspecs and a leading ':' is refused, so a file name cannot carry pathspec magic; status and numstat are read with -z, so a non-ASCII or spaced name round-trips to git diff unescaped; the ssh transport caps stdout in bytes and kills the child on overflow; sessionId is shape-checked before any lookup; the idle refresh fires on a busy-to-idle edge only; the diff cap is measured in bytes on a line boundary; the local runner drops inherited GIT_DIR-style variables so only the session's cwd decides the repository. A real-git test pins that an absolute pathspec outside the repo yields nothing.
Owner
Author
|
Adversarial review (reproduced against a real
Found while committing: the real-git test, run by the pre-commit hook, inherited
|
This was referenced Sep 12, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #251. Context note:
.ai/contexts/changes-view.md; user doc:docs/changes-view.md.What
git-changes.js(pure, dual-loadable):parseStatusPorcelainV2,parseNumstat(binary → null, both rename spellings),mergeChanges→ panel model with per-file staged/unstaged/untracked/renamed flags, counters and totals.git-changes-runner.js:createGitChangesRunner({ kind, cwd, alias?, exec })with.status()(status --porcelain=v2 --branch,diff --numstat,diff --cached --numstat) and.diff(path, { staged })(bounded 512 KB, truncated flag). Local:execFile('git', args, { cwd }), no shell. Remote:git -C '<cwd>' '<arg>'…overbuildRemoteCommandArgs— every token POSIX single-quoted, NUL/newline refused,..refused in paths, no backtick emitted for any input (tested with adversarial cwd/path). Timeouts 10 s / 20 s.git-changes-target.js: cwd resolution — live local session's own cwd, else the sameresolveSessionRealCwdscan resume/fork uses; remote from the host's descriptor list, no PTY needed.main.js/preload.js:git-changes-status(sessionId),git-changes-diff(sessionId, path, staged);{ ok:false, error }on any failure.public/file-panel.js: achangestab type in the existing right-hand panel — header "N files changed +a −b", branch with ahead/behind, one row per file (state, path, counters), click → read-only diff rendered line by line (no diff language bundled in CodeMirror), Refresh button; entry from the terminal header.public/session-activity.js:onSessionIdle(cb)fired once persetActivity(id, false, …); the panel refreshes on open, on the button and on idle of its session — no timer anywhere.Proof
-as 0 → red. Runner mutations: dropping the..guard → red; breaking the quote escape → red.gitChangesStatuscall while busy, on duplicate idle, or without a Changes tab.task check: 1376 + 120 pass, 0 fail, pre-existing skips.Not exercised: the real ssh transport (fakes only, by rule); the panel in the running app.