Add managed Files library and Settings browser - #1206
Conversation
Add a data-directory-backed Files surface with secure streamed APIs, a Settings browser, local agent discovery, and Docker, Podman, and Apple Container mounts. Managed mounts default to read-only and portable exports remain opt-in. Harden path traversal, symlink handling, overwrite commits, archive resource limits, manifest validation, container policy recreation, and browser downloads. Include focused Rust, Playwright, config, prompt, sandbox, backup, and documentation coverage.
Greptile SummaryThe PR adds a persistent managed Files library spanning authenticated REST operations, sandbox mount policies, portable backup support, runtime discovery, and a Finder-style Settings interface.
Confidence Score: 5/5The PR appears safe to merge; no concrete changed-code failure remained after reviewing the filesystem confinement, route integration, archive validation, and sandbox policy paths. User-controlled paths are confined through validated logical paths and capability directory handles, uploads and managed-file restores use guarded staging, and the new routes and mount policies integrate consistently with the existing application architecture.
|
| Filename | Overview |
|---|---|
| crates/gateway/src/files/service.rs | Introduces capability-based managed-files operations with no-follow directory traversal and guarded mutation behavior. |
| crates/gateway/src/files/path.rs | Defines strict logical-path parsing that rejects traversal, absolute paths, control characters, and reserved staging names. |
| crates/gateway/src/files/upload.rs | Implements staged uploads with unique temporary files, cleanup guards, and commit-time destination checks. |
| crates/httpd/src/files_routes.rs | Adds streamed REST handlers, upload limits, overwrite controls, and Files-specific scope checks. |
| crates/portable/src/import.rs | Adds bounded two-pass archive processing and capability-confined managed-files restoration with atomic per-file commits. |
| crates/portable/src/export.rs | Adds opt-in managed-files archive export and inventory metadata. |
| crates/tools/src/sandbox/docker.rs | Maps none, read-only, and read-write managed-files policies into Docker and Podman mount arguments. |
| crates/tools/src/sandbox/apple.rs | Adds Apple Container managed-files volumes, using a read-only empty mask for the none policy. |
| crates/web/ui/src/pages/sections/FilesSection.tsx | Implements the Finder-style Settings browser and file-management interactions. |
| crates/web/src/lib.rs | Mounts the new Files and portable-data REST routers within the protected web route set. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
UI[Settings Files browser] -->|Authenticated REST| HTTP[HTTP files routes]
HTTP --> Service[Managed Files service]
Service --> Root[(Data directory / files)]
Root --> Sandbox[Sandbox mount policy]
Sandbox --> Docker[Docker / Podman]
Sandbox --> Apple[Apple Container]
Root --> Portable[Portable export / import]
Portable --> Archive[(Validated backup archive)]
Root --> Runtime[Runtime path and MOLTIS_FILES_DIR]
Runtime --> Agents[Host and external agents]
Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile
Merging this PR will improve performance by 11.83%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | session_history_path[user@host:session:42] |
7.5 µs | 6.7 µs | +11.83% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing aback-crowley (cb7de35) with main (1a7b5a4)
Footnotes
-
9 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Targeted local validation converted changed lib.rs files into a positional nextest filter named 'lib'. Inline tests are named after their modules instead, so the command selected zero tests and aborted after all earlier suites passed. Run crate and module roots package-wide while retaining narrow filters for ordinary source files.
Summary
MOLTIS_FILES_DIRdiscovery and read-only-by-default Docker, Podman, and Apple Container mountsArchitecture and flow
flowchart LR Browser["Settings > Files"] -->|"authenticated REST"| Routes["Files API routes"] Routes --> Service["Capability-rooted LocalFilesService"] Service --> FilesRoot["data_dir/files"] Agent["Agent runtime / exec"] -->|"MOLTIS_FILES_DIR"| Host["Host file access"] Host --> FilesRoot Agent --> Sandbox["Docker / Podman / Apple Container"] Sandbox -->|"none / ro / rw mount policy"| FilesRoot DataUI["Settings > Moltis data"] --> DataRoutes["Portable export / import API"] DataRoutes --> Archive["Bounded, manifest-validated archive"] Archive -->|"Files included only when opted in"| FilesRootValidation
Completed
cargo fmt --all -- --checkjust lintjust release-preflightcargo test -p moltis-gateway filescargo test -p moltis-httpd server::middleware::testscargo test -p moltis-httpd files_routes::testscargo test -p moltis-portablecargo test -p moltis-tools managed_filescd crates/web/ui && npm run buildcd crates/web/ui && npx tsc --noEmitcd crates/web/ui && npx playwright test e2e/specs/settings-data.spec.jscd crates/web/ui && npx playwright test e2e/specs/settings-files.spec.jscd docs && mdbook build./scripts/check-file-size.shMOLTIS_BINARY=<temporary zvec runtime wrapper> ./scripts/local-validate.sh 1206(workaround formoltis-o416)Remaining
Manual QA
tools.exec.sandbox.managed_files_mounttonone,ro, andrw; verify/home/sandbox/filesandMOLTIS_FILES_DIRmatch each policy in a local container sandbox.