Skip to content

update: explain the manual Windows update instead of failing on Unix paths - #3

Open
Ahmar004 wants to merge 3 commits into
mainfrom
fix/windows-update-notice
Open

Ahmar004 wants to merge 3 commits into
mainfrom
fix/windows-update-notice

Conversation

@Ahmar004

@Ahmar004 Ahmar004 commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

The problem in one sentence

On Windows the CLI tells you to run proofline update, but that command always fails there, with errors that send you the wrong way, and it never shows the manual update steps the README describes.

Why it happens, step by step

  1. A background check saves the newest version number in a cache file once a day. On the next run in a console window, suggestion() (src/update.rs) prints proofline X is available; run 'proofline update' on every OS.
  2. proofline update calls install(). Its first step, destination(), looks for the Unix installer folder: PROOFLINE_INSTALL_DIR, or else $HOME/.local/bin. A normal Windows PowerShell has no HOME variable, so the command stops with set HOME or PROOFLINE_INSTALL_DIR.
  3. With HOME or PROOFLINE_INSTALL_DIR set, install_path() expects <folder>/proofline, with no .exe. The Windows binary is proofline.exe, so this check can never pass, and the error says the binary is "outside the installer directory", even when that folder is the one holding it.
  4. Past that, target() would say "no official Proofline release is built for windows", which is false: every release ships proofline-x86_64-pc-windows-msvc.tar.gz.
  5. The README ("Windows installation") already says self-update doesn't install Windows binaries and gives the verified manual steps. The CLI never showed them.

Who is affected

Everyone who installed the official Windows release. They see the notice on every interactive command until they update, and the command it names can't help them.

What this PR changes (src/update.rs, ~50 lines)

  • install(): on Windows it now stops first, before any path check or download. It returns an error that lists the README's steps:

    1. Close Proofline.
    2. Download the archive and SHA256SUMS.
    3. Check the hash with Get-FileHash -Algorithm SHA256.
    4. Create an empty folder (mkdir proofline-new, another name if it already exists).
    5. Extract into it (tar -xzf … -C proofline-new), so an interrupted extract can't damage the installed copy.
    6. Only then replace this binary, whose path comes from current_exe(). If the path can't be read, the step says to find it with (Get-Command proofline).Source.

    The exit status stays non-zero because nothing was updated, so a script doesn't think the update worked.

  • Which download links: the notice's version comes from https://proofline.sh/cli/latest, and release.yml publishes that file before GitHub marks the release as latest. If the local update cache holds a newer version (the one the notice showed), the steps link to that version's pinned files, https://proofline.sh/cli/download/<version>/…, the same files the Unix updater verifies. Otherwise they point to the GitHub releases/latest page and print this binary's version, with "stop if that release is not newer", so nobody downgrades by accident. The cached value has already passed version() (only digits and dots) before it goes into a URL.

  • notice(): the notice text moved into a small function. On Windows it reads proofline X is available; 'proofline update' shows how to install it. On Linux and macOS it is the same text as before.

  • windows_steps(): builds the steps text. It is a plain function, so its test runs on Linux CI too.

  • Linux and macOS behave exactly as before. destination(), install_path() and target() are unchanged.

Why not the obvious alternatives

  • Real Windows self-update. Windows can't overwrite a running .exe, so this needs a rename-aside step, cleanup on the next start, and zip/tar handling. That's a feature with its own risks, and the README says self-update doesn't install Windows binaries, so it should be the maintainer's call (offered in the issue).
  • Fixing only the notice. Users who already run proofline update would still get the misleading errors.
  • Looking up the latest version over the network first. The cached version already names the release the notice announced, so a network call would only add a failure point to a command that prints steps, and the tests would no longer run offline.

How I tested it (Windows 11, Rust 1.100.0)

Reproduced first on main (105f387), with proofline.exe copied into a folder as the README says:

Setup main this PR
plain PowerShell (no HOME) set HOME or PROOFLINE_INSTALL_DIR the 6 manual steps with this binary's path and version, exit 1
cache says 9.0.0 (same error) steps link to https://proofline.sh/cli/download/9.0.0/…, exit 1
HOME=%USERPROFILE% …outside the installer directory C:\Users\…\.local/bin… same steps, exit 1
PROOFLINE_INSTALL_DIR=<the folder holding proofline.exe> …outside the installer directory <that same folder>… same steps, exit 1
notice in a real console window (cache says 9.0.0) proofline 9.0.0 is available; run 'proofline update' proofline 9.0.0 is available; 'proofline update' shows how to install it

