Repository navigation
fix(file): report status paths from the project directory - #769
Merged
Ishaan Gangwani (ishaan1124) merged 1 commit intoSep 28, 2026
Conversation
ANIRUDDHA ADAK (aniruddhaadak80)
requested review from
Aayam Bansal (aayambansal) and
Ishaan Gangwani (ishaan1124)
as code owners
September 27, 2026 21:15
|
ANIRUDDHA ADAK (@aniruddhaadak80) is attempting to deploy a commit to the InkVell Team on Vercel. A member of the Team first needs to authorize it. |
Both git diff calls printed repository-root-relative paths and the result was re-relativized with path.relative, which resolves a relative path against the process working directory, so a subdirectory project got a chain of `..` that resolved to no file. Ask git for the paths relative to the project instead, which also stops changes outside the project being listed as its own.
Ishaan Gangwani (ishaan1124)
force-pushed
the
fix/file-status-relative-paths
branch
from
September 28, 2026 05:12
8d067cc to
76bed2d
Compare
3 of 8 tasks
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.
What does this PR do, and why?
When OpenScience works in a subdirectory of a repository, the file status it
reports cannot be opened. Two things combine:
path.relative(from, to)resolves a relativetoagainstprocess.cwd(), notagainst
from. Nothing in the codebase callsprocess.chdir, so the server'sworking directory is fixed at launch while
Instance.directoryis whateverproject the client selected.
Reproduced on
3e94875cwith a repository whosepkg/is the project and achange to
pkg/tracked.txt, the response contained:The same response also listed changes made outside the project, because both
git diffcalls were repo-wide.The fix asks git for paths relative to the project — the same form
ls-files --othersalready returned — and drops the remap that corrupted it:--relativealso scopes both diffs to the project directory, which is whyoutside.txtis no longer reported as one of its changes.Linked issue
Fixes #768
How did you verify it?
backend/cli/test/file/status-paths.test.tsbuilds a real repository, commitspkg/tracked.txt,pkg/removed.txtandoutside.txt, then works inpkg/andchanges all three. It asserts that every reported path is relative and free of
..segments, that each of the three files is reported under itsproject-relative name with the right status, and that the change outside the
project is not listed.
On unmodified
3e94875cit fails on the..check:Commands run:
bun test --timeout 30000 ./test/file/status-paths.test.ts→ 1 passbun run --cwd backend/cli typecheck→ exit 0I checked the two consumers of
File.status()before changing its contract:cli/cmd/debug/file.tswrites the result as JSON, andserver/routes/file.tsreturns it from
GET /file/status. Neither re-roots the paths or expectsrepository-relative ones, so nothing depended on the old shape. The CLI
bootstraps with
process.cwd(), so for it the project directory is the workingdirectory and
--relativereturns exactly what it returned before.Two things I deliberately did not change, both pre-existing and visible in
the reproduction above:
modified, becausegit diff --numstatincludes deletions. The test asserts
toContain("deleted")for that pathrather than pretending the duplicate is not there.
core.quotepath) is not unquoted here.That is unchanged behaviour and out of scope.
Pre-existing reds on this Windows checkout, not from this diff:
bun run format:checkcannot pass here: git materializes the LF blobs as CRLF,so Prettier flags hundreds of untouched files. I verified all three changed
files are formatted per the repo config with line endings normalized.
bun run typecheck: backend is clean;@synsci/workspacefails becausefrontend/workspace/src/custom-elements.d.tsis a symlink (mode120000) thatWindows checked out as a text file, which TypeScript then parses as source →
TS1128.Checklist
bun run checkis green (format, typecheck, backend + frontend/ui + SDK tests) — blocked on this Windows checkout by the CRLF and symlink artifacts described above; backend typecheck is clean and the new test is greenbun run --cwd frontend/workspace buildsucceeds if I touchedfrontend/workspaceorfrontend/ui— not touched./tooling/repo/generate.tswas run and thetooling/sdkoutput committed if I changedbackend/cli/src/server— not touchedfrontend/docs/src/content/openscience/is updated if behavior changed — no doc change needed: the status was always meant to be project-relative, and the Files/Changes pane resolves these paths from the projectpackage.jsonversions and tags are written by the release workflow)installandfrontend/landing/public/installare still byte-identical if I touched either — not touched