Repository navigation
Open, edit and preview checkout files in the web shell - #139
Merged
Merged
Conversation
hided now holds the registered checkout roots and resolves every path event against them before it reaches the core: a path outside every root is refused with outside_checkout, an explorer operation whose root does not match the focused checkout is refused the same way, and an item name that could escape its parent is refused as invalid_path. Attachment paths are bounded to eight files and 4096 bytes each. The roots are refreshed from the core snapshot on a 250 ms timer and seeded before the server accepts its first client.
The Explorer needs the contents of one folder inside a registered checkout, which the registration line cannot answer: remote_file_list lists a target's checkout as directories only and hides dotted names, while a folder view shows files, keeps hidden entries and drops .git alone. A new client event file_list carries the root and the folder, and is answered with the same directory_list frame, which now names the asking event in a required kind field so a client routes one answer to the registration input and the other to the folder it is showing. Rows follow the Swift rule: directories first, then a case-insensitive comparison in which a run of digits compares by value, so file2.txt precedes File10.txt. No crate was added for it, the comparator lives beside the listing in hided/src/boundary.rs. Entry gained is_directory, so the shared listing shape always carries the kind of row, and the home line answers true for every entry it lists. A folder outside every registered root, a root that is not registered, and a symlink that leaves its root are refused as outside_checkout before anything is read. The web store keeps the Explorer's folders in a listings map keyed by the root path and capped at LISTING_CAP, and leaves directoryList to the registration flow. The checkout roots are refreshed from the core change notification the daemon already consumes for snapshot deltas, not from a timer: the roots change exactly when a snapshot can change, and the seed before the first client is unchanged.
The Explorer draws one checkout folder at a time and a large folder can hold thousands of rows, so the row list is virtualized rather than rendered whole.
The Seti glyph accents were 21 hex literals inside SetiFileIcon.swift, so the
web shell could not render the same colours as the Swift outline. Move the five
accents into HideTheme as fileIcon{Blue,Green,Orange,Yellow,Purple}Hex, claim
them in design/tokens.json and scripts/pen-token-map.json, and regenerate
web/src/tokens.css and design/hide-ui.lib.pen from that authority.
The glyph table keeps its codepoints and only reads its colour from the token,
so SetiFileIconTests.swift counts the same set as before.
The Explorer rows draw their glyph from the same Seti subset the macOS shell bundles, so the web shell serves those bytes from /assets with a font/woff content type and declares the face with font-display: block. The glyphs are private-use codepoints, so a fallback face would draw tofu for every row until the font landed.
The Explorer needs its rows as data before any view draws them. fileIcons.ts ports the Seti catalog onto the seven file colour tokens, and explorer.ts turns a folder listing plus the git decorations into the flat row list a virtual list can draw, carrying the git letter, its title, the riskiest descendant behind a folder dot, and the tooltip and accessibility strings. snapshot.ts and store.ts learn the editor and changes sections the core already sends, so decorations and open file tabs have somewhere to land; the merge runs before the frame routing, which answers a listing or a refusal with an early return. Ten tests cover entry order as the daemon sent it, indent from expanded_paths, a closed folder that keeps its listing, an expanded folder with no listing, the letter and title, folder risk priority, no decoration under an unrelated folder, the tooltip text, and the root-relative path.
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.
Related: PRD
agents/prd/web-shell-pivot-s3/prd.md· follows #132 (S2)Summary
$HOME, and nothing in the browser could read, edit, or save a file in a checkout.hidednow checks every Explorer path against the registered checkout roots by real path, refusing anything that resolves outside one (including through a symlink) with a reason code, and serves directory listings, a gitignore-aware file index, folder watches, file bytes, and attachment staging behind that one line.herdr-coreis unchanged.Review
hidedmoves from "list directories under$HOME" to "read and write any path under a registered checkout". Everything else follows from accepting that line.hided/src/boundary.rs- the security line itself: real-path resolution, symlink escape, and the refusal codes a client can read.hided/src/attachments.rs- the staging state machine; seven review rounds found a defect here each time, the last being release-on-disconnect and a cap charged to non-growing writes.hided/src/server.rs- the frames that now carry file bytes and attachment chunks over the same socket as snapshot deltas.hided/src/watch.rsandhided/src/index.rs- resident resources with caps (64 watched folders, 50,000 indexed files) that must report rather than degrade.web/src/store.ts- the snapshot merge the Explorer and editor read from, on the high-frequency path.Evidence
verify-cargo.sh test,verify-swift.sh test,verify-cargo.sh lint, all exit 0); 122 web unit tests; the full Playwright suite, 14 specs, each against an isolated pinned Herdr with a private HOME; hided 76 unit and 19 integration tests covering boundary escape (.., symlink, prefix sibling, unregistered root), staging lifecycle and byte caps; design-contract, workstation-identity and attribution checks. Terminal echo p95 median 0.89 ms against the Swift baseline 6.23 ms, 0 of 14,410 frames over the 16.7 ms budget.pr.ymlCI runs from the pushed head for the first time here.design/hide.penanddesign/tokens.jsoncarry generated diffs fromgen-pen.mjsandgen-tokens.mjs; the Seti subset font underweb/publicis a binary asset.AI tooling: mostly AI tooling; the boundary module, the attachment state machine and every screenshot above were read by hand against the diff.
Verification record
agents/prd/web-shell-pivot-s3/prd.md(sha256 1823074e2df972857ae9dcbc1ff0eb1150d58c4ec71e7a7a6fae00bcf5353103)agents/runs/web-shell-pivot-s3/verification-report.jsonandagents/runs/web-shell-pivot-s3/verification-report.md; source fingerprint 2b0044dfb1283206a4f6e72a55215e53a8269d2cb4b6fe0f8ba9e44f24c18c0fbash scripts/verify-cargo.sh test(exit 0)bash scripts/verify-swift.sh test(exit 0)bash scripts/verify-cargo.sh lint(exit 0)request_idjoined into a path unsanitized (arbitrary write as the daemon user);file_bytesspun forever on a file that shrank mid-read; the root refresh read"rest": nullas present and wiped the boundary roots; a refused byte read never settled the viewer; the Markdown checkbox toggle was not reported as an edit. All fixed in c623c8a with tests.terminal_attachment*still forwarded (arbitrary absolute-path read); aLaggednotify read as shutdown; staged attachments bounded by count rather than bytes; attachment caps checked afterarrayBuffer(); unboundedfolderChanges. All fixed in 19e3412 with tests.clipboard: false;make_roomcould evict the stage being written. Fixed in d2acdcb.write_allleft the stage open with uncounted bytes on disk; staged files created with the inherited umask (0644/0755); a batch could name the same stage twice; clipboard stage ids unvalidated. Fixed in 9430412.pnpm --dir web typecheck,lint,test(122),build; the full Playwright suite 14 passed (s2 2, s3 9, shell 3), each fixture starting an isolated pinned Herdr withSHELL=/bin/zshbeside a private HOME;node scripts/check-design-contract.mjs;bash scripts/check-no-workstation-identity.sh;python3 scripts/check-no-attribution.py; hided 76 unit + 19 integration tests.