Skip to content

Add managed Files library and Settings browser - #1206

Merged
penso merged 4 commits into
mainfrom
aback-crowley
Aug 18, 2026
Merged

Add managed Files library and Settings browser#1206
penso merged 4 commits into
mainfrom
aback-crowley

Conversation

@penso

@penso penso commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a persistent, data-directory-backed Files library with authenticated streamed list, upload, download, create, move, and delete APIs
  • add a Finder-style Settings browser plus MOLTIS_FILES_DIR discovery and read-only-by-default Docker, Podman, and Apple Container mounts
  • add opt-in portable backup support with bounded archive validation, documentation, and security-focused Rust and Playwright coverage

Architecture 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"| FilesRoot
Loading

Validation

Completed

  • cargo fmt --all -- --check

  • just lint

  • just release-preflight

  • cargo test -p moltis-gateway files

  • cargo test -p moltis-httpd server::middleware::tests

  • cargo test -p moltis-httpd files_routes::tests

  • cargo test -p moltis-portable

  • cargo test -p moltis-tools managed_files

  • cd crates/web/ui && npm run build

  • cd crates/web/ui && npx tsc --noEmit

  • cd crates/web/ui && npx playwright test e2e/specs/settings-data.spec.js

  • cd crates/web/ui && npx playwright test e2e/specs/settings-files.spec.js

  • cd docs && mdbook build

  • ./scripts/check-file-size.sh

  • MOLTIS_BINARY=<temporary zvec runtime wrapper> ./scripts/local-validate.sh 1206 (workaround for moltis-o416)

Remaining

  • None.

Manual QA

  1. Open Settings > Files, upload files and a nested folder, then verify sorting, breadcrumbs, rename, move, download, and confirmed recursive deletion.
  2. Set tools.exec.sandbox.managed_files_mount to none, ro, and rw; verify /home/sandbox/files and MOLTIS_FILES_DIR match each policy in a local container sandbox.
  3. Export Moltis data with Include Files disabled and enabled, preview each import, then verify managed Files are restored only from the opted-in archive.

penso added 2 commits August 16, 2026 19:33
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-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The 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.

  • Adds capability-based list, upload, download, create, move, and delete operations under the managed Files root.
  • Integrates none/read-only/read-write Files mounts with Docker, Podman, Apple Container, host execution, prompts, and external agents.
  • Adds optional Files export/import with bounded archive validation and preview support.
  • Adds the Settings Files browser, documentation, configuration schema, and focused Rust and Playwright coverage.

Confidence Score: 5/5

The 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.

Important Files Changed

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]
Loading

Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

@codspeed-hq

codspeed-hq Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 11.83%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 38 untouched benchmarks
⏩ 9 skipped benchmarks1

Performance Changes

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)

Open in CodSpeed

Footnotes

  1. 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.

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.
@penso
penso merged commit 70adc73 into main Aug 18, 2026
64 of 68 checks passed
@penso
penso deleted the aback-crowley branch August 18, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant