Repository navigation
fix(install): tell git's answers for the installed commit apart, run the launcher without git, and the last refusal gaps - #3929
Conversation
…the launcher without git, and the last refusal gaps
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
Windows VM |
…pped server, and word each record's advice for what is known
|
Windows VM |
…, git's own ownership line, and the old id's stop said by every refusal
|
Windows VM |
Merge passMerged head
Merge pass note for #3929 at 03707fa (installer follow-up to #3928: git's answers for the installed commit told apart, the launcher without git, the last refusal gaps). Two reviewers, three rounds, each with a table of build states against server states and what git answers. Evidence: reviewers ran the TypeScript tests (plugin-launch 18 pass, incl. a case with real git) and the quoting with real git on Linux for a space, an apostrophe and both; the Windows test file and a real Git for Windows run in a VM are the author's; GitHub's two Windows checks ran on the head. Known and accepted: a checkout that git distrusts every time went from accepted to refused on such reruns (fail-closed, with the command to fix it); a live server with no record can still be built under (no released version leaves that); a build during which the commit moved is left "started" and still used by the next plain start; with no git, no cached binary and the release out of reach, the launcher cannot start an already-built source checkout (unchanged from main, the author's follow-up). |
…ad only git's stdout, and start a checkout git cannot tie without asking the release (#3937) Follow-up to #3929 (merged as f6ad182). Five points from dori's review of #3929's last head and the merge pass, none urgent. It does not change when install.ps1 or install.sh builds, stops or refuses. The launcher changes in one state: where git ties no sources to the release (no git on PATH, no checkout, changes not committed), it no longer asks the release. A start then runs the checkout's own build only once that build finished, and remembers nothing; an unfinished build is not started, and the launcher says how to build it (point 5; the second commit). ## What changes 1. **install.ps1, a rerun with `OVIS_REF` over a checkout that needs no build, in a folder git distrusts** (dori LOW 1). The line printed carried git's whole stderr, including git's suggested command quoted for a POSIX shell (`'…O'\''Brien…'`), which trusts nothing when pasted into PowerShell. It now says git's first line, then `Ovis: to trust the folder, run:` and `Get-TrustCommand`'s line alone, as the refusals already do. 2. **The launcher's trust command on Windows** (dori LOW 2). herdr shows the launcher's stderr, and a user may paste it into PowerShell or into cmd.exe, which keeps single quotes. A label alone still leaves cmd.exe users without a command that works, so both forms are given, each on its own line and introduced by its shell's name: ``` Ovis: git does not trust this folder (another account owns it); to trust it, run in PowerShell: git config --global --add safe.directory 'C:/…/John O''Brien/plugin' Ovis: or in cmd.exe: git config --global --add safe.directory "C:/…/John O'Brien/plugin" ``` There is no cmd.exe form for a folder whose path has a `%` (cmd.exe expands `%name%` there) or a `!` (`cmd /v:on` expands `!name!` inside double quotes; second commit). POSIX output is unchanged. 3. **install.sh `ref_not_moved` keeps git's stdout and stderr apart** (dori LOW 3). With `2>&1`, a warning git printed while it succeeded (about a config file it cannot read, for example) was read as the `--show-prefix` answer, so the folder counted as nested and no commit was said, or it ended up in the "at commit" text. Now only stdout is the prefix and the commit; stderr goes to a `mktemp` file, read for its first line and for `not a git repository`. If no temp file can be made, nothing is said of git, as when herdr names no plugin root. 4. **"moved to another commit"** (dori LOW 4) is said only when both of git's answers name a commit. Otherwise the launcher says that git's answer changed, and from what to what: `git's answer for the checkout changed while it was built (no git checkout before, a folder inside another repository after), so the build is not marked finished`. The stamp stays `started`, as before. 5. **The launcher starts an already built checkout without git while the release is out of reach** (the fault #3929 left, named twice by the merge pass). See the decision and the table below. 6. (second commit) **A folder git distrusts is said as such** in the reason the release's binary is not taken (`sourceTrees`): `git does not trust this folder (another account owns it)`, not `not a git checkout`. Any other git failure is said with git's first line. ## Point 5: when starting is safe What the launcher needs git for here: `sourceTrees` exists for one decision, whether this checkout's `server/` and `shared/` are the sources of the release's binary (`installServer` compares them with the signed manifest). If `sourceTrees` returns a reason instead of trees (no git, no checkout, changes not committed), the binary is never taken, whatever the release holds: - a manifest that checks out leads to `NoBinaryRelease` on the sources; - a 404 leads to `NoBinaryRelease`. So the download could only add a failure; it could never change the choice. `installLocked` downloaded first and looked at the reason after. It now throws `NoBinaryRelease` on the reason before the release is asked, after the verified-install checks, so a binary already installed and verified still runs, as before. What a start for that reason may run (second commit, after both merge-pass reviews of e1a4d23): - At e1a4d23 it picked source and wrote the from-source marker without looking at the build. A tree with packages and no client started a server answering "the browser client has not been built yet" (at f6ad182 nothing ran there); a `started` stamp did not stop it; and the marker made the choice stick after git and the network came back. - Now a command other than `install` runs the checkout's own build for this reason only when that build finished: `node_modules` and `dist/index.html` present, and the stamp, if any, not `started`. Otherwise it starts nothing, exits 1, and says what is missing and how to build it: `OVIS_FROM_SOURCE=1 bun '<checkout>/scripts/plugin-launch.ts' install`, or `$env:OVIS_FROM_SOURCE = '1'; bun '<checkout>\scripts\plugin-launch.ts' install` on Windows. - The marker is not written for this reason: it may not hold at the next start (git back, a commit made). That start asks the release as usual. - The stamp is untouched; only a build writes it. A build without git still leaves `started` (#3929). - install.ps1 (it needs git) and install.sh decide as before. herdr's next build step (`install`) builds from source for this reason as before, and only that writes the marker. ### States (launcher) "Untied" means git ties no sources to the release: no git on PATH, git distrusting or failing on the folder, no checkout, or changes not committed in `server/`/`shared/`. Every row has no verified cached binary and no from-source marker unless it says so. | state | f6ad182 | e1a4d23 | this head | |---|---|---|---| | untied, release out of reach (or a 5xx, or a manifest failing its check), `start`, finished build (packages, client, stamp not `started`) | exit 1, nothing runs | runs it; marker written; release not asked | runs it; **no marker**; release not asked | | the same, build without its client (`dist/index.html` missing) | exit 1, nothing runs | runs it (a server answering "the browser client has not been built yet"); marker written | **exit 1, nothing runs**: says `no dist/index.html` and the command that builds it; no marker | | the same, without its packages (`node_modules` missing) | exit 1, nothing runs | runs it (fails on its imports); marker written | **exit 1, nothing runs**, says `no node_modules` and how to build; no marker | | the same, stamp `started` (a build that failed or was cut off) | exit 1, nothing runs | runs it; marker written | **exit 1, nothing runs**, says its last build did not finish and how to build; no marker | | untied, release reachable with a manifest or a 404, `start` | release asked; runs from source (any build); marker written | runs from source (any build) without asking; marker written | finished build: runs it, no marker; otherwise exit 1 with how to build | | a later `start` after git and the release are back (after any row above) | asks the release | goes straight to the sources (the marker) without asking | **asks the release**, as usual | | untied, `install` (herdr's build step), release out of reach | exit 1, marker and stamp removed | builds from source, marker written, stamp `started` without git | the same as e1a4d23 | | untied, marker of this version | runs from source | the same | the same (never reaches this branch) | | any, verified binary of this version installed | runs the binary | the same | the same | | git ties the sources, release out of reach | exit 1 | exit 1 | exit 1 | | the reason said for a folder git distrusts | `not a git checkout` (only when the release answered) | `not a git checkout`, on every start | `git does not trust this folder (another account owns it)` | Tests by row (plugin-launch.test.ts unless named). The new launcher cases run the real launcher in a checkout of the test's own, with its real source path: its `scripts/plugin.ts` stands for the server and notes the command it got. They do not stub the source function. - row 1: "starts a finished build without git, the release out of reach, without asking it, and remembers nothing", plus "starts a finished build without asking the release where not a git checkout / where server/ or shared/ has changes that are not committed"; - rows 2-4: "starts nothing without git for a checkout without its client / without its packages / whose last build did not finish, saying it needs a build and how"; - row 5: the same cases, since the release is not asked (`asked: []`); - row 6: "takes the usual way again once git ties the sources and the release answers: the start without git left nothing behind" (a file:// release with no compiled server: the release is asked, `ships no compiled server`); - row 7: "builds from source at the build step without asking the release where git ties no sources to it"; - row 8: the no-git test's `status`, run on the marker; - row 9: server-install's "takes the binary only for the sources it was built from" (a verified binary, no git, offline release: `{ installed: false }`, release not asked); - row 10: "still asks the release where git ties the sources, and fails when it is out of reach"; - row 11: the distrust test now also requires `sourceTrees(folder)` to say git does not trust it. All nine new or changed launcher cases fail with e1a4d23's `scripts/plugin-launch.ts` and `scripts/server-manifest.ts`, and pass at this head. To link, that run added a wrapper exporting `gitFailed(err, platform)` around e1a4d23's own `gitFailed`. The rule kept in the launcher's header still holds: a manifest that fails a check, a server error or a network failure is never a reason to build from source. Here the reason is the sources, and the release is not asked. ## Every place that prints git's stderr (point 1's search) | place | what it prints | can it carry git's POSIX-quoted `safe.directory` command? | |---|---|---| | install.ps1 distrust refusal (`$distrusted`, before the build) | git's first line + `Get-TrustCommand` | no (#3929) | | install.ps1 generic git refusal (`git said: $gitFailed`) | all of git's stderr lines, joined | only when git's ownership line is not its first line (a warning before it): then the folder is not recognised as distrusted. See "faults that remain" | | install.ps1 rerun line, no build needed (`$at`) | **was** all of git's stderr; now git's first line + `Get-TrustCommand` when distrusted, all lines otherwise | no longer (point 1); the generic branch is as in the row above | | install.ps1 `rev-parse --disambiguate`, `git ls-remote` (ref check), `Get-LatestRef`'s `ls-remote` | not captured; git writes to the console itself | no: the first runs only after git read the commit in that folder; `ls-remote` with a URL gives no ownership advice even from a distrusted working directory (checked: real git with `GIT_TEST_ASSUME_DIFFERENT_OWNER=1` lists the tags) | | install.sh `ref_not_moved` | git's first stderr line | no: the first line names the folder; the command is git's last line | | install.sh `git clone` / `git checkout` (herdr-core install), `latest_release` | console / `2>/dev/null` | no: the clone is this run's own new folder; `ls-remote` as above | | install.sh `ovis` launcher's `rev-parse HEAD` (`install.sh:324`) | `stderr: "ignore"` | no | | plugin-launch.ts `checkoutCommit` failure line | git's first line when distrusted (+ the trust lines), all of stderr otherwise | as install.ps1's generic refusal: only when a warning comes before git's ownership line | | server-manifest.ts `sourceTrees` | `stderr: "ignore"` | no | ## Faults that remain - **A warning before git's ownership line** (a config warning, say) hides the distrust: install.ps1's and the launcher's match reads git's first line only. The generic refusal then quotes all of git's lines, its POSIX command among them. It fails closed (refused or `started`), but the trust command is not given. Not seen with Git for Windows 2.56 in the VM. - **A checkout with the from-source marker of its version** still runs whatever build it has (at f6ad182 too); only the untied, unmarked start checks the build (second commit). - The PowerShell form pasted into cmd.exe fails with git's `wrong number of arguments` when the path has a space (seen in the VM). Without a space it would record the quotes, which is why the cmd.exe form is printed. ## Validation **Second commit (988eec8)**, over e1a4d23 (pushed after GitHub's whole run on e1a4d23 had ended): - Windows VM, the real test file as GitHub runs it, at 988eec8: PATH unpadded (335) every section PASS, exit 0, 53 s; **PATH padded to 2726** every section PASS, exit 0, 52 s. - Windows VM, `bun test scripts/plugin-launch.test.ts scripts/server-install.test.ts`: 30 pass, 24 skip, 0 fail. This includes the new checkout cases, run on Windows with no git on PATH. - Linux: `plugin-launch.test.ts`, `server-install.test.ts`, `server-manifest.test.ts`, `changelog-fold.test.ts`: 93 pass, 0 fail. - Forced: with e1a4d23's `scripts/plugin-launch.ts` and `scripts/server-manifest.ts` (plus the `gitFailed` wrapper), 9 fail / 20 pass. The 9 are the new or changed cases listed under the table, the `!` case and the distrust reason included. - `bun run check fast` through heavy-run on 988eec8: exit 0, slot 12, 503 s, unit 17599 pass, 0 fail, 54 skip; the tree untouched while it ran. **First commit (e1a4d23)**, over origin/main a761ccd: - **Windows VM, the real test file as GitHub runs it** (`$env:CI='true'; powershell -NoProfile -ExecutionPolicy Bypass -File scripts/windows-install.test.ps1`, Windows PowerShell 5.1, the VM's desktop session, a clone of this commit): - PATH unpadded (335 characters): every section PASS, exit 0, 58 s; - **PATH padded to 2726**: every section PASS, exit 0, 58 s. - **Counting copy** (its `Assert` counts and goes on), this commit's test file: - with main's install.ps1: the new assertion fails ("a finished build of an older launcher (no stamp), git failing at the checkout: git's own lines after its first must not be said"). The file then stops where it parses the trust line, because main prints none on its own line. - at this commit: **237 pass / 3 fail**. The 3 are the gh-ordering negative control, as in #3929. - The test file's case "a finished build of an older launcher (no stamp), git failing at the checkout" now requires a line that PowerShell's parser reads as `git config --global --add safe.directory <the folder>`, and none of git's lines after its first. The case loop captures each line whole (`Out-String -Width 4096`); Out-String had wrapped a line at the console's width in the VM. - **Real Git for Windows, end to end** (git 2.56.0.windows.4, elevated desktop session; plugin folders `…\John Doe\plugin` and `…\John O'Brien\plugin`, git checkouts owned by `NT AUTHORITY\SYSTEM` through `icacls /setowner`; global config a scratch file; herdr and bun stand-ins for install.ps1, real bun for the launcher). Each command was typed into a fresh shell as printed, through its input: - git's own line for the apostrophe folder: `git config --global --add safe.directory 'C:/…/John O'\''Brien/plugin'`. Pasted into PowerShell 5.1, it **trusts nothing** (global config empty; git still refuses). - install.ps1 `-Ref <commit>` over a working install with no stamp: kept, nothing built, and it printed: ``` Ovis: git does not trust the installed plugin's folder: it belongs to another account (git said: fatal: detected dubious ownership in repository at 'C:/…/John O'Brien/plugin'); OVIS_REF does not move an installed plugin (INSTALL.md, Update) Ovis: to trust the folder, run: git config --global --add safe.directory 'C:/…/John O''Brien/plugin' ``` Pasted into PowerShell 5.1: the global config holds `C:/…/John O'Brien/plugin`, and git reads the commit. The same for `John Doe`. - The launcher (`main(["install"])` in that folder): `CODE 0 STAMP started`, and the four lines above. The PowerShell line pasted into PowerShell 5.1 and the cmd.exe line pasted into cmd.exe (exit 0) each make git read the commit, for both folders. For contrast, the PowerShell line pasted into cmd.exe gives `error: wrong number of arguments, should be 2`, exit 129, and trusts nothing. - **Windows VM, `bun test scripts/plugin-launch.test.ts scripts/server-install.test.ts`**: 25 pass, 24 skip (server-install skips itself on Windows), 0 fail. This includes the distrust test's new cmd.exe half (real git with `GIT_TEST_ASSUME_DIFFERENT_OWNER=1`, `John Doe's plugin`), and the no-git launcher test, which #3929 had not run on Windows. - **Linux, TS tests** (`HERDR_TEST_MODE=unit`, `TMPDIR` under `~/.cache`): `plugin-launch.test.ts`, `server-install.test.ts`, `changelog-fold.test.ts`: 61 pass, 0 fail. `install-star.test.ts`: 48 pass, 0 fail; its git cases also pass with `sh` as dash and as busybox ash. - **Forced before/after**: with main's `install.sh`, `scripts/plugin-launch.ts` and `scripts/server-install.ts` put back in this tree, these new or changed tests fail: - point 4: "says the checkout moved to another commit only where both of git's answers name one"; - point 5: "runs without git on PATH" (its new offline start), the three "starts from source without asking the release, also one out of reach, where …", "builds from source at the build step without asking the release …", and server-install's "takes the binary only for the sources it was built from" (the release was asked); - point 3: install-star's "reads only git's stdout as the prefix and the commit, also where git warns on stderr while it answers". Main said no commit, because the warning was read as a prefix. - "still asks the release where git ties the sources, and fails when it is out of reach" passes at both: a guard that the change does not reach that state. - `sh -n` and `dash -n install.sh`: OK. - `bun run check fast` through heavy-run on this head: exit 0, slot 12, 503 s, unit 17594 pass, 0 fail, 54 skip; the tree untouched while it ran. - The VM's `pr-check.ps1` at each head: in a PR comment. **Not run:** macOS; `bun run check full`; a translating git; a warning before git's ownership line (see faults); shellcheck and PSScriptAnalyzer.
…se is out of reach, and prints its build command quoted for any path (#3950) Follow-up to #3940 (merge a81ec59) and #3944 (fccc9c4), in `install.ps1` and `scripts/windows-install.test.ps1`, plus a changelog fragment. Nothing in `scripts/plugin*.ts`. ## 1. The repair with the release out of reach: what it did, and the fix Since #3940 the launcher's `stop` reaches the checkout's own `scripts/plugin.ts` when no checked binary can be had, also when the release cannot be reached. install.ps1's repair (a branch rerun with `OVIS_REF` whose checkout is not built from its own sources) sends its stop through the launcher whenever a release binary is kept in `.ovis\server\bin`. So in one state the repair now stops a running server where it used to refuse. That state: the kept binary is one the launcher does not run without the release (another version's, or this version's failing its check), the release cannot be reached, and the packages load the stop. Run in the Windows VM with the test file's stand-ins (herdr, bun, the release) and real git, at main (fccc9c4): - **(a) Step by step.** The launcher's `stop` goes to the sources and stops the server, and its record is removed. install.ps1 has already removed the from-source marker before the stop. It then runs `OVIS_FROM_SOURCE=1 bun <launcher> install`. That build writes the stamp `started` and the marker, then runs `bun install`. - **(b) The build fails offline.** The user is told: `bun failed (exit 1) building the installed branch, and Ovis is stopped. Fix the error above, then run this again with OVIS_REF=feat/windows-install to build it and start Ovis.` The marker is taken back, and the stamp stays `started`. Nothing that is printed starts Ovis again while the release is out of reach: - Herdr's start runs the launcher without a marker, which asks the release. Run for real in the VM, it gives `Ovis: could not install the server of v0.5.4: Unable to connect. Is the computer able to access the url?`, exit 1, and nothing is started. - With a kept binary of this version that fails its check, the message even adds `Until then, herdr plugin action invoke devswha.ovis.start-windows starts the release's binary this checkout ran before.` That start fails in the same way. - Once the release is back, a branch's start meets the `started` stamp and is refused until the rebuild succeeds. - **(c) The old build.** Its files are not removed: real `bun install` with the registry out of reach exits 1 and leaves `node_modules` as it was (`is-number unchanged: True`), and `vite` runs only after `bun install` succeeds. But it is no longer usable through herdr. The marker that sent herdr's start to it is gone, and the stamp says `started`. So a user is left with a stopped Ovis and no working way back until the release can be reached. Before #3940 the launcher's stop exited 1 in this state, and the repair refused with nothing stopped. **The fix: do not stop in that state. The rule: the repair asks the release first whenever the launcher's stop or herdr's later start would have to ask it, that is, whenever the checkout keeps no release binary the launcher runs without the release.** Concretely, before the repair touches anything (the marker included), unless a kept binary passes \`$keptRuns\`, it asks the release for \`v<version>/ovis-server.json\` with \`Save-ReleaseFile\`. \`$keptRuns\` passes for a binary of this version whose executable has the SHA-256 its manifest names, with its client. If the request throws (out of reach, or failing), the repair refuses before anything is stopped or changed, for example: \`The release of version 1.2.3 could not be reached (could not download https://127.0.0.1:1/v1.2.3/ovis-server.json (...)), and this checkout keeps no release binary: Ovis would be stopped for the build, and if the build failed too, herdr could not start it again until the release can be reached. So the branch was not built, and nothing was stopped or changed by this run. Run this again once the release can be reached.\` With a kept binary that does not pass, the reason names that binary's folder instead. When the old id's server was stopped for the move, the refusal says so, with its start (\`$unchanged\`, as the other refusals since #3929). A 404 (a branch's version has no release) is no reason to refuse: the stop and the start go to the sources, as before #3940. What the rule does not tell apart: sources git cannot tie to a release (changes in \`server/\` or \`shared/\` not committed), whose stop and start do not ask the release, are refused offline too. That is on the safe side, since nothing is stopped there either. A kept binary whose hash passes but whose signature no longer verifies is taken as one the launcher runs, because install.ps1 does not check that signature (see the start hint below). Why this and not restarting the old build after a failed one: restarting means starting a server from install.ps1 outside herdr's start, over a build the launcher has already marked \`started\`. Not stopping keeps the server, its marker and its stamp exactly as they were, which is what the user had before #3940. **The start hint after a failed build no longer promises.** install.ps1 checks the kept binary's version, SHA-256 and client, but not its manifest's signature, which the launcher also checks. The launcher has no dry check that says whether it would run the kept binary without the release, and this PR does not invent one. So where \`$keptRuns\` passes, the hint now reads: \`Until then, herdr plugin action invoke devswha.ovis.start-windows may start the release's binary this checkout keeps, if the launcher still accepts it (its signature, which this installer does not check, included).\` It is no longer \`starts the release's binary this checkout ran before\`. On main the hint was given for any kept binary of this version with an executable and a client, a failing hash included. ### States touched Run in the VM with the test file's stand-ins, at main (869ec34), at the first head 2835843 and at this head. Each row has a recorded running server, packages that load the stop, the marker of this version and a finished stamp of an earlier commit. The build fails unless the row says it succeeds. | state (repair) | before #3940 | main | 2835843 | this head | |---|---|---|---|---| | **no kept binary, release out of reach, build failing** | stop to the sources, build, fails: Ovis stopped (the same as main) | launcher \`stop,install 1\`; server record gone, marker gone, stamp \`started\`: \`bun failed (exit 1) building the installed branch, and Ovis is stopped. Fix the error above, then run this again with OVIS_REF=feat/windows-install to build it and start Ovis.\` herdr's start cannot start it offline | the same as main | **refused before the stop**; launcher not called; server record, marker and stamp \`1.2.3 <commit>\` as they were | | **no kept binary, release out of reach, build succeeding** | stop, build, start | \`stop,install 1\`; built, herdr's start invoked (\`herdr start: True\`) | the same as main | **refused before the stop**, as above (the installer cannot know the build would succeed offline) | | **the same with the old id installed (its server stopped for the move), build failing** | stop, build, fails | \`stop,install 1\`, "...and Ovis is stopped... The server of the old id was stopped for the move as well: herdr plugin action invoke devswha.herdr-web-ui.start-windows starts it again." | the same as main | refused before this checkout's stop; the message ends "So the branch was not built, and nothing of the installed plugin was changed by this run, but the server of the old id was stopped for the move: herdr plugin action invoke devswha.herdr-web-ui.start-windows starts it again." | | kept binary of another version, release out of reach | refused (stop exit 1), nothing stopped | stops, builds; a failed build leaves Ovis stopped, unstartable offline | refused before the stop | refused before the stop | | kept binary of this version failing its hash, release out of reach | refused, nothing stopped | the same as above, plus a start hint that does not work | refused before the stop | refused before the stop | | either of these, or no kept binary, release out of reach, packages that do not load the stop | stop fails or cannot run; refused ("remove that folder"), or built where nothing ran | the same | refused before the stop (kept binary only) | refused before the stop; the marker is kept | | kept binary that passes \`$keptRuns\`, release out of reach, failed build | stop through the binary, build | the same, with "starts the release's binary" | the same | the same, with "may start ..., if the launcher still accepts it" | | release in reach (a 404 included), any kept binary or none | stop, build | the same | the same | the same; the release is asked once first | | any state refused before the repair (another ref, git failing or distrusting, no commit, GitHub out of reach for a branch) | unchanged | unchanged | unchanged | unchanged (the probe comes after those refusals) | ## 2. Quoting in printed commands The rebuild command after a build during which the version moved put the launcher's path in single quotes without doubling an apostrophe. Pasted for `C:\Users\John O'Brien\...` into Windows PowerShell 5.1 (VM), main's line `$env:OVIS_FROM_SOURCE = '1'; bun 'C:\...\John O'Brien\herdr plugin\scripts\plugin-launch.ts' install` ran nothing: the string never closes. This PR's line, `... bun 'C:\...\John O''Brien\herdr plugin\scripts\plugin-launch.ts' install`, pasted the same way, ran `C:\...\John O'Brien\herdr plugin\scripts\plugin-launch.ts install with OVIS_FROM_SOURCE=1`. That run used a stand-in launcher that prints its argv and environment. `Get-BuildCommand` quotes it as `Get-TrustCommand` does. A new case parses its line with PowerShell's parser for paths with a space, with an apostrophe, and with two apostrophes. It requires `OVIS_FROM_SOURCE` set to `1` and `bun <path> install`, with the path as one argument. Every other command install.ps1 prints: | command | verdict | |---|---| | build command in the "git could not read the commit" refusal (`bun '$launcherScript' install`) | same fault: fixed (`Get-BuildCommand`) | | `Get-CimInstance Win32_Process \| Where-Object CommandLine -like '*<root>*'` after a failed build | same fault: apostrophes now doubled, and since the second head the path is passed through `[WildcardPattern]::Escape` first, so brackets in a folder name are not taken as a wildcard (a case runs the repair from `[x] it's a plugin`: at 2835843 the printed pattern `'*...\[x] it''s a plugin*'` does not match that folder; at this head it does, and does not match `x it's a plugin`) | | `git config --global --add safe.directory '<folder>'` | already right (`Get-TrustCommand`) | | `Get-CimInstance Win32_Process -Filter 'ProcessId=<id>'`, `Stop-Process -Id <id>` | a number, no path: fine | | `herdr plugin action invoke <id>.start-windows` / `stop-windows`, `herdr plugin log list` | no path: fine | | `$env:OVIS_FROM_SOURCE = '1'; herdr plugin install devswha/ovis --ref <ref> --yes` | not a path; a ref is printed bare (git refs have no spaces). Left | | `ssh -L <port>:127.0.0.1:<port> <this-pc>` | no path: fine | ## 3. The message as steps The message for a build during which the checkout's version moved now ends `To build it, stop Ovis, build it, then start it:` followed by three lines, one command each. The commands are the stop action, the build command and the start action, as the trust command is printed on a line of its own. The test reads the three lines and parses the middle one. ## Validation This head was run in the Windows VM: Windows 11, Windows PowerShell 5.1, a fresh clone of main 869ec34 under \`%TEMP%\` with this head's files copied in, in the desktop session with \`CI=true\` and \`HERDR_TEST_MODE=unit\` as the job runs it. The command was \`powershell -NoProfile -ExecutionPolicy Bypass -File scripts/windows-install.test.ps1\`: - unpadded (PATH 335 characters): every PASS line, exit 0 (69 s); - PATH padded to 2700 characters: every PASS line, exit 0 (70 s). Counting copy (Assert counts instead of throwing): | install.ps1 | test file | pass | fail | |---|---|---|---| | 2835843 | its own | 247 | 3 | | 2835843 | this head's | 248 | 7 | | this head | this head's | 252 | 3 | In every run, the 3 are the gh ordering negative control's intended failures, which throw in the real file and are caught there. At 2835843 with this head's test, the 4 others fail: the three no-kept-binary rows above, and the bracket hint. At main with this head's test, those fail too, together with the first head's cases, and the run ends at the missing \`Get-BuildCommand\`. Also from the first head, still true: real \`bun install\` with the registry out of reach exits 1 and leaves \`node_modules\` as it was; the real launcher's \`start\` in the state main leaves exits 1 with nothing started; the printed build command pasted into Windows PowerShell 5.1 runs for a path with an apostrophe, where main's line runs nothing. \`bun run check fast\` (through heavy-run.sh) on this tree (main 869ec34 + this PR): exit 0, `unit: 17643 pass, 0 fail, 54 skip in 973 files`, typecheck, build, workflow syntax and generated files ok. (Main has moved to e5c6a8e since; its two commits touch none of these files.). Not run: - a real Ovis server stopped or started by the repair (forbidden on this PC; the stand-ins cover it); - the real launcher's \`stop\`, which this PR does not change; - macOS and Linux, where nothing changes.
Follow-up to #3928 (merged as 3cb83b5). It covers the points both reviews of #3928's last head left (the Codex review's MEDIUM, its table of states, the second reviewer's LOWs and the merge pass's list). It does not change when the installer builds, stops or refuses, except for point 1 (git failing: refused) and point 7 (the launcher without git). Point 1 includes one state that worked before and is now refused until fixed: a folder git does not trust on every call (owned by another account). The refusal names the command that fixes it (the second commit, below).
What changes
The installers and the launcher tell three answers of git apart, by one rule (Codex MEDIUM). For the plugin's folder, git is asked
rev-parse --show-prefix, untranslated (LC_ALL=C):rev-parse HEADis its commit;not a git repository: no checkout, no commit;HEADfailing at the top level): git failed, and nothing is decided on it.Every reader of the installed commit applies it:
install.ps1($installedCommit, now with$gitFailed)install.shref_not_movedOVIS_REFscripts/plugin-launch.tscheckoutCommit(washeadCommit).ovis/server/source-buildstarted, one line on stderr; still exits 0, as when HEAD movesRefusal, not retry, in install.ps1: what fails once (another git holding the repository, security software holding a file) clears at no time a retry could know, and what fails every time (a folder another account owns: git's "dubious ownership", a broken repository) a retry would only hide. The refusal changes nothing and quotes git, and the next run decides by the commit again. The launcher leaves
started(no retry) for the same reason.Other readers of a checkout's commit keep their rule, and each already fails closed:
scripts/plugin-runtime.tsactivePluginScript,server/managed.tsreleaseSupervisor,install.sh's release lookup in theovislauncher (install.sh:324): compareHEADwith thesource_revisionthatserver/updater.tswrote from its owngit rev-parse HEAD. A git failure there picks the checkout's own files, never a saved release. They form one writer–reader pair at the same depth and never read the stamp (as fix(install): install.ps1's refusals name a recovery that works, and the launcher stamps the commit its build started from #3928 said).scripts/server-manifest.tssourceTrees: tree ids of./serverand./shared, not a commit; point 7.rev-parse --disambiguateandgit ls-remote: run only once the commit is known.An unverifiable live record that IS Ovis gets a way out (both refusals that name one: the kept binary's failed stop, and the record check). They now say how to tell what the process is (
Get-CimInstance Win32_Process -Filter 'ProcessId=N' | Select-Object Name, CommandLine), and: if it is Ovis,Stop-Process -Id N; if not, delete that file. The herdr stop action cannot help there: it stops only a server it verifies. A record whose pid another process has taken since (another creation time) keeps "delete that file".Kept binary of this version failing its check, with a hand-started Ovis recorded. Before, the refusal named only the hand-started server ("Stop it … It runs as process N"), which the repair's stop does not touch, and the cause (the binary) showed on the next run. Now the binary comes first (remove
<checkout>\.ovis\server\bin), then the hand-started server (its folder, its process, Stop-Process).The changelog fragment's 120-column line is wrapped, and one sentence added for point 1. A second fragment,
plugin-launch-without-git.md, covers point 7.The
stoppedline install.ps1 reads is pinned (dori's LOW).scripts/plugin-stop-identity.test.ts, which ci.yml also runs on Windows:stopped Ovis (pid N);scripts/plugin.ts stopand throughserver/main.ts plugin stop(the compiled binary's entry): a stdout line startsstopped; a stop with no server says no such line.scripts/plugin.tsnames install.ps1 as their reader.A live record under the legacy id only (both reviewers read it from
runningStateDir): pinned in the Windows test. The repair's stop, toldplugins\devswha.ovis, falls back toplugins\devswha.herdr-web-uiand stops the server; then the build runs. It holds: no finding. The test's stand-in stop now falls back asrunningStateDirdoes, and takes a dead pid as no server.scripts/plugin.test.tsalready pins the real fallback ("stops the server an install started under its old id…").The launcher runs without git on PATH.
sourceTreesexists for one decision: whether this checkout'sserver/andshared/are the sources the release's binary was built from (installServercompares them with the signed manifest, and only when it installs). Without git, that cannot be shown. So it is now a reason (git is not on PATH, so the binaries cannot be tied to their sources), not a thrown ENOENT, and is handled as a folder that is no checkout already is: the release's binary is not taken, and the checkout runs from source, saying why. A binary already installed and verified, the source path's commands,--help: none needs git. A build without git staysstarted(point 1).Second commit: the merge pass's round on fdc464a
a. A folder git distrusts every time (
fatal: detected dubious ownership: the plugin folder belongs to another account, after an install from an elevated prompt, on a network drive or under WSL). This is a working install that #3928 accepted: its launcher read no commit there, stamped<version>, and install.ps1 took it. With the first commit, every rerun with a branch or commitOVIS_REFis refused. The refusal stays (fail-closed), but install.ps1 now recognises git's answer and says the command:git config --global --add safe.directory '<the folder as git names it>'. Once that runs, the next run reads the commit and rebuilds once. The launcher in that folder leavesstarted, and (third commit) says the command on a line of its own. herdr's next plain start still runs that build as it is: a start reads only the marker.b. Both ids installed (Codex MEDIUM). The old id's server is stopped for the move before the current checkout is read, so a refusal after that stop (git failed or distrusts, nested or no checkout, the ref check, GitHub out of reach) no longer says "nothing was stopped or changed". It says the old id's server was stopped for the move and that
herdr plugin action invoke devswha.herdr-web-ui.start-windowsstarts it again. The order stays: moving the checks before that stop would change when the installer stops, which these refusals do not need.c. A record whose pid another process took (another creation time): the advice is "delete that file" whatever that process is. The creation time already shows the record does not name it.
d. Each record's advice says only what is known (one
Get-RecordAdvice):~\.local\statesays the process's command line names the checkout it runs from, which may be another than this one.LC_ALL, answered in the VM: Git for Windows 2.56.0.windows.4 (the one install.ps1 asks for) ships no translations: 0
git.mofiles under its install. On the VM's Korean (ko-KR) Windows,rev-parse --show-prefixin a folder that is no repository saysfatal: not a git repository (or any of the parent directories): .gitin English with no variable, withLANG=de_DE.UTF-8, withLANGUAGE=de, and withLC_ALL=C. A git that does translate and ignoredLC_ALL=Cwould make a nested or non-git folder read as "git failed". That fails closed (refused with git's words) and only on anOVIS_REFrerun that needs a build.Third commit: the merge pass's round on 3877355
safe.directorycommand is one correct PowerShell literal (MEDIUM, both reviewers). Real git prints the folder in its suggested command quoted for a POSIX shell ('…/John Doe/…', and'\''for an apostrophe). install.ps1 captured those quotes and quoted again:''C:/Users/John Doe/…'', which trusts nothing.fatal: detected dubious ownership in repository at '<folder>', where git writes it raw). It prints the command as one PowerShell single-quoted literal ('doubled), withGet-TrustCommand, as the refusal's last line, alone, to copy.What changes
The installers and the launcher tell three answers of git apart, by one rule (Codex MEDIUM). For the plugin's folder, git is asked
rev-parse --show-prefix, untranslated (LC_ALL=C):rev-parse HEADis its commit;not a git repository: no checkout, no commit;HEADfailing at the top level): git failed, and nothing is decided on it.Every reader of the installed commit applies it:
install.ps1($installedCommit, now with$gitFailed)install.shref_not_movedOVIS_REFscripts/plugin-launch.tscheckoutCommit(washeadCommit).ovis/server/source-buildstarted, one line on stderr; still exits 0, as when HEAD movesRefusal, not retry, in install.ps1: what fails once (another git holding the repository, security software holding a file) clears at no time a retry could know, and what fails every time (a folder another account owns: git's "dubious ownership", a broken repository) a retry would only hide. The refusal changes nothing and quotes git, and the next run decides by the commit again. The launcher leaves
started(no retry) for the same reason.Other readers of a checkout's commit keep their rule, and each already fails closed:
scripts/plugin-runtime.tsactivePluginScript,server/managed.tsreleaseSupervisor,install.sh's release lookup in theovislauncher (install.sh:324): compareHEADwith thesource_revisionthatserver/updater.tswrote from its owngit rev-parse HEAD. A git failure there picks the checkout's own files, never a saved release. They form one writer–reader pair at the same depth and never read the stamp (as fix(install): install.ps1's refusals name a recovery that works, and the launcher stamps the commit its build started from #3928 said).scripts/server-manifest.tssourceTrees: tree ids of./serverand./shared, not a commit; point 7.rev-parse --disambiguateandgit ls-remote: run only once the commit is known.An unverifiable live record that IS Ovis gets a way out (both refusals that name one: the kept binary's failed stop, and the record check). They now say how to tell what the process is (
Get-CimInstance Win32_Process -Filter 'ProcessId=N' | Select-Object Name, CommandLine), and: if it is Ovis,Stop-Process -Id N; if not, delete that file. The herdr stop action cannot help there: it stops only a server it verifies. A record whose pid another process has taken since (another creation time) keeps "delete that file".Kept binary of this version failing its check, with a hand-started Ovis recorded. Before, the refusal named only the hand-started server ("Stop it … It runs as process N"), which the repair's stop does not touch, and the cause (the binary) showed on the next run. Now the binary comes first (remove
<checkout>\.ovis\server\bin), then the hand-started server (its folder, its process, Stop-Process).The changelog fragment's 120-column line is wrapped, and one sentence added for point 1. A second fragment,
plugin-launch-without-git.md, covers point 7.The
stoppedline install.ps1 reads is pinned (dori's LOW).scripts/plugin-stop-identity.test.ts, which ci.yml also runs on Windows:stopped Ovis (pid N);scripts/plugin.ts stopand throughserver/main.ts plugin stop(the compiled binary's entry): a stdout line startsstopped; a stop with no server says no such line.scripts/plugin.tsnames install.ps1 as their reader.A live record under the legacy id only (both reviewers read it from
runningStateDir): pinned in the Windows test. The repair's stop, toldplugins\devswha.ovis, falls back toplugins\devswha.herdr-web-uiand stops the server; then the build runs. It holds: no finding. The test's stand-in stop now falls back asrunningStateDirdoes, and takes a dead pid as no server.scripts/plugin.test.tsalready pins the real fallback ("stops the server an install started under its old id…").The launcher runs without git on PATH.
sourceTreesexists for one decision: whether this checkout'sserver/andshared/are the sources the release's binary was built from (installServercompares them with the signed manifest, and only when it installs). Without git, that cannot be shown. So it is now a reason (git is not on PATH, so the binaries cannot be tied to their sources), not a thrown ENOENT, and is handled as a folder that is no checkout already is: the release's binary is not taken, and the checkout runs from source, saying why. A binary already installed and verified, the source path's commands,--help: none needs git. A build without git staysstarted(point 1).Second commit: the merge pass's round on fdc464a
a. A folder git distrusts every time (
fatal: detected dubious ownership: the plugin folder belongs to another account, after an install from an elevated prompt, on a network drive or under WSL). This is a working install that #3928 accepted: its launcher read no commit there, stamped<version>, and install.ps1 took it. With the first commit, every rerun with a branch or commitOVIS_REFis refused. The refusal stays (fail-closed), but install.ps1 now recognises git's answer and says the command:git config --global --add safe.directory '<the folder as git names it>'. Once that runs, the next run reads the commit and rebuilds once. The launcher in that folder leavesstarted, and (third commit) says the command on a line of its own. herdr's next plain start still runs that build as it is: a start reads only the marker.b. Both ids installed (Codex MEDIUM). The old id's server is stopped for the move before the current checkout is read, so a refusal after that stop (git failed or distrusts, nested or no checkout, the ref check, GitHub out of reach) no longer says "nothing was stopped or changed". It says the old id's server was stopped for the move and that
herdr plugin action invoke devswha.herdr-web-ui.start-windowsstarts it again. The order stays: moving the checks before that stop would change when the installer stops, which these refusals do not need.c. A record whose pid another process took (another creation time): the advice is "delete that file" whatever that process is. The creation time already shows the record does not name it.
d. Each record's advice says only what is known (one
Get-RecordAdvice):~\.local\statesays the process's command line names the checkout it runs from, which may be another than this one.LC_ALL, answered in the VM: Git for Windows 2.56.0.windows.4 (the one install.ps1 asks for) ships no translations: 0
git.mofiles under its install. On the VM's Korean (ko-KR) Windows,rev-parse --show-prefixin a folder that is no repository saysfatal: not a git repository (or any of the parent directories): .gitin English with no variable, withLANG=de_DE.UTF-8, withLANGUAGE=de, and withLC_ALL=C. A git that does translate and ignoredLC_ALL=Cwould make a nested or non-git folder read as "git failed". That fails closed (refused with git's words) and only on anOVIS_REFrerun that needs a build., in install.ps1 and the launcher (install.sh matches no ownership). A missing folder named "dubious ownership" (
fatal: cannot change to …) is a plain git failure.3. A reused record: "whose creation time differs from the one recorded for the server", not "started after".
4. The old id's server stopped for the move is now said, with
herdr plugin action invoke devswha.herdr-web-ui.start-windows, by the refusals after this checkout's own stop too: a failed binary stop, a recorded running server, a failed build. It is said only where that stop printedstopped.Real Git for Windows, end to end, in the VM (git 2.56.0.windows.4, elevated desktop session, Windows PowerShell 5.1). The plugin folder is
…\John O'Brien\plugin, a git checkout with a working install (marker and<version>stamp, packages and client present), owned byNT AUTHORITY\SYSTEM(icacls /setowner). install.ps1 is this commit's; herdr and bun are stand-ins; git is real, with its global config in a scratch file (GIT_CONFIG_GLOBAL). Git's lines, as the installer asks (LC_ALL=C git -C <folder> rev-parse --show-prefix):OVIS_REF=<its commit>: refused, ending with:directory = C:/…/John O'Brien/plugin. (Git's own suggested line,O'\''Brien, would not trust it in PowerShell.)1.2.3 <commit>. Run 3: not refused; "the installed plugin is at commit 15e6909847fe; OVIS_REF does not move an installed plugin".checkoutCommit(real bun) in that folder, trust removed again:trust=git config --global --add safe.directory 'C:/Users/devswha/AppData/Local/Temp/ovis-win-trust-c6a8c8/John O''Brien/plugin'. Run as printed, it makes the nextcheckoutCommitread the commit.States touched
started(or packages/client missing)OVIS_REF, git fails<version>started, line on stderrsourceTrees)startedserver.owner), the process is OvisStop-Process -Id Nif it is Ovis<version>(a working install)OVIS_REFrerun, ending withgit config --global --add safe.directory '<folder>', one PowerShell literal (third commit; a path with a space was mis-quoted before it); once run, the next run rebuilds once. A plain or release-tag install is not affected<version>started; on stderr git's first line and, on a line of its own, the command quoted for the platform's shell; herdr's next start runs the build as it isFaults that remain
startedis still run by the next plain start (HEAD moved, or now git failed), as fix(install): install.ps1's refusals name a recovery that works, and the launcher stamps the commit its build started from #3928 said. install.ps1 says so after its build, and its next run withOVIS_REFrebuilds.started. install.ps1 needs git (it refuses without it) and rebuilds that checkout once on its next run withOVIS_REF. Nothing else reads the stamp.Stop-Processfor an unverifiable record rests on the user's reading ofCommandLine. Nothing recorded can verify it; that is what unverifiable means. The refusal says to check first.plugin-runtime.ts,managed.ts,install.sh:324,updater.ts) readsHEADat any depth, unchanged; see point 1.installServerdownloads the manifest before it looks atsourceTrees' error, so the download failure ends the command with 1. As on main; a follow-up.Validation
Third commit (03707fa), over 3877355:
scripts/windows-install.test.ps1in the Windows VM as ci.yml runs it (Windows PowerShell 5.1,-File,CI=true, desktop session), run before the push: unpadded (PATH 335) every section PASS, exit 0, 55 s; PATH padded to 2703 every section PASS, exit 0, 54 s.Get-TrustCommand, which that install.ps1 lacks. The 4: the three distrust cases (the command does not parse in PowerShell to the folder:''C:/…/herdr plugin with spaces N''), and "a failed build, the old id installed too and its server stopped for the move" (not said).git config --global --add safe.directory <the folder>;Get-TrustCommand, from the installer's own text, gives one argument equal to the folder forC:/Users/John Doe/…,C:/Users/John O'Brien/pluginandC:/it's/a ''quoted'' one;plugin-launch.test.ts(new: a folder namedJohn Doe's plugingit distrusts, by real git withGIT_TEST_ASSUME_DIFFERENT_OWNER=1: the launcher leavesstartedand prints the command on its own stderr line; that command run inshas printed makes git read the commit; a missing folder named "no such dubious ownership folder" is a plain failure, with no command),plugin-stop-identity.test.ts,changelog-fold.test.ts: 36 pass, 0 fail.bun run check fastthrough heavy-run on this commit, untouched while it ran: exit 0, slot 10, 520 s, unit 17587 pass, 0 fail, 54 skip.Second commit (3877355):
Second commit (3877355), over fdc464a:
scripts/windows-install.test.ps1in the Windows VM as ci.yml runs it (Windows PowerShell 5.1,-File,CI=true, desktop session): unpadded (PATH 335) every section PASS, exit 0, 53 s; PATH padded to 2703 every section PASS, exit 0, 52 s.safe.directorycommand);safe.directoryand the folder), and a broken repository (fatal: bad object HEAD) for the generic refusal.lc-probe: Git for Windows 2.56.0.windows.4, 0git.mo, ko-KR, English under every variable).plugin-launch.test.ts,plugin-stop-identity.test.ts,changelog-fold.test.ts: 35 pass, 0 fail (unchanged files, rerun).bun run check fastthrough heavy-run on this commit: exit 0, slot 11, 517 s, unit 17586 pass, 0 fail, 54 skip.First commit (fdc464a):
On fdc464a, over origin/main 3cb83b5 (main had not moved at push).
scripts/windows-install.test.ps1in the Windows VM: Windows PowerShell 5.1, in the VM's desktop session (Invoke-InSession),CI=true,powershell -NoProfile -ExecutionPolicy Bypass -File scripts/windows-install.test.ps1as ci.yml runs it, on this commit's tree:Counts, the whole file, from a scratch copy whose
Assertcounts and goes on, with this commit's test file:The 3 failures in both rows are the gh-ordering negative control, which needs
Assertto throw (an artifact of the counting copy; the real file passes that section). At main, these new cases fail:TS tests (Linux,
HERDR_TEST_MODE=unit,TMPDIRunder~/.cache):plugin-launch.test.ts,plugin-stop-identity.test.ts,server-manifest.test.ts,changelog-fold.test.ts: 62 pass, 0 fail;install-star.test.ts: 47 pass, 0 fail. Run against main's product files in a scratch copy (with a two-line adapter exportingcheckoutCommitfrom main'sheadCommit, only so the file links):stopped Ovischanged toStopped Ovisat both lines ofscripts/plugin.ts, both pinning tests fail.GIT_TEST_ASSUME_DIFFERENT_OWNER=1with an empty global config makes real git answer "detected dubious ownership" at the top level.sh -nanddash -n install.sh: OK.bun run check fastthrough heavy-run (slot 10, 536 s): exit 0, unit 17586 pass, 0 fail, 54 skip.The VM's
pr-check.ps1at each head: in a PR comment.Not run: macOS;
bun run check full; a real Ovis whose record has noserver.ownerstopped by hand in the VM (a test process stands for it); real git refusing a folder in the VM (the Windows test's git stand-in answers "dubious ownership"; the launcher and install.sh run real git on Linux); the launcher without git on Windows; shellcheck and PSScriptAnalyzer.