The notice only appears when both output streams are a console, so I ran the binary in a new PowerShell window and read its screen buffer ($host.UI.RawUI.GetBufferContents).

The printed steps work: I followed them for v0.5.2 from both sources, GitHub releases/latest and the pinned https://proofline.sh/cli/download/0.5.2/…. Get-FileHash gave e5631d11…500a, which matches its line in SHA256SUMS. mkdir proofline-new then tar -xzf … -C proofline-new exited 0, and proofline-new\proofline.exe --version prints proofline 0.5.2.

New tests, written before the fix:

  • tests/update.rs::windows_update_explains_the_manual_steps (Windows only): runs the real binary from a README-style folder, with and without HOME, and with a cached newer version. It checks that the update fails, prints nothing on stdout, names the right download links, SHA256SUMS, Get-FileHash, the new-folder extract and the binary's own path, never shows the old set HOME or PROOFLINE_INSTALL_DIR / "outside the installer directory" errors, and leaves the binary untouched. Fails on main (…missing from proofline: set HOME or PROOFLINE_INSTALL_DIR), passes now.
  • src/update/tests.rs::windows_notices_point_to_the_manual_steps (every OS): checks both notice texts (the Unix one is unchanged), that suggestion() picks the wording of the platform it runs on, and the steps with and without a known path and version. Mutation check: hard-coding the Unix wording in suggestion() makes it fail.
  • detached_discovery… now expects the platform's notice text after the refresh, and no notice of any version before it. It times out on Windows because of the pipe issue that Windows: don't make scripts wait for the background update check prooflinedev/cli#79 fixes. With Windows: don't make scripts wait for the background update check prooflinedev/cli#79 merged into a throwaway branch, all of update::tests (9/9) passes on Windows.
  • The existing cached_update_preserves_schema_help_and_source_installation still passes. On Windows the update still fails, prints nothing on stdout and leaves the files untouched.

Whole suite: cargo fmt --check clean. cargo test --locked --no-fail-fast gives the same 8 failures on main and on this branch, none of them about the update command's output: tests/mcp.rs (5), tests/agent_install.rs, tests/local_patch.rs and update::tests::detached_discovery… (the Windows pipe issue fixed in prooflinedev#79). cargo clippy --all-targets reports the same 3 errors as on main, all in src/agent/tests.rs, which this PR doesn't touch.

…paths

On Windows the update notice said "run 'proofline update'", but that
command could never work there. It looked for the Unix installer folder
($HOME/.local/bin or PROOFLINE_INSTALL_DIR) and a binary called
"proofline" without ".exe". So it failed with "set HOME or
PROOFLINE_INSTALL_DIR", or with "this binary is outside the installer
directory", even when PROOFLINE_INSTALL_DIR was the folder holding
proofline.exe. It never showed the manual steps from the README.

On Windows, install() now stops before any path check or download. It
returns an error that lists the README's steps: close Proofline,
download proofline-x86_64-pc-windows-msvc.tar.gz and SHA256SUMS from
the latest GitHub release, check the hash with Get-FileHash, extract
the archive and replace this binary (its path is printed). The exit
status stays non-zero because nothing was updated. The Windows notice
now says "'proofline update' shows how to install it". Linux and macOS
behave exactly as before.

Tests: windows_update_explains_the_manual_steps (tests/update.rs,
Windows only, runs the real binary from a README-style folder with and
without HOME) fails on main and passes now.
windows_notices_point_to_the_manual_steps (src/update/tests.rs, runs on
every OS) checks both notice texts and the steps.

@prooflinedev prooflinedev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proofline has 7 new findings to review.

View full review in Proofline

