Repository navigation
Extract diff selection and the HTTP app from the CLI - #122
Merged
david-crespo merged 3 commits intoNov 19, 2026
Merged
Conversation
Base automatically changed from
spr/refuse-api-paths-that-arent-in-the-diff
to
main
November 19, 2026 18:19
david-crespo
force-pushed
the
spr/extract-diff-selection-and-the-http-app-from-the-cli
branch
from
November 19, 2026 18:20
be41f43 to
a484a53
Compare
david-crespo
deleted the
spr/extract-diff-selection-and-the-http-app-from-the-cli
branch
November 19, 2026 18:43
david-crespo
added a commit
that referenced
this pull request
Nov 19, 2026
Built on #122, this PR lets one process serve diffs from more than one repository. `jj` and `git` invocations, working-copy reads, and comment writes now take the repository directory as an argument. The static file middleware also receives an absolute path to the web files' directory, so nothing depends on the process's working directory. The CLI passes `process.cwd()`, so its behavior is the same. The directory is fixed when an app is built and each app has its own token, so a request can't choose a directory or reach another app's repository, and #121 keeps its file paths to the files in the diff. A new test builds two apps for separate repositories in one process and checks that each returns its own diff and file contents. About 160 of the 220 changed lines are tests: that test, and new unit tests for `buildDiffSource` and `detectVcs` in a directory other than the process's working directory. The source change is about 55 lines that add the directory argument.
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.
Built on #121, this is the first of three PRs that let another Node server mount
@oxide/skepsisreview pages.buildDiffSourceturns the range flags (-r,-f,-t,--interdiff) into the diff command to run. It used to read the parsed flags from a top-level variable incli.tsand callprocess.exiton a bad combination, such as--interdiffwith-r. It now takes the flags as an argument and throws on bad ones, and the CLI catches the error and prints it and exits 1 as before.buildAppbuilds the routes and returns thefetchhandler and the per-run token without binding a port, so the calling app can do what it wants with them. CLI behavior is unchanged.Most of the diff is code moving without modification. The first commit has the changes to
buildDiffSource. The second moves it fromcli.tstoserver/diffSource.ts, and the third moves the routes fromserver/main.tstoserver/app.ts. Of the roughly 390 non-blank lines those two commits remove, about 375 reappear unchanged. Apart from imports, the license headers of the two new files, and the tests described below, these are the lines in those two commits that are not straight moves:The second commit also changes tests. Three tests in
cli.test.tsran the CLI with a bad--interdiffcombination and checked for exit code 1 and the message on stderr. They are now unit tests inserver/diffSource.test.tsthat checkbuildDiffSourcethrows the same messages, plus a fourth test checking that an interdiff's diff source has no endpoints. No test checks the CLI's exit code and stderr for these combinations anymore.