D1: deployment UI, docs and G17
Some checks are pending
ci / ci (macos-15) (push) Waiting to run
ci / ci (ubuntu-24.04) (push) Waiting to run
ci / ci (windows-2025) (push) Waiting to run

Servers dialog (write-only keychain secret, test connection, unknown and
changed host key), status-bar progress with Cancel, Deployment log tool
window, Upload/Download in the project tree menu and Tools › Deployment.
docs/deployment.md, architecture section, G17 row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-06 18:46:11 +01:00
parent f3c9ef9ce3
commit 872b5cb258
22 changed files with 2628 additions and 26 deletions

View file

@ -14,6 +14,7 @@ crates/engine (L4) command registry, workspace state, guard, recovery jou
crates/lsp (L3) LSP client (Phpactor first), later DAP client
crates/terminal (L3) pseudo-terminal sessions (portable-pty)
crates/vcs (L3) Git through the installed git command
crates/deploy (L3) deployment: SFTP, FTP/FTPS, folder; keychain secrets, known hosts
crates/index (L2) symbol index, usages, later type inference
crates/vfs (L2) project model, file watching, ignore rules, encodings
crates/search (L2) find in files (ignore + grep-searcher crates)
@ -752,6 +753,15 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
- **Checked in the app** (debug build with the bundled UI, Windows 11, git 2.47.1, control port 7949, a demo repository with two stashes on two branches and a modified file; commands and screenshots only, no input): `git.stashList` 143–157 ms, `git.stash` 640 ms, a pop 366 ms, each including the control round trip. The refusals came back as written above: applying onto a modified file ("would be overwritten" with git's text), nothing to stash (with the untracked hint), a missing entry. Screenshots of the list (`stash@{n}`, WIP text, branch, date; Drop, Pop, Apply) and of the form, plus the two new buttons in the Changes bar, read in the dark theme.
- **Tests:** `crates/vcs/tests/stash.rs` (6 tests against real temp repositories: stash with and without a message, list order and hashes, apply, pop by an abbreviated hash, drop; untracked files only with the flag, including a nested folder and a name starting with `-`; no commit and nothing to stash; a missing and a changed entry, a bad hash; overwritten local changes and untracked files in the way, both leaving the work tree and the entry alone; a conflicted pop keeping the entry and blocking the next stash and apply); unit and property tests in `stash.rs` (list and subject parsing, message cleaning, unmerged counting, hints, chunking); `crates/engine/tests/git_stash.rs` (the command shapes, `gitChanged` only after changes, a changed hash, an empty stash, bad params); Vitest `ui/tests/vcs/Stash.test.ts` (13 tests: parsing, the form with `flushDirty` first, a blank message, a refusal, a failed save, Escape and focus, the list with keyboard and apply, a conflicted pop, the drop question, an empty stash, a failed read, the commands' registration, the Changes window's buttons).
### Deployment (C9 D1)
- **Owner decision D27 (2026-11-02):** pure-Rust libraries (`russh` + `russh-sftp` with `ring`, `suppaftp` with `rustls`/`ring`, `keyring`); secrets only in the OS keychain. User guide: [`deployment.md`](deployment.md).
- **Crate (`crates/deploy`, L3):** `config` (servers per project, `deny_unknown_fields` so a hand-written `password` field is refused), `mapping` (longest local prefix wins, no `..`, excluded paths and `*`/`?` name patterns; unit and property tests), `secrets` (`SecretStore` trait, `Keychain`, `MemoryStore`; `Secret` debug-prints as `***`), `known_hosts` (Lutra's own file; unknown → `HostKeyUnknown`, different → `HostKeyMismatch`, checked before any credential is sent), `remote` (the `Remote` trait: `mkdir_all`, `put`, `get`, `kind`, `list`, `close`; the extension point for D2), `sftp`, `ftp`, `job` (plan, connect once, transfer file by file; a `Monitor` holds progress and log lines; a `Cancel` flag is checked between 32 KiB chunks and races every SFTP wait). Every library error passes `DeployError::redacted` with the secret in use. Names from remote listings are checked before they become local paths.
- **Test servers** (feature `testserver`, 127.0.0.1 only): a russh SFTP server over a folder with a fixed Ed25519 host key, and a small FTP server. Example `testserver` runs both for live checks.
- **Engine (`cmd/deploy.rs`):** configuration at `<config_dir>/deployment/<project-id>.json`, known hosts at `<config_dir>/deployment/known_hosts`, keychain account `<project-id>/<server-id>/<password|passphrase>`. Commands: `deploy.servers`, `deploy.saveServer {server, secret?}`, `deploy.removeServer`, `deploy.setDefault`, `deploy.setSecret`, `deploy.clearSecret`, `deploy.testConnection {id?}` (an unknown or changed host key, a missing secret or a refused sign-in is a value with `ok: false`), `deploy.trustHostKey {id, algorithm, fingerprint, replace?}`, `deploy.upload {paths, id?}`, `deploy.download {paths, id?}`, `deploy.cancel`, `deploy.log`, `deploy.clearLog`. Jobs are pending outcomes on a `lutra-deploy` thread; one at a time. `file.save` and `file.saveAll` queue uploads on save, which the pump starts and finishes. Events: `deployProgress`, `deployLog {entry}`. `Engine::set_secret_store` swaps the keychain (tests).
- **UI (`ui/src/components/deploy/`):** `deploy.ts` store, `DeployStatusItem.vue` (progress, Cancel, the `deployment.*` UI commands), `DeploymentDialog.vue` (exclusive modal `deployment`; write-only secret field; host-key question), `DeploymentLogToolWindow.vue` (bottom panel). The project tree's context menu gains Upload/Download for files and folders.
- **Tests:** `crates/deploy/tests/transfer.rs` (7: host key first use and mismatch, password and key sign-in, upload, download, cancel, FTP, unreachable), `crates/engine/tests/deploy.rs` (4, including a grep of every event, value, error and the config and data directories for the test password), `ui/tests/deploy/Deploy.test.ts` (12).
## Decisions (M0)
| Question | Decision | Why |
@ -772,6 +782,7 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
| Date | Change | Summary |
|---|---|---|
| 2026-11-06 | minor | C9 D1: `crates/deploy` (L3), `deploy.*` commands, deployment events and UI |
| 2026-11-02 | minor | C9 F1: `Kind::Path` and `check_path` (one validator for `settings.set` and the dialog, `path` in `settings.list`), `lutra_proc::spawn_detached` for the CLI's desktop start |
| 2026-10-31 | minor | C7 B1: app identifier `com.tyrveil.lutra` with the one-time copy from `dev.lutra.desktop`, NSIS and DMG installers, `cargo xtask bundle` |
| 2026-10-31 | minor | C7 A3: `git.mergeMessage` and the merge message prefill, `git.ignore` and the Changes context menu, gutter markers kept on their line, per-module `COMMAND_IDS` for the command listing test |