Skip to content

Manage a Machine's Projects over the Machine connection - #100

Merged
marcellosso merged 6 commits into
mainfrom
feat/manage-machine-projects
Nov 14, 2026
Merged

marcellosso merged 6 commits into
mainfrom
feat/manage-machine-projects

Conversation

@marcellosso

Copy link
Copy Markdown
Owner

Closes #99

A connected Machine's Projects can now be managed from this app as this computer's are: add (folder picked and scanned on the Machine), import a Project file from the Machine, edit a Project, its Environment and Profiles, add/edit/remove Services, Detect Services, delete, and favourite. Nothing of a Machine's Projects is stored here.

Protocol and core

  • MACHINE_PROTOCOL_VERSION is now 2 (MANAGES_PROJECTS). New MachineRequests: ListDirectory, ScanFolder, ScanProject, DetectPythonEnvironment, AddProject, EditProject, RemoveProject, AddService, AddServices, EditService, RemoveService, SaveEnvironment, SetActiveProfile, SecretValue, ReadProjectFile, ImportProject. Favourite goes through EditProject (isFavorite). Reordering isn't offered here, since there's no local operation for it.
  • relay answers them on the Machine as Origin::Machine, using the same ProjectLibrary calls its own app makes, then announce_projects_saved so an app open there shows the change. Paths are validated there (existing_project_folder, ~ expanded there), so errors such as a missing folder or no permission are the Machine's.
  • New core::editing module holds the steps that take more than one library call: remove a Project or Service (stopped first, logs removed after), edit with a move to another Execution Target, import with Replace, save the Environment editor. Plus list_directory and read_project_file. The relay and the desktop app's local editors both use it, so the logic isn't forked.
  • NewService, ProjectChanges, ServiceChanges (with a small double-option helper, so "leave it" and "clear it" stay distinct), ProfileChanges, VariableInput and KeyClash are now serde types. Also new: ProfileInput, DirectoryListing, ProjectFileText, and free_project_key(projects, key).
  • Machines and MachineConnection get the matching methods; FFI exports them for macOS.
  • New errors: MachineNeedsUpdate { machine } ("Update localhost on devbox to manage its Projects.") and FolderUnreadable { path, reason }.

Older Machines

MachineState::Connected gains manages_projects, from the Machine's hello. With an older localhost there (protocol 1), the app shows its Projects as view-and-run only and says "Update localhost on to manage its Projects." The calls refuse before sending anything. An Unsupported reply is also mapped to that error, so the user never sees a broken form. Older apps ignore the new hello field and requests, as before.

Secrets

Secret values typed in an editor go over the existing SSH connection to the Machine and are written only to its secret store. Reveal reads a value from the Machine (SecretValue) to show it, the same rule as a local reveal, and never stores it here. Nothing of a Machine's Projects is persisted on the viewing computer: the end-to-end test checks the app's storage root gets no projects/.

Remote folder picker

The system's dialog can't browse another computer, so both apps get localhost's own picker, backed by ListDirectory:

  • a path field you can type into, a breadcrumb, Up, and Home;
  • the folder list, with Show hidden;
  • a file mode for Project files (.yaml/.yml), used by Import;
  • Choose.

It starts at the Machine's home. Errors (not found, permission denied) are shown inline in the Machine's words. Working directories picked on a Machine are made relative to the Project folder.

Apps

  • Desktop (Tauri):
    • New machine_editors.rs with machine_* commands mirroring the local editors.
    • The React forms take an optional Machine; editing.ts sends their calls to this computer or the Machine.
    • Forms name their target: "New Project on devbox", "in Shop on devbox · /srv/shop".
    • Entry points:
      • a + next to each Machine's name in the sidebar (New Project / Import Project on devbox…);
      • Project and Service context menus, the toolbar ⋯, and the Profile menu;
      • the Services column's Add Service / Edit…;
      • the command palette;
      • Ctrl+N / Ctrl+Shift+N, which act on the selected Machine Project.
    • When a Machine isn't connected or is too old, actions are disabled with the reason (menus show it as a tooltip and to screen readers); nothing is queued.
    • Export, Stats and the folder actions stay local-only.
  • macOS (SwiftUI): the same actions, picker and copy, through AppModel routing to the library or Machines, plus thin wrappers in LocalhostCoreFFI. Details are in the commit.

Tests

  • core/localhost-core/tests/machines.rs:
    • add with folder listing and scan on the Machine, including Machine-side path errors;
    • edit Project and Services, including clearing a Port with Some(None);
    • Secrets kept in the Machine's store and revealed from it;
    • Environment and Profiles;
    • remove a running Service and a Project;
    • import with a Key clash;
    • an older (protocol 1) Machine saying to update.
  • editing.rs unit tests for list_directory: ordering, hidden names, missing folder, permission denied.
  • core/localhost-cli/tests/machines_ssh.rs: end to end over a private sshd with the real localhost remote --stdio. It lists, scans, adds, edits a Project and a Service, checks they are saved on the Machine and not here, then removes the Project.
  • Desktop: Rust tests for editProblem; Vitest MachineEditing.test.tsx covers:
    • Add Project through the remote picker and Machine scan;
    • a picker error and a typed path;
    • editing and removing a Service on a Machine;
    • disabled reasons on an older Machine;
    • path helpers.
  • Commands run:
    • cargo test and cargo fmt --check in core/; all pass.
    • cargo clippy --all-targets -D warnings, and for x86_64-pc-windows-msvc: clean for this change. On the local toolchain (1.99) clippy flags logs.rs:304 and src-tauri/src/wsl.rs:59, both on main and untouched here; CI's 1.90 doesn't raise them.
    • In apps/desktop: pnpm typecheck, pnpm test, pnpm build, cargo test and cargo clippy in src-tauri/ (bindings.ts regenerated).

Not tested / left out

  • The macOS app was not built (this was done on Linux). The Swift was written against the bindings generated here with uniffi-bindgen (swift test and xcodebuild not run). Things to check first in Xcode:
    • AppModel+Machines.swift: machines(for:) shares its name with the machines property;
    • RemoteFolderPicker.swift: List(selection:) with an optional String, and the conditional keyboardShortcut;
    • the Sheet cases' defaulted associated values.
  • Neither app was run by hand in light/dark or with a screen reader.
  • Type-ahead filtering in the picker isn't implemented (typing a path works).
  • In the desktop tests, Onboarding.test.tsx › "remembers the first Running Service…" failed twice in about 25 full pnpm test runs on this branch. It passed 4/4 full runs on main, and 25/25 run alone on both branches; I couldn't tie it to this change.
  • No changelog entry, as asked.

@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
localhost-web Ignored Ignored Preview Nov 14, 2026 4:39am UTC

@marcellosso
marcellosso merged commit 3d02c7c into main Nov 14, 2026
17 of 19 checks passed
@marcellosso
marcellosso deleted the feat/manage-machine-projects branch November 14, 2026 05:38
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.

Manage a Machine's Projects: add, import, edit, delete and favorite over the Machine connection, with a remote folder picker

1 participant