Repository navigation
feat(dashboard): create a folder from the project picker's Browse tab - #26007
alparamonov wants to merge 1 commit into
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the new owner-only create route reuses the listing's parent resolution, the sensitive-path floor and the pinned-parent write that Notes
[DESIGN-REVIEWED] 494bf73 Description read[DESCRIPTION-READ] 0e81ee853c8357f89ad01ef1a6ad30daadbb52b6669dca0cc9f421acc90aad5b That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS The four attachments show every control this PR adds: the New folder toggle, the name field, Create (both disabled and enabled), close, two refusals and the pane after a create. No blind read has run in this lane (fork); pushing the branch to the repository would run one. Notes
[UX-REVIEWED] 494bf73 Description read[DESCRIPTION-READ] 613d3be7d9cb462910271f15ab4bad84e7120b40fbc4c5870e83eaaca021c8aa That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The repo has no folder-create route or control today, and every server-side guard traces back to a boundary this codebase actually has. One response field has no reader. Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: let a person make a new folder from the project picker's Browse tab instead of running
[FIRST-PRINCIPLES-REVIEWED] 494bf73 Description read[DESCRIPTION-READ] 200410820bdf464f9b356350d997da850cf330230c25bc617c3307c035a7ec3b That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review (fork) — 🔴 changes requested (blocking)Reviewed Adjudication upheld 1 of 1 blocking finding(s); those must be resolved before merging. BLOCKING -- website/src/components/ProjectPicker.tsx:1037 -- Restore path-field focus when closing New folder
[BLOCK-MERGE] 494bf73 Adjudication (Opus 5.5) — is blocking on each finding proportionate?UPHOLD F1. Harm is LOW: a visible dismissal you can recover from. In the trigger's unchanged Folder Settings dialog no draft is lost. In base, the popover's keyboard handler ( |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
cf9ff1e to
54d5f67
Compare
|
Hold for human review: this adds a new owner-only route that creates directories on the gateway host, and the user's rules reserve new network routes for a person. Reviewed head: 54d5f67. I found no defect. The route checks the owner before reading the body ( ), refuses a sensitive parent ( ) and a sensitive new path ( ), and creates relative to a pinned parent descriptor ( ). CI is green and all AI lanes pass.One question for the human reviewer: AI findings judged non-blocking: Opus 5.5 Note (UTF-16 maxLength vs 255 UTF-8 bytes gives generic copy for a long CJK name; the server still refuses) and UX Notes (states missing from screenshots) are wording and evidence nits. — crew-pr-reviewer (r136) |
54d5f67 to
494bf73
Compare
494bf73 to
6fc063e
Compare
|
|
[operator: bolichen97] Continuing this in #31644; thanks for the start. |
The project picker's Browse tab can list the gateway host's folders and select one, but not make one, so starting a project in a new folder meant leaving the dashboard for a shell on the gateway host. Add a New folder control beside "Add ... to favorites". It opens a name field; Enter or Create makes the folder in the directory on screen and lists it, so Select makes it the project. Escape closes only the field, and a refusal is explained under it with the typed name kept. The server side is one owner-only route, POST /api/browse-dirs/create, that makes exactly one folder level. It refuses an existing name, a name with a slash, a protected location (the sensitive-path floor is checked on the new path before anything is created) and a parent it cannot write to, and audits each outcome. Builds on #26007 by @alparamonov. Closes #26005
The project picker's Browse tab can list the gateway host's folders and select one, but not make one, so starting a project in a new folder meant leaving the dashboard for a shell on the gateway host. Add a New folder control beside "Add ... to favorites". It opens a name field; Enter or Create makes the folder in the directory on screen and lists it, so Select makes it the project. Escape closes only the field, and a refusal is explained under it with the typed name kept. The server side is one owner-only route, POST /api/browse-dirs/create, that makes exactly one folder level. It refuses an existing name, a name with a slash, a protected location (the sensitive-path floor is checked on the new path before anything is created) and a parent it cannot write to, and audits each outcome. Builds on #26007 by @alparamonov. Closes #26005
The project picker's Browse tab can list the gateway host's folders and select one, but not make one, so starting a project in a new folder meant leaving the dashboard for a shell on the gateway host. Add a New folder control beside "Add ... to favorites". It opens a name field; Enter or Create makes the folder in the directory on screen and lists it, so Select makes it the project. Escape closes only the field, and a refusal is explained under it with the typed name kept. The server side is one owner-only route, POST /api/browse-dirs/create, that makes exactly one folder level. It refuses an existing name, a name with a slash, a protected location (the sensitive-path floor is checked on the new path before anything is created) and a parent it cannot write to, and audits each outcome. Builds on #26007 by @alparamonov. Closes #26005
The project picker's Browse tab can list the gateway host's folders and select one, but not make one, so starting a project in a new folder meant leaving the dashboard for a shell on the gateway host. Add a New folder control beside "Add ... to favorites". It opens a name field; Enter or Create makes the folder in the directory on screen and lists it, so Select makes it the project. Escape closes only the field, and a refusal is explained under it with the typed name kept. The server side is one owner-only route, POST /api/browse-dirs/create, that makes exactly one folder level. It refuses an existing name, a name with a slash, a protected location (the sensitive-path floor is checked on the new path before anything is created) and a parent it cannot write to, and audits each outcome. Builds on #26007 by @alparamonov. Closes #26005
The project picker's Browse tab can list the gateway host's folders and select one, but not make one, so starting a project in a new folder meant leaving the dashboard for a shell on the gateway host. Add a New folder control beside "Add ... to favorites". It opens a name field; Enter or Create makes the folder in the directory on screen and lists it, so Select makes it the project. Escape closes only the field, and a refusal is explained under it with the typed name kept. The server side is one owner-only route, POST /api/browse-dirs/create, that makes exactly one folder level. It refuses an existing name, a name with a slash, a protected location (the sensitive-path floor is checked on the new path before anything is created) and a parent it cannot write to, and audits each outcome. Builds on #26007 by @alparamonov. Closes #26005
The project picker's Browse tab can list the gateway host's folders and select one, but not make one, so starting a project in a new folder meant leaving the dashboard for a shell on the gateway host. Add a New folder control beside "Add ... to favorites". It opens a name field; Enter or Create makes the folder in the directory on screen and lists it, so Select makes it the project. Escape closes only the field, and a refusal is explained under it with the typed name kept. The server side is one owner-only route, POST /api/browse-dirs/create, that makes exactly one folder level. It refuses an existing name, a name with a slash, a protected location (the sensitive-path floor is checked on the new path before anything is created) and a parent it cannot write to, and audits each outcome. Builds on #26007 by @alparamonov. Closes #26005
Problem / Motivation
Goal: Let people make a new folder from the project picker's Browse tab, so starting a project in a folder that does not exist yet no longer needs a terminal.
The Browse tab lists the gateway host's folders and Selects one as the session's project, but it cannot make one. To start in a new folder, a user leaves the dashboard, runs
mkdirin a shell on the gateway host, comes back and browses to it.Why it matters
Starting a project in a new folder is a common first step, and today it costs a switch to a shell on the gateway host for a one-word action. On a remote gateway that shell is on a different machine from the user's own.
Not a goal
a/b/c) in one step, or creating a folder from a typed path that does not exist.What changed (motivation → approach → change)
The Browse tab gains a New folder control beside "Add ... to favorites". It opens a name field under that row. Enter or Create makes the folder inside the directory on screen, then the pane lists it with its path in the path field, so Select commits it as the project. Shift+Enter in the path field opens the same field: Tab closes the picker, so the toggle has no tab stop, and the toggle names the chord in its tooltip and
aria-keyshortcuts. Escape closes only the field. Moving to another folder closes the field at once, so a create that answers later cannot pull the pane back. A refusal is explained under the field, mapped from the server'scode, and the typed name stays.The server side is one owner-only route,
POST /api/browse-dirs/create, with body{parent, name}:{path, parent}owner_only, before the body is readnameis not one plain folder nameinvalid_nameparentempty, or not a directoryparent_required,not_a_directoryaccess_denied, before anything is createdalready_existsparent_changednot_found, 403permission_denied, 500create_failedThe route lives in
file_api/browse.pybeside the listings and is composed through thehandlers/files.pyfacade, which holds its name limits;routes/taskrunner.pyregisters it next to/api/browse-dirs.parentresolves the way the listing'spathdoes. The folder is made relative to the parent's pinned descriptor (pinned_fs.pin_parent), as/api/file-writereaches its target. A valid name is one component with no separator,.,.., control character (UnicodeCc) or surrounding whitespace, and at most 255 UTF-8 bytes; on Windows, its reserved characters and device names are refused too. The owner refusal, a protected parent, a busy probe pool and every create attempt are SEL-audited asbrowse_create_dir.The system spec (
learn-cron-dashboard.md) and the feature map describe the route and the control, the API client (api/client/files.ts) gainscreateBrowseDir, and the copy ships in every locale underwebsite/src/i18n.Backwards compatibility
Compatible: a new route and a new control; no existing route, response field or listing changes.
One keystroke changes meaning: Shift+Enter in the Browse path field drilled into the highlighted folder, the same as Enter, because the handler ignored Shift; it now opens New folder. Plain Enter still drills, and ⌘/Ctrl+Enter still commits.
Reader: website/src/components/ProjectPicker.tsx:ProjectPicker (Browse path field onKeyDown) -- chat -- the only handler of that keystroke; no test or other caller sends Shift+Enter to it on main
Tests
test/test_browse_create_dir.py: the route answers the new path with 201; a parent with a trailing separator resolves like a listing; an existing name is 409 and leaves it alone; the create runs on the probe pool, not the event loop; a platform that cannot pin creates by name; every invalid name, an empty or non-string field and a non-directory parent are refused with nothing created; a protected parent is refused and audited, and a protected new path is refused before it exists; a non-owner is refused before the body is read; a parent without write permission says so; a parent swapped for a link after the check is refused instead of followed. The name rules cover the UTF-8 byte limit, a lone surrogate, C0, DEL and C1 controls, and the Windows names, which apply only on Windows. The route is on the real route table.website/src/test/ProjectPicker.newFolder.test.tsx: create, then the new folder is listed ready to Select; Create stays disabled without a name; each refusal code gets its own copy, keeps the name and clears on the next edit; an uncoded failure takes the generic copy; Escape closes only the field; moving to another folder closes it; a create that answers after the field closed, or after the user drilled elsewhere, does not move the pane; Shift+Enter opens the field and plain Enter still drills; the favourite row keeps two controls.test/test_dashboard_files_composition_contract.pyandtest/test_json_object_body_guard.pycount the new route and record its body cap;website/src/test/ApiClient.refactor.surface.test.tsplacescreateBrowseDirin the client's method order.Proof: not provable -- other: prove.py reverts the new route and its helpers, which the test module imports, so the mutated run errors at collection; the two frontend tests for the late create and Shift+Enter fail on the component before those fixes and pass on the head.
Determinism (testing-conventions D12). The new cases read no clock, draw no random number and wait on no timer.
-n0pytest -n0 test/test_browse_create_dir.py(51 tests)-n 4beside neighbourspytest -n 4 test/test_browse_create_dir.py test/test_dashboard_files_composition_contract.py test/test_json_object_body_guard.py test/test_dashboard_files_onloop_fs.pyrandom.Random(seed)order at-n0, seeds 11-15vitest run src/test/ProjectPicker.newFolder.test.tsx src/test/ProjectPicker.test.tsx --no-file-parallelism(48 tests)vitest run src/test/ProjectPicker*.test.tsx --maxWorkers=4(11 files, 173 tests)vitest run src/test/ProjectPicker.newFolder.test.tsx --sequence.shuffle --sequence.seed=101..105(18 tests)Manual verification
Built from source on a fresh Ubuntu EC2 box with no inbound ports, then drove a throwaway test-mode gateway's dashboard in headless Chromium. 14 checks passed: create then Select; an existing name, a name with a slash, and
.awsin the home folder are each refused with their own copy; Escape closes only the field; the row and field fit a 390px-wide window. On disk afterwards the new folder exists and~/.awswas never created. That run used this branch before Shift+Enter, the close-at-navigation change and the wider control-character rule; those are covered by the unit tests above, not by this run.Screenshots / video
Browse tab with the name field open.
A name that already exists, explained under the field with the name kept.
The pane on the new folder after Create, ready to Select.
.awsin the home folder, refused as a protected location.Related Issues
Closes #26005
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)