Repository navigation
feat: create a folder from the project picker's browse tab - #31644
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the new route is owner-only, checks the sensitive-path floor, and pins its parent for the create. The Tab change is stated as deliberate. Notes
[DESIGN-REVIEWED] a0043e0 Description read[DESCRIPTION-READ] 2f324b6a3c226e04761de44f4bac36de526298d7319a6cd0342bd2eaf01942eb 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The one part that reaches beyond the Goal, Tab cycling through the whole Browse pane, is declared and can be undone. Its only support is a review ruling the description mentions but does not link. Notes
What this change shipsInventory (7 items) — 6 justifiedIntent: let a person make a new folder from the project picker's Browse tab instead of running
[FIRST-PRINCIPLES-REVIEWED] a0043e0 Description read[DESCRIPTION-READ] 79d9d7c03fe201e18effa27b1dc1ac786abb693a9d7d69c5de4b87e213749fff That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: the blind reader correctly identified New folder, the name field and Create, and said they would use them. The issues below are copy and state notes. Notes
[UX-REVIEWED] a0043e0 Description read[DESCRIPTION-READ] 8ae35f7618422a5aa589e93f66c4a7f8d07d7ccbd7d993d6cbf31a89f1275483 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
d25c782 to
b7a18c1
Compare
[operator: bolichen97] |
b7a18c1 to
4c96efc
Compare
|
Rebased: main moved in docs/feature-map/README.md, docs/system-specs/modules/learn-cron-dashboard.md, src/kiro_crew/dashboard/handlers/init.py, website/src/i18n/locales/*.json and website/src/test/ApiClient.refactor.surface.test.ts since this head went green (d18b76e -> 464b547); CI re-running. [operator: bolichen97] |
4c96efc to
6b841dd
Compare
|
self-added: yes
[operator: bolichen97] |
|
Rebased: main moved in docs/feature-map/README.md, docs/system-specs/modules/learn-cron-dashboard.md, src/kiro_crew/dashboard/handlers/init.py, src/kiro_crew/dashboard/handlers/files.py, test/test_json_object_body_guard.py and website/src/i18n/locales/*.json since this head went green (464b547 -> e30915e); CI re-running. [operator: bolichen97] |
6b841dd to
c6419ec
Compare
|
self-added: no
[operator: bolichen97] |
|
[operator: bolichen97] Backend Tests shard 2 (Linux and Windows) and the Coverage Gate that depends on them fail on |
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
c6419ec to
a0043e0
Compare
|
[operator: bolichen97] Rebased onto d27a5fd, which already raises the security package line budget, so the shard 2 failure in |
buluoray
left a comment
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
APPROVE
What it does for users: the project picker's Browse tab gets a New folder button. Typing a name and pressing Enter or Create makes one folder in the directory on screen and moves the pane into it, ready to Select. Starting a project in a new folder no longer needs a shell on the gateway host. On Browse, Tab now moves through the picker's own controls instead of closing it, which was a maintainer ruling.
Security review of the new write route (POST /api/browse-dirs/create), checked against source at this head:
- Owner-only, checked before the body is read: src/kiro_crew/dashboard/file_api/browse.py:238. This is the same gate as /api/file-write, and the listing it sits beside is owner-only too, per the spec's owner-only routes paragraph.
- The new folder cannot leave the chosen parent. The handler refuses an empty name, ".", "..", "/" and "\" (browse.py:251). The sync body then builds the target with abspath and requires its dirname to equal the realpath'd parent (browse.py:178). That covers a Windows drive-qualified "C:x" and the trailing dot or space Windows strips.
- The new path cannot reach a sensitive location. The target meets is_sensitive_canonical_path before any mkdir (browse.py:180). The call runs on the probe pool, so it takes the inline pre-resolved gate. That gate case-folds and matches descendants, so a protected parent (anything inside .ssh) is refused as well as a protected leaf (.aws, .netrc).
- The checked parent cannot be swapped between the check and the create. On POSIX, mkdir runs relative to a descriptor that pin_parent walks with O_NOFOLLOW (browse.py:185). On Windows, a no-delete-share handle is held and its final path is compared with the parent. A platform with neither answers create_failed rather than doing a by-name mkdir (browse.py:198).
- Every outcome is SEL-audited as browse_create_dir. Nothing existing is loosened: no current route, fence or listing changes.
Evidence:
- Tests run locally at this head: test_browse_create_dir.py, test_browse_dirs.py, test_dashboard_files_composition_contract.py and test_json_object_body_guard.py gave 150 passed, 2 skipped. The Windows-only cases skip on Linux. The four touched frontend files (ProjectPicker.newFolder, ProjectPicker.keyboardIsolation, ProjectPicker.footer, ApiClient.refactor.surface) gave 221 passed.
- Mutations, run one at a time with the tree clean after each:
- Removing the sensitive-path check reddens test_a_protected_new_path_is_refused_before_it_exists, test_a_folder_inside_a_protected_directory_is_refused and test_a_parent_swapped_for_a_link_after_the_check_creates_nothing.
- Replacing the pinned create with a by-name os.mkdir(target) reddens test_a_parent_swapped_for_a_link_after_the_check_creates_nothing.
- Removing the owner check reddens test_a_non_owner_is_refused_before_the_body_is_read.
- Frontend: dropping the close-on-navigate in browse() (ProjectPicker.tsx:339) reddens "does not pull the pane back when a create answers after the user moved to another folder" and "creates the folder in the directory on screen, then lists it ready to Select".
- New copy: 11 keys in each of the 13 locales.
- CI at this head: 83 success, 11 skipped, 0 failing. PR Readiness and both CodeBuild jobs (Linux, Windows) are green. The Design, First Principles, UX, Opus and GPT review lanes all pass. No inline threads.
- git merge-tree against current main exits 0.
Source-only, not run here: the Windows pin and the drive-qualified-name case. Both have Windows-only tests that the Windows CI job ran green.
Non-blocking follow-ups:
- The invalid_name copy tells the user to avoid "slashes or special characters". The route only refuses slashes, ".", "..", a NUL and names the filesystem rejects, such as an overlong name. Most special characters are accepted, and the copy does not mention length. Naming what is actually refused would be more accurate.
- parent_changed has no copy of its own and shows the generic "Couldn't create ... Try again." That is acceptable for a race outcome. It is noted here only so the choice is on record.
- Like /api/browse-dirs, the create route is not behind the remote-chat guard that /api/file-write uses, so it always acts on the gateway host. That matches the listing the picker shows, so it is not a defect. If the picker ever lists a remote session's filesystem, this route needs the same guard.
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.Builds on #26007 by @alparamonov.
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)
Starting a project in a folder that does not exist yet needed a shell on the gateway host, so the picker now makes the folder itself. The Browse tab gets a New folder button beside "Add ... to favorites" (
components/ProjectPickerNewFolder.tsx, mounted bycomponents/ProjectPicker.tsx). It opens a name field. Enter or Create makes the folder in the directory on screen and moves the pane into it, so Select makes it the project. Escape closes only the field. On Browse, Tab now moves through the whole picker, from the path field to Add ... to favorites, New folder and the row a caller adds below the panes (the AWS profile choices), instead of closing the picker or dropping into a dialog under it; Enter or Space presses them and Escape still closes the picker (components/ProjectPicker.tsx). A refused name is explained under the field and the typed name stays.The server side is one owner-only route,
POST /api/browse-dirs/create, body{parent, name}, registered next to/api/browse-dirsand living with the listings infile_api/browse.py. It makes exactly one folder level and answers each case the issue names:{path}owner_only, before the body is readnameempty,.,.., has/or\, would land outsideparent(a WindowsC:x), or is refused by the filesysteminvalid_nameparentmissingparent_required~/.aws, or anything inside~/.ssh)access_denied, nothing createdparent_changed, nothing createdalready_existsnot_found, 403permission_denied, 500create_failedThe protected-location check is the same sensitive-path floor the listing uses, run on the new path before
mkdir. The checked parent is then pinned for themkdir(a descriptor walked withO_NOFOLLOWon POSIX, a no-rename handle on Windows), the way uploads pin theirs, so a swapped ancestor cannot redirect the folder. The create runs on the path-probe pool like the listing, and each outcome is SEL-audited asbrowse_create_dir. The API client (api/client/files.ts) gainscreateBrowseDir, the copy ships in every locale underwebsite/src/i18n, and the dashboard spec and feature map describe the route and the control.Backwards compatibility
Compatible: a new route and a new control; no existing route, response field or listing changes. One keystroke changes on purpose: on the Browse tab, Tab moves through the picker's controls instead of closing the picker. Escape still closes it. The three tab headers and Select leave the Tab order: they only ever acted on a mouse press, so a keyboard could not press them, and Enter in the path field stays Select's keyboard path.
Removes nothing: the diff only adds a route, a client method, a control and its copy.
Tests
test/test_browse_create_dir.py: a create answers 201 with the new path and audits it; it runs off the event loop; an existing name is 409 and left alone; each invalid name (empty,.,.., a slash, a backslash, a NUL, a name too long, which Windows can report as a missing path, a non-string) and a missing parent are 400 with nothing created; on Windows, a drive-qualified name (Z:x) cannot leave the parent; a missing or file parent is 404; a protected new path is 403 before it exists, and the real floor refuses both~/.awsand a folder inside~/.ssh; a non-owner is refused before the body is read; a parent without write permission is 403; a parent swapped for a link after the check (a junction on Windows) is 409 with nothing created in the link's target; the route is on the real route table.website/src/test/ProjectPicker.newFolder.test.tsx: create, then the pane is on the new folder ready to Select; each refusal code gets its own copy (the rest take the generic copy), keeps the name and clears on the next edit; Escape closes only the field and returns focus to the path field; a create that answers after the user moved to another folder does not pull the pane back.website/src/test/ProjectPicker.keyboardIsolation.test.tsx, above a real dialog: Tab from the Browse path field reaches the star (Enter favourites the folder) and New folder (Enter opens the field) without closing the picker, and Escape on either closes only the picker; Tab from the name field stays in the field; Escape on the name field, Create or the close control closes only the field; a focused Create stays focusable while its create is out; after the toggle closes the field, Escape dismisses only the picker, not the dialog under it.website/src/test/ProjectPicker.footer.test.tsx: on Browse, Tab from the New folder controls moves through the caller's footer and wraps back to Back.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.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(22 tests, 21 on Linux)-n 4beside neighbourspytest -n 4 --dist loadgroup test/test_browse_create_dir.py test/test_browse_dirs.py test/test_browse_files.pyrandom.Random(seed)order at-n0, seeds 11-15vitest run src/test/ProjectPicker.newFolder.test.tsx src/test/ProjectPicker.keyboardIsolation.test.tsx --no-file-parallelism(27 tests, before the Tab test was added)vitest run --maxWorkers=1 --sequence.shuffle --sequence.seed=N src/test/ProjectPicker.keyboardIsolation.test.tsx src/test/ImeEnterGuardSites.test.tsxpytest -n0 test/test_browse_create_dir.pyvitest run src/test/ProjectPicker --maxWorkers=4(11 files, 170 tests)--sequence.shuffle --sequence.seed=101..105Manual verification
Built the SPA from this branch and drove a throwaway
kirocrew gateway --test-mode(its own data home and a scratch home folder, listening on loopback only) in headless Chromium: opened the chat composer's project picker, Browse, New folder; an existing name (notes) and.awsin the home folder were each refused with their own copy and the typed name kept;new-appwas created and the pane moved into it ready to Select. On disk afterwardsnew-appexisted and.awswas never created. The Windows drive-qualified name case is covered by a Windows-only unit test, which runs on the Windows CI job, not by this run.Screenshots / video
The name field open under the favourite row.
A name that already exists, explained under the field with the name kept.
.awsin the home folder, refused as a protected location.The pane on the new folder after Create, ready to Select.
Related Issues
Closes #26005
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)