Repository navigation
fix(paste): keep default attachments out of Git status - #1830
Conversation
Files pasted or attached in the browser land in <pane cwd>/.ovis/, so every upload showed up as an untracked change in the project. The default folder now ignores itself: right after creating it, the server writes a .gitignore of "*" with an exclusive create (wx, mode 0600). An ignore file or link already there is never followed or replaced (only EEXIST is tolerated; any other create error fails the upload), and a folder named in OVIS_PASTE_DIR (after trim, ~ included, even one equal to the default path) gets no ignore file. Returned paths stay readable: ignored files still open by their explicit path. Checked with unit tests in server/paste.test.ts and server/file-view.test.ts, and contract tests for POST /api/pane/image in a temporary Git project (git status empty, git check-ignore names each path, bytes read back through /api/fs/file; concurrent uploads with a custom ignore file, file and dangling symlinks, overrides, and an unwritable folder).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merge pass review-work for b1c4194: REVIEW FAILED on one confinement case. Blocker: when Suggested fix: only write the ignore file into a Checked and passing:
Non-blocking test notes:
|
|
Fixed the blocker in a01d87e.
This is a behaviour change in |
|
Merge pass review-work report. Overall: PASSED.
The fix in a01d87e
Scope note: the gate suggested failing the upload outright. The fix skips only the ignore write. Attachments still go wherever a user-made All required checks are green and no review thread is open. CodeRabbit did not review this PR (rate-limited or skipped). The reviews above stand in for it. |
What this does for the user
Files pasted or attached in the browser are saved in
<pane cwd>/.ovis/so the agent can read them without a permission prompt. Until now every upload showed up as an untracked change in the project'sgit status.The default
.ovisfolder now ignores itself. Right after the server creates the folder, it writes a.gitignorecontaining*. The file is created exclusively (wx, mode0600), so:EEXISTis tolerated);OVIS_PASTE_DIR(trimmed,~expanded, even one equal to the default path) is the user's own and gets no ignore file.Ignored files still open by their explicit path, and the path the prompt names is unchanged.
Known trade-off, raised in review: Git-backed
@file completion lists files withgit ls-files --exclude-standard, so in a Git project a pasted file no longer appears there. Looking it up by path or bare name still works. Keeping pastes out of the project's Git view is the purpose of this change, so the PR keeps it.Why
This was a local-only branch (
fix/default-paste-gitignore) that was never pushed. It is rebased onto current main and ported to the.ovis/OVIS_PASTE_DIRnames from #1648. On main the paste route still only doesmkdirSync, so the bug still reproduces there.It does not overlap with #1795, which changes only Pi delivery and pending-message files and touches neither
server/paste.tsnor its tests.How it was verified
server/paste.test.tsandserver/file-view.test.ts: all 49 pass. They cover the self-ignoring default folder, the temp-dir fallback, an existing ignore file and file or dangling symlinks kept byte for byte, overrides (trimmed,~, equal to the default) getting no ignore file, and an unwritable folder reportingEACCES.POST /api/pane/imagecontract tests run on an isolated herdr session against a temporary Git project:git statusis empty after two concurrent uploads;git check-ignorenames each returned path, and the bytes read back through/api/fs/file;bun run check fastomo-native-code-reviewerfound no HIGH findings and recommended APPROVE (the MEDIUM finding is the completion trade-off above). Codex (gpt-6-astra) found nothing.No HTTP/WS contract, auth or workflow change.