Directory path edits bypass validation
Adding a directory such as /secret/ creates it correctly, but the record is then editable: renaming /secret/ to secret goes through, and accepting that edit is broken:
- Directory moves are not supported, so any accepted path change leaves the record naming a directory that does not exist.
- The edited directory cannot be deleted — deletion fails silently — unless another edit restores the original name (
/secret/).
Three defects: be-update has no path validation (valid-new-directory runs only on be-insert); the accepted rename desynchronizes DB row, RBAC resource name (update-resource-name follows it), and the on-disk directory (be-update never touches the fs); the delete failure is actually a correct server 400 (valid-existing-file-or-directory rejects the slash-less path) that the frontend deleteSelected swallows (no res.ok check, no alert).
Fix (reject, don't move — moves are a real feature with descendant-row / resource / RBAC rewrite fan-out, out of scope): new valid-updated-directory in be-update (any change to a :path field's value signals; total gate, admin included; called after full-data / before every side effect, so no rollback is ever needed), plus res.ok / alert in deleteSelected (the submitForm pattern). Leaf (file) types are gated identically. Frontend build + new FiveAM suite directory-update-suite (modelbank-test fixture).
Plan: directory-edit-validation-plan.org.
Implemented 2026-10-20 per the plan, no deviations:
lisp/backend.lisp: newvalid-updated-directory(aftervalid-existing-file-or-directory); called inbe-updateaftervalidate-fields, before the main update SQL and every side effect. Total gate, admin included, leaf types covered.be-set-field-valueintentionally bypasses it (action-status path; also the REPL repair tool for pre-fix broken rows).web/src/App.tsx:deleteSelectednow checksres.okand alerts viaerrorMessage, breaking on first failure (one alert;fetchList()shows the true state). Built (tsc + vite).tests/directory-update-tests.lisp(new suite, 18 checks): unchanged-path control, malformed rename, well-formed rename, root rename, leaf rename rejected, leaf unchanged control. Registered indata-ui.asd;run-directory-update-testsadded totests/helpers.lispandrun-tests.docs/model-reference.md: one Behavior bullet under "Tree and filesystem-backed types" (path fields immutable after create).- Full suite via
scripts/data-ui tests: 2042 checks, 37 groups, all passed.
Related: "File / directory move (rename)" (MVP Backlog) replaces this gate when real moves land.
- Slot
- 2400
- Status
- 60 Done
- Tags
- mvp, backend, bug
- Contributors
- Donnie