Repository navigation
fix(files): find a file named without its folders under the pane's folder - #49
Merged
Merged
Conversation
…lder A relative path was only looked for right under the pane's folder, so a bare `demo-desktop.mp4` for docs/screenshots/demo-desktop.mp4 (as agents often write it) answered "No readable file". locateFile now falls back to the files under the folder whose path ends in the name: walked, not taken from git, so ignored files such as recordings count, within the mention inventory's bounds and a 5 s cache. One match opens; several answer 409 ambiguous_path with the candidates, which the viewer lists to choose from. The viewer then streams the absolute path it was given. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
devswha
force-pushed
the
fix/file-viewer-find-by-name
branch
from
September 26, 2026 06:39
c5dc39b to
0ef146b
Compare
devswha
added a commit
that referenced
this pull request
Nov 20, 2026
## One-press PC add (app and PC side), behind the step-2 switch **Add this PC to my account** adds the PC in one press when the account service admits it, with no other device typing digits. Any refusal (service or PC, an older Ovis included) leaves today's digit wait unchanged. Contract r2 agreed with the account lane and cleared by relay-hub (G1, G2) and security-triage; the service side is the account service's separate PR (#49 there). Note: the PC's own Settings signs in by device code today, which the service refuses for one press (`own_sign_in_required`), so until the PC page's own redirect sign-in lands (owned by another lane), a press from the PC's page falls back to the digit wait. Nothing visible changes before that. ### The four security conditions and where each is enforced here | Condition | Here | Tests | |---|---|---| | 1 fresh own sign-in, two_step_set === 1 (or the account's first PC) | service; the app presses the PC only after the service admits | `src/lib/account/addThisPc.test.ts`, `AccountSection.addThisPc.test.tsx` (refusal keeps the digit wait), `one-press.contract.test.ts` (first-PC exemption, used account refused) | | 2 notice on every other device, one-tap remove | `NewPcNotices` at the top of the opened Ovis (`App.tsx`), never on the relay overview; remove = `DELETE /v1/pcs/:id`; a PC bound in one press leaves its account on `403 not_listed` from the snapshot (never on 404) | `NewPcNotices.test.tsx`, `RelayShell.test.tsx` (overview: row marked, no card), `one-press.contract.test.ts` | | 3 24 h New mark, no automatic open | `new_until` from the directory: mark in the PC lists and sidebar; a new PC's own page waits for a press instead of opening by its account key | `shellAccountOpen.test.tsx`, `SidebarAccountPcs.test.tsx` | | 4 daily cap | service (`429 pc_add_cap`); the app falls back to digits | `addThisPc.test.ts` | | first PC told later | `admitted_before_you` rows: the card shows once to a device that joined after an exempt first-PC add | `NewPcNotices.test.tsx` | ### PC route: `POST /api/account/one-press` `{ account }` - Owner here only: a relay device gets `owner_only`, a watching one `read_only`, an open LAN window or Portal visitor `owner_only`. - The account must equal the PC's named relay-account (`409 account_mismatch`), which the page sets from its own stored sign-in just before; the PC must be in no account (`409 in_account`). - The PC asks `POST /v1/pc/admission` with its relay-key proof, naming that account (another account's admission is invisible); an answer for another account binds nothing (`502 account_mismatch`). - Binds `account-pc.json` with the mark `service: true` (`bindByService`; refused in the store too when already in an account), then reads the snapshot so the account's devices are let in by the step-2 path. - On HTTP 403 with code `not_listed` from `/v1/pc/snapshot`, a `service: true` binding is cleared with the new reason `unlisted`; its account rows end with the existing DropReason `remove` (no new row state). A 404 never clears it. - With `OVIS_ACCOUNT_OPENS_ALL` off the route answers 404. ### Exported functions and their production callers | Export | Caller | |---|---| | `addInOnePress` (src/lib/account/addThisPc.ts:215) | src/components/AccountSection.tsx:519 | | `AccountService.admitPc` (src/lib/account/service.ts) | src/lib/account/addThisPc.ts:218 | | `DeviceStore.bindByService` (server/devices.ts) | server/account/routes.ts:88 | | `DeviceStore.boundByService` (server/devices.ts:1264) | server/account/mailbox.ts:288 | | `PcAccountState.bindByService` (server/account/pc-binding.ts) | server/devices.ts:1260 | | `AccountMailbox.admission` (server/account/mailbox.ts) | server/account/routes.ts:83 | | `AccountServiceRefusal` (server/account/mailbox.ts) | server/account/mailbox.ts (unbind check, 404 of the admission, every refused PC route) | | `NewPcNotices` (src/components/NewPcNotices.tsx) | src/App.tsx:1140 | | `isNewAccountPc` (src/lib/account/myPcs.ts:23) | src/lib/relay/shell.tsx:763, src/lib/account/myPcs.ts:28 | | `PC_NEW_MS`, `PC_ADMITS_PER_DAY`, `registerSessionKey` (shared/account-service-fake.ts) | test fake only | ### Design reference The new-PC notice follows the existing S2-31 device notice and Not me card (DevicePairedNotice) and the linked-devices "a new device was added" pattern of WhatsApp and Signal: told on every other device, with the removal one tap away. Korean captures (light, phone 390 and PC 1280) were shown to the lead and the owner before the new sentences shipped. ### Validation - `bun test server/account/ src/lib/account/ src/lib/relay/ src/components/AccountSection.addThisPc.test.tsx src/components/AccountSection.signInAddsPc.test.tsx src/components/NewPcNotices.test.tsx src/components/RelayShell.test.tsx src/components/SidebarAccountPcs.test.tsx shared/account-service-fake.test.ts server/dispatch.test.ts src/conventions.test.ts`: 1952 pass, 1 fail (`server/account/catch-up-staleness.contract.test.ts` T56, a timing test this PR does not touch; it passes 6/6 alone, a load flake). - `bun run typecheck`: clean. - `bun run check fast` on the remote heavy host: typecheck, build and every unit file passed except `server/shell-agent.test.ts` (a 300 ms shell timeout under load; 26/26 alone, untouched here). The last run before the final rebase; CI runs the full set. - Skipped: browser regressions in the CI image (the relay dashboard's markup changed only by an added mark). ### Owner's overview rule Nothing new appears on the relay overview (app.ovis.sh/#overview and its PC table, map and details): no notice card and no New mark there. A new PC there only loses its quick **Open** (a safety removal, not something shown). The notice lives at the top of the opened Ovis, and the New mark in the PC's own Ovis (its sidebar and the Add a connection list). ### Every place that picks a PC without a tap, and its guard | Place | Guard | |---|---| | Launch: "the PC this device opened last", else the first saved one (`launchPc`, src/lib/relay/shell.tsx) | Only saved pairings, never one an account introduction alone saved (`introduced_at`); a hand open clears `introduced_at` (`enterApp`) so it may be reopened later. An account open is an in-memory overlay (`withAccountDevice`) that never makes a saved pairing | | A sign-in's return continuing the launch | The same `launchPc` | | A PC's own page reached through the account (scoped account open) | Waits for a press while `new_until` is in the future | | Overview quick Open | Hidden for a PC with `new_until` in the future | | Sidebar / overview default selection | None exists: the relay front page draws a list and selects nothing; the Ovis sidebar lists the account's PCs and opens one only on a tap | | Notification or deep link | Opens the PC the notification or link names, on the person's tap; no default PC | | Update flow | Updates the PC whose Update was pressed; no default PC | ### Merge note Owner-approved (via the lead): `POST /api/account/one-press`, owner-only, this PC's own window only, binds only on a service-proven admission for the account named here, is the one-button PC add.
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.
Summary
Clicking
demo-desktop.mp4in a chat answer said "No readable file at this path." The file isdocs/screenshots/demo-desktop.mp4, and a relative path was only looked for right under the pane's folder. Agents often name a file without its folders.Fix.
locateFile(server/file-view.ts) first tries the path as written. For a relative path that isn't there, it falls back to the files under the pane's folder whose path ends in that name (filesNamedinserver/files.ts):@-mention inventory comes fromgit ls-files, which leaves out ignored files such as recordings and build output, and these MP4s are git-ignored. The walk uses the same bounds (depth 6, 5,000 entries, the usual skipped folders) and a 5 s cache.409 ambiguous_pathwith the candidates. The viewer lists them, and you pick one.~and../paths are taken as written, never searched for.After opening, the viewer streams from the absolute path it was given. Open in new tab and Download work for the found file as well.
Testing
demo.mp4findsdocs/screenshots/demo.mp4, and so doesscreenshots/demo.mp4.notes.mdin two folders yields both candidates. A missing name, and an absolute path elsewhere, stay not found.demo.mp4opened…/docs/demo.mp4and playednotes.mdlisted two files, and choosing the second showed# B notesdocs/screenshots/demo-desktop.mp4resolves, and the baredemo-desktop.mp4doesn't. This PR fixes the second.bun run typecheckpasses,bun testpasses 351/351, andbun run test:uipasses 8/8.🤖 Generated with Claude Code