Repository navigation
Conversation
…e slot's Node; the state lock sends its script once The state-mutation wrapper repeated its whole script in both branches of the timeout check, so every capture, restore and clear crossed the wire twice. The deadline is now a word list and the script is sent once. The activation's capture (prune, symlink refusal, tar, verdict) moves into `orcad --orcad-state-snapshot capture`, run by the candidate slot's own Node inside the unchanged shell lock and deadline. The archive stays state.tar, so older clients still restore it with tar -x. The rollback rescue keeps the shell capture, because the slot it runs against may predate the subcommand.
…h the shell prune
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
|
Superseded: a shell shrink (one member loop, each path sent once) brings every state op under the 6 KiB budget and is smaller than the Node op, so the lead revised D-J to keep one shell implementation. This PR's good part, the state-lock wrapper sending its script once, is folded into the R4-10b shell PR (linked there). |
ELI5
Before Orca updates its server on a remote machine, it saves a copy of your settings and sessions, so a rollback has something to go back to. That save was a very long shell command, and some SSH gateways cut long commands short. This makes the save command much shorter in two ways. It stops sending the same script twice. And the activation save now runs as a small program inside the new server build, instead of as a long shell script.
What Changed
serializedStateMutationCommand(the shell lock, fence and 15-minute deadline every state change runs under) repeated its whole script in both branches ofif command -v timeout. The deadline is now a word list (orca_deadline=...; orca_state_group $orca_deadline sh -c '...'), so the script crosses the wire once. Measured worst-case wire bytes:orcad --orcad-state-snapshot capture <root> <snapshotDir> [keep...]on the slot it is about to activate, inside the unchanged shell lock and deadline (5,324 bytes).src/main/orcad/orcad-state-snapshot-host-op.tskeeps the old contract exactly: theCAPTURED/EMPTY/FAILEDverdict, aSNAPSHOT_FAILUREreason of up to 400 characters, refusal of symlinks, umask 077, a.partialfile then a rename, and pruning of every other siblingpre-*dir except the recorded snapshot (rollback rescues are never touched).state.tar, written by the host'star, so older clients restore it withtar -x.orcadNodeSlotRuntimeCommand/selectOrcadSlotEntryCommandassignorcad_slot=once instead of repeating the long slot path.pruneOrcadSnapshotsScript) and the shell capture'spruneparameter. Only the rollback rescue still uses the shell capture, and it never pruned.Why
This is round 4, R4-10b (decision D-J): move the long POSIX state ops onto Node. Running the op under the candidate slot's own bundle means no new script to stage and no version probe. The candidate's profile preflight has just proven that this exact build runs on this host, and this client built it.
tar -x.Linked Issue
Part of the SSH/remote hardening round 4 (R4-10b). Related: #30491.
Visual Proof
N/A: there is no UI change. This only changes the remote host commands.
Testing
orcad-state-snapshot-host-op.test.tsruns on the real filesystem with the realtar: the shell'star -xrestores the archive, the daemon dir is excluded, prune keeps the right dirs and every rollback rescue, an empty root reads asEMPTY, a symlink is refused with a reason, an unreadable file fails and removes its partial, an un-prunable old capture doesn't block, and an unknown op fails.SNAPSHOT_FAILUREreason.src/main/managed-server,src/main/orcadandsrc/main/ssh, single worker. The only failures are the known macOS/private/vartmpdir cases inorcad-forked-child-paths.test.ts, which fail the same way on main.5ca7d7f9, before the final prune-tolerance commit.Review
rm -rfloop.EMPTY. This is safer, because an empty answer lets a later rollback skip restoring.Agent skill upstream boundary
Notes
taris started with@orca/process-host.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)