Comment thread src/update.rs Outdated
fn windows_steps(executable: Option<&Path>) -> String {
const ARCHIVE: &str = "proofline-x86_64-pc-windows-msvc.tar.gz";
let executable = executable.map_or_else(
|| "proofline.exe".to_owned(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serious · Windows update instructions can overwrite the installed executable

The Windows update command tells users to extract a root-level proofline.exe into the current directory, overwriting the installed copy if run from its directory.

Interrupted extraction can leave the installed proofline.exe unusable before the replacement step.

Direct users to extract into a fresh staging directory, then replace the installed executable only after extraction succeeds.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 92a28dd. You're right: tar -xzf writes proofline.exe into the current folder, so running it next to the installed copy overwrote it, and an interrupted extract left it broken. Step 4 now extracts into a new folder (mkdir proofline-new; tar -xzf ... -C proofline-new), and step 5 replaces the installed binary only if that succeeded. I followed the new steps on Windows 11 with v0.5.2: the hash matched SHA256SUMS, tar exited 0, and proofline-new\proofline.exe --version prints proofline 0.5.2.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked fixed.

Comment thread src/update.rs
Comment on lines 143 to +146
.latest
.as_ref()
.filter(|latest| newer(latest))
.map(|latest| format!("proofline {latest} is available; run 'proofline update'"))
.map(|latest| notice(latest, cfg!(target_os = "windows")))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Detached discovery test fails on Windows

The test still requires Unix-only wording after this change gives Windows a different update notice.

On Windows, the test panics after the refreshed cache yields the expected update notice.

Check for the platform-independent version announcement both before and after the cache refresh.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 92a28dd. Correct: the assertion at src/update/tests.rs:358 still wanted the Unix text. On this machine the C-1 pipe timeout (fixed in prooflinedev#79) currently hides it. Both checks now use the platform's text (notice("9.0.0", cfg!(target_os = "windows")) after the refresh, and the platform-independent proofline 9.0.0 is available; before it). Verified by merging prooflinedev#79's branch into a throwaway branch: update::tests 9/9 pass on Windows.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked fixed.

Comment thread src/update.rs Outdated
fn windows_steps(executable: Option<&Path>) -> String {
const ARCHIVE: &str = "proofline-x86_64-pc-windows-msvc.tar.gz";
let executable = executable.map_or_else(
|| "proofline.exe".to_owned(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Windows update instructions omit the replacement path on lookup failure

When current_exe() fails, proofline update tells users to replace proofline.exe with the extracted proofline.exe without identifying the installed copy.

Users may replace the wrong copy and leave their installation unchanged.

Say the installed path could not be detected and explain how to locate the executable they launched before replacing it.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 92a28dd. When current_exe() fails, step 5 now says replace the proofline.exe you ran (find it with '(Get-Command proofline).Source'). A unit test covers it (windows_steps(None, None)).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked fixed.

Comment thread src/update.rs
Comment on lines 143 to +146
.latest
.as_ref()
.filter(|latest| newer(latest))
.map(|latest| format!("proofline {latest} is available; run 'proofline update'"))
.map(|latest| notice(latest, cfg!(target_os = "windows")))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Windows update link can serve an older release than the notice

The Windows notice advertises the discovery version, but proofline update links to GitHub’s independently promoted latest release. The workflow advances discovery before promoting the GitHub release.

Users can verify and reinstall an older binary without getting the advertised update.

Link to version-pinned downloads for the advertised release, or tell users to confirm the release version before replacing their binary.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 92a28dd. Confirmed in release.yml: publish-r2.sh uploads latest (what the notice reads) before gh release edit --latest, so releases/latest can still show the old version for a while. install() on Windows now reads the local update cache, the same value the notice showed. When that is a newer version, the steps link to that version's pinned files, https://proofline.sh/cli/download/<version>/... (the files the Unix updater verifies). These exist before GitHub promotes the release. The value has already passed version() via newer(), so it is only digits and dots. Without a cached newer version, the GitHub page stays as the fallback. Still no network call, so the tests stay offline. The integration test now covers both cases.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked fixed.

Comment thread tests/update.rs
// `update` must explain those steps instead of failing on Unix installer paths.
#[cfg(windows)]
#[test]
fn windows_update_explains_the_manual_steps() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · PR checks skip the Windows update integration test

The Ubuntu test job excludes windows_update_explains_the_manual_steps, and the Windows job runs neither the test nor proofline update.

Removing the Windows early return can leave PR checks green while Windows users get installer errors instead of manual update instructions.

Run cargo test --locked --test update windows_update_explains_the_manual_steps in the Windows job.

Details

The helper test checks the instruction text directly, so it still passes if install stops calling windows_steps.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partly agree, no change in this PR. It's true that CI never runs cargo test on Windows, and the test is #[cfg(windows)], so Ubuntu never compiles it. But the README asks outside contributors to open an issue for workflow changes, not a PR. I'll raise it in a separate CI issue, together with the other Windows-only failures (C-1, the mcp SYSTEMROOT tests). On your detail: the integration test runs the real binary, so on Windows it does fail if install stops calling windows_steps. I ran it locally (RED on main, GREEN here). It just isn't run by CI yet.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proofline recorded no decision on this finding. To record one, reply with only fixed, dismiss, accept risk or confirm.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accept risk

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted as a risk.

Comment thread src/update.rs
Comment on lines 143 to +146
.latest
.as_ref()
.filter(|latest| newer(latest))
.map(|latest| format!("proofline {latest} is available; run 'proofline update'"))
.map(|latest| notice(latest, cfg!(target_os = "windows")))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Notice tests miss Windows falling back to Unix wording

The new tests call notice directly, while the cached-discovery fixture expects Unix wording even on Windows.

The tests would pass if suggestion always selected Unix wording.

Assert platform-specific wording from the cached invocation and run that test on Windows.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 92a28dd. windows_notices_point_to_the_manual_steps now also asserts suggestion(&cache, ["status"], true) == notice("9.0.0", cfg!(target_os = "windows")). Mutation check on Windows: hard-coding notice(latest, false) in suggestion makes the test fail at src/update/tests.rs:218. The cached-discovery test checks the platform text as well (see the other thread).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked fixed.

Comment thread tests/update.rs
.arg("update")
.env("PROOFLINE_NO_UPDATE_CHECK", "1")
.env("LOCALAPPDATA", directory.path())
.env_remove("PROOFLINE_INSTALL_DIR")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Windows update test fails when the temporary path contains HOME

The test requires stderr to include the executable path but rejects any occurrence of HOME, including within that path.

Correct manual update instructions fail the test under a temporary directory containing HOME.

Check for the specific installer diagnostic set HOME or PROOFLINE_INSTALL_DIR instead.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 92a28dd. The check is now !stderr.contains("set HOME or PROOFLINE_INSTALL_DIR"), the exact old error, so a temporary path containing HOME can't make it fail.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked fixed.

…fely

Proofline review, round 1:
- Extracting with 'tar -xzf' in the current folder could overwrite the
  installed proofline.exe (and leave it broken if interrupted). The steps
  now extract into a new 'proofline-new' folder and replace the binary
  only after that succeeded.
- The notice's version comes from https://proofline.sh/cli/latest, which
  the release workflow publishes before GitHub marks the release as
  latest, so 'releases/latest' could still be the old version. When the
  local cache holds the newer version the notice showed, the steps now
  link to that version's pinned downloads on proofline.sh (the same
  files the Unix updater verifies). Still no network call.
- When the binary's own path can't be read, the steps say how to find
  it: '(Get-Command proofline).Source'.
- Tests: the cached-discovery test now accepts the Windows wording; a
  new assertion checks that suggestion() picks the platform's wording;
  the Windows integration test also covers the pinned links and checks
  for the exact old error instead of any "HOME".

@prooflinedev prooflinedev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proofline has 2 new findings to review.

View full review in Proofline

Comment thread src/update.rs Outdated
2. Download {download}\n \
3. Run 'Get-FileHash -Algorithm SHA256 {ARCHIVE}' and check that the hash matches the archive's line in SHA256SUMS.\n \
4. Extract it into a new folder: 'mkdir proofline-new; tar -xzf {ARCHIVE} -C proofline-new'.\n \
5. Only if that succeeded, replace {executable} with proofline-new\\proofline.exe."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serious · Windows update extraction can overwrite an existing staged executable

Step 4 uses a fixed staging directory and runs tar even if mkdir reports that the directory already exists.

Following the instructions can overwrite an existing proofline-new\proofline.exe before step 5.

Create a unique staging directory and extract only after its creation succeeds.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in af2f6b2. Right: in PowerShell ; runs tar even when mkdir failed because the folder exists. The overwritten file was only a staged copy, never the installed binary, but an old staged copy could still be reused. Creating the empty folder is now its own step (mkdir proofline-new, choose another name if it already exists), and extracting is the next step. A name that changes on every run would be harder to type and to explain in one line.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked fixed.

Comment thread src/update.rs Outdated
Comment on lines +163 to +166
let download = latest.map_or_else(
|| {
format!(
"{ARCHIVE} and SHA256SUMS from https://github.com/prooflinedev/cli/releases/latest"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Windows manual update can downgrade Proofline

Without a newer cached version, proofline update points Windows users to GitHub’s latest release and tells them to replace the executable without checking the release version.

Following the steps can replace a newer installed binary with a checksum-verified older one.

Tell users to compare the release version with proofline --version and stop unless the release is newer.

Details

The release workflow publishes versioned artifacts before promoting the GitHub release, so a user can already be running a newer version when the fallback points to the previous release.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in af2f6b2. Correct: without a cached newer version, this binary may already be the newest one. The GitHub fallback now says (stop if that release is not newer than this proofline 0.5.2), with the running version from CARGO_PKG_VERSION. The unit test checks it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked fixed.

@prooflinedev prooflinedev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proofline has 3 more findings to review, 5 in this review run.

View full review in Proofline

Comment thread src/update.rs
Comment on lines +146 to +149
.map(|latest| notice(latest, cfg!(target_os = "windows")))
}

fn notice(latest: &str, windows: bool) -> String {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · CI misses regressions to Unix-only update notices on Windows

The routing assertions use the test runner’s platform. Only Ubuntu runs them in CI; the Windows smoke job never checks a cached update notice.

CI stays green if suggestion() always selects Unix wording.

Run windows_notices_point_to_the_manual_steps in the Windows CI job.

A person accepted this risk earlier. It is posted again because it cites new evidence: src/update/tests.rs lines 213–221 (not cited before).

View finding in Proofline

Also at:

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accept risk

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted as a risk.

Comment thread src/update/tests.rs Outdated
Comment on lines +344 to +347
assert!(
!String::from_utf8(output.stdout)
.unwrap()
.contains("run 'proofline update'")
.contains("proofline 9.0.0 is available;")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Discovery test misses premature notices for other versions

The pre-refresh assertion only rejects notices for 9.0.0, so a notice for a fallback version can slip through while the cache still has no version.

The test can pass even if users see an update notice before discovery finishes.

Reject notice lines matching the shared proofline <version> is available; format for any version.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in af2f6b2. The pre-refresh check now rejects any line with is available;, the text every notice shares, not only 9.0.0. With prooflinedev#79 merged locally, update::tests is 9/9 on Windows.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked fixed.

Comment thread tests/update.rs
// `update` must explain those steps instead of failing on Unix installer paths.
#[cfg(windows)]
#[test]
fn windows_update_explains_the_manual_steps() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · PR checks skip the Windows update regression test

Ubuntu excludes the Windows-only integration test, and Windows CI only builds and smoke-tests unrelated commands.

Removing the Windows early return from install() would leave PR checks green for both cached and uncached updates.

Run cargo test --locked --target x86_64-pc-windows-msvc --test update windows_update_explains_the_manual_steps in the Windows job.

View finding in Proofline

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accept risk

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted as a risk.

Proofline review, round 2:
- Without a cached newer version, the steps point to GitHub's latest
  release, which may not be newer than the running binary. They now
  print this binary's version and say to stop if the release isn't
  newer.
- In PowerShell, 'mkdir proofline-new; tar ...' runs tar even when
  mkdir failed because the folder exists, so an older staged copy could
  be reused. Creating the empty folder is now its own step (pick another
  name if it exists), before extracting.
- The cached-discovery test now rejects any "is available;" notice
  before the refresh, not only one for 9.0.0.
@Ahmar004

Copy link
Copy Markdown
Owner Author

On the two CI findings (accept risk): CI never running cargo test on Windows is real, and it is why these tests, C-1 (prooflinedev#79) and the mcp tests' SYSTEMROOT issue went unnoticed. The README asks outside contributors to open an issue for workflow changes, so I'll raise it there instead of editing .github/workflows in this PR. I ran both Windows tests locally (the integration test is RED on main, GREEN here), and a mutation check shows the unit test catches suggestion() always using the Unix wording.

@prooflinedev prooflinedev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proofline has 3 new findings to review.

View full review in Proofline

Comment thread src/update.rs
Comment on lines +186 to +188
4. Create an empty folder with 'mkdir proofline-new' (choose another name if it already exists).\n \
5. Extract into it with 'tar -xzf {ARCHIVE} -C proofline-new'.\n \
6. Only if that succeeded, replace {executable} with proofline-new\\proofline.exe."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serious · Windows update can overwrite files in the existing staging folder

Step 4 tells users to choose another folder if proofline-new exists, but steps 5 and 6 still use proofline-new.

Copying the printed tar command can overwrite files in the existing folder and leave the new folder unused.

Store the chosen folder in a PowerShell variable and use it for both extraction and the replacement source.

View finding in Proofline

Comment thread src/update.rs
|| {
// No newer version is known, so this may already be the newest one.
format!(
"{ARCHIVE} and SHA256SUMS from https://github.com/prooflinedev/cli/releases/latest \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Windows update steps can reinstall an older release

If a browser renames duplicate downloads, the Windows guide still hashes and extracts the unsuffixed archive and checks the unsuffixed SHA256SUMS.

An older matching pair can pass verification and install the older executable even with an empty extraction folder.

Download both files into a fresh directory and use those exact paths for verification and extraction.

View finding in Proofline

Comment thread src/update.rs
Comment on lines +161 to +164
fn windows_steps(executable: Option<&Path>, latest: Option<&str>) -> String {
const ARCHIVE: &str = "proofline-x86_64-pc-windows-msvc.tar.gz";
let download = latest.map_or_else(
|| {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Windows update recommends an unusable executable on 32-bit Windows

On 32-bit Windows, proofline update tells users to replace a working source build with the x86-64 release without checking OS compatibility.

Users who follow the guide can no longer run proofline until they restore a compatible build.

Recommend the archive only when Windows can run it; otherwise direct users to rebuild from source.

View finding in Proofline

@prooflinedev prooflinedev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proofline has 4 more findings to review, 7 in this review run.

View full review in Proofline

Comment thread src/update.rs
Comment on lines +186 to +187
4. Create an empty folder with 'mkdir proofline-new' (choose another name if it already exists).\n \
5. Extract into it with 'tar -xzf {ARCHIVE} -C proofline-new'.\n \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Windows update tests miss regressions that reuse a staging folder

The unit test checks mkdir and tar independently, and the CLI test checks only the extraction destination.

Both tests still pass if the collision warning disappears or directory creation and extraction become one unconditional command.

Assert that the guidance requires an empty folder, tells users to choose another name on collision, and puts extraction in a separate subsequent step.

View finding in Proofline

Comment thread tests/update.rs
Comment on lines +65 to +68
let cache = directory.path().join("proofline").join("update.json");
std::fs::create_dir_all(cache.parent().unwrap()).unwrap();
let checked = SystemTime::now()
.duration_since(UNIX_EPOCH)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Windows update tests miss stale cached versions

The CLI fixture tests only a missing cache or a newer version, and the helper test bypasses install(). Both would pass without the newer filter.

Windows update could recommend an older or equal release without the version warning, and these tests would still pass.

Add a CLI case caching the running version and assert that stderr gives the fallback URL and version warning, not a pinned download.

View finding in Proofline

Comment thread src/update/tests.rs
Comment on lines 374 to +377
assert!(
String::from_utf8(output.stdout)
.unwrap()
.contains("run 'proofline update'")
.contains(&notice("9.0.0", cfg!(target_os = "windows")))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Tests miss a Windows notice that promises automatic updates

The discovery test uses notice() to generate its expected text, and the wording test checks only fragments that stop short of the installation guidance.

Both tests can pass if the Windows notice incorrectly promises automatic installation.

Assert the full Windows notice against a fixed expected string, independent of notice().

View finding in Proofline

Comment thread tests/update.rs
Comment on lines +73 to +76
for (home, cached, download) in [
(
None,
false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning · Windows update test misses downgrade guidance from an older cache

The Windows CLI test covers an empty cache and a newer cached release, so removing the newer() filter leaves both outcomes unchanged.

The test would still pass if proofline update offered pinned download links for an older cached release.

Seed an older cached version and assert that stderr shows the guarded fallback and no pinned links for that version.

View finding in Proofline

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