Repository navigation
Support update notifications on Windows - #561
Yu-Ming-Chang wants to merge 1 commit into
Conversation
ColtenOuO
left a comment
There was a problem hiding this comment.
"close" is a keyword in GitHub that will automatically close the linked issue.
Additionally, please add a test to ensure everything works as expected.
ColtenOuO
left a comment
There was a problem hiding this comment.
Please squash your commits.
f1a9d9a to
bdcaf82
Compare
jserv
left a comment
There was a problem hiding this comment.
Improve English writing in comment messages. Check https://cbea.ms/git-commit/ carefully.
jserv
left a comment
There was a problem hiding this comment.
Don't put your prompts in git commit messages:
Add a test to verify that the update check requires the setting to be enabled, a supported platform, and a non-empty CI commit.
Always check your work seriously, as everything you did is public.
bdcaf82 to
5053a6e
Compare
Thank you for pointing this out. I've amended the commit message to remove the test-description text and keep it focused on the purpose of the change. |
Make sure you have carefully read https://cbea.ms/git-commit/ and applied its guidance to draft clear, meaningful commit messages: Use the body to explain what and why, not how. |
5053a6e to
2048228
Compare
|
Let's revisit the commit message:
It does not clearly explain the motivation for the code changes ("why"), the scope of in-application notifications, or how the update check works ("what"). You must conclude your work with a meaningful Git commit message that explains the changes and their purpose. Even when AI tools generate most of the code, you remain responsible for the changes. |
2048228 to
40a9321
Compare
Thank you for the feedback. I've revisited the commit message and revised it to explain the motivation for the change and its scope. The updated message clarifies that the existing update notification feature was previously limited to macOS, that the change extends support to Windows CLI users, and that the opt-in behavior is preserved. |
Don't pretend you have carefully read https://cbea.ms/git-commit/ . Once you have read it thoroughly applied human judgment, you should be able to write much more effective commit messages. Be honest with yourself. Don't settle for being just an operator of AI tools. |
jserv
left a comment
There was a problem hiding this comment.
Windows should reuse the existing lobby update notice, preserving the opt-in setting, release-build restriction, and exclusion of desktop releases.
Remove the explicit GITHUB_SHA assignment from the workflow unless you have stronger reasons. GitHub Actions already provides this environment variable to the native Windows build, and build.rs already reads it to populate CODETRIAL_RELEASE_COMMIT. The added assignment does not enable previously missing commit information and should not be presented as doing so.
Add a test that verifies the actual platform selection used by web_server_config. The new test file repeats the existing assertions with renamed terminology. It would still pass if main.rs were reverted to macOS-only support, so it does not demonstrate that Windows is connected to the update-check mechanism. Exercise the shared platform policy for Windows, macOS, and Linux, and verify on a Windows runner that the built executable contains the expected release commit and enables the endpoint when explicitly configured.
Complete the documentation updates. docs/install.md still introduces the setting with "On macOS," while README.md, config/codetrial.env.example, and the module documentation in src/web/update.rs still describe the feature as macOS-only. Update these descriptions consistently and state that the notification appears in the browser lobby for supported prebuilt CLI binaries.
Keep the notification in the existing lobby UI. Native Windows toast notifications would introduce registration and activation behavior beyond this issue’s scope. The notice should show the running and published commits, link to the latest release page, and explain that Windows users must end their interview, close CodeTrial, replace the executable, and preserve their existing config/ directory. Because the implementation compares commit identity rather than commit order, avoid wording that claims a different commit is necessarily newer.
Verify the complete behavior using the existing server and browser test infrastructure: different commits display the notice, matching commits do not, lookup failures leave normal operation unaffected, dismissal suppresses the same release, and returning to the lobby resumes checking. Also verify that leaving the lobby for an interview stops its scheduled checks.
Clarify the interview-related guarantee. The current design ties checking to the lobby page, so another open lobby tab can continue checking while an interview runs elsewhere. If the requirement prohibits checks across all tabs during an active interview, implement shared state and test that behavior. Otherwise, document the guarantee as applying to the tab that enters the interview.
Extend the existing update notification mechanism from macOS to the Windows CLI, allowing Windows users to receive release notifications. Provide the release commit in Windows CI builds so the existing update check can identify the current version and compare it with the latest published release. Update the installation documentation to reflect the expanded platform support. Preserve the opt-in requirement and existing platform and release commit validation checks. See also: sysprog21#543
40a9321 to
d480b1e
Compare
I have updated my commit message based on your suggestions. Please let me know if there are any further issues or improvements needed. |
| if: runner.os != 'Linux' | ||
| env: | ||
| CODETRIAL_GITHUB_CLIENT_ID: ${{ vars.CODETRIAL_GITHUB_CLIENT_ID }} | ||
| GITHUB_SHA: ${{ github.sha }} |
There was a problem hiding this comment.
GitHub Actions already exports GITHUB_SHA to every step on every runner, which is how the macOS leg of this same step has been recording CODETRIAL_RELEASE_COMMIT without this line. The Windows build already had a release commit, so this entry is a no-op and the stated reason for it does not hold. Please drop it. (The Linux leg needs --env GITHUB_SHA only because the build runs inside docker run.)
| published as `desktop-latest`, which this does not read, so it starts its | ||
| server with `--no-update-check`, which turns the setting off over the config | ||
| file. | ||
| Linux, or in a build from source, whose commit the release will never name. |
There was a problem hiding this comment.
This paragraph now drops Windows from the exclusion, but its opening sentence still begins "On macOS, CODETRIAL_UPDATE_CHECK=true in that config file...", so the docs still tell a Windows user the setting is macOS-only. The module doc at the top of src/web/update.rs also still says the check runs only "for a macOS build CI made". Update both to say macOS and Windows.
| published as `desktop-latest`, which this does not read, so it starts its | ||
| server with `--no-update-check`, which turns the setting off over the config | ||
| file. | ||
| Linux, or in a build from source, whose commit the release will never name. |
There was a problem hiding this comment.
Two other places still tell a Windows user the setting is macOS-only: the CODETRIAL_UPDATE_CHECK row in README.md ("macOS release binaries only") and the comment above CODETRIAL_UPDATE_CHECK in config/codetrial.env.example ("macOS release binary only"). Please update both to say macOS and Windows along with this paragraph.
| if: runner.os != 'Linux' | ||
| env: | ||
| CODETRIAL_GITHUB_CLIENT_ID: ${{ vars.CODETRIAL_GITHUB_CLIENT_ID }} | ||
| GITHUB_SHA: ${{ github.sha }} |
There was a problem hiding this comment.
GitHub Actions already sets GITHUB_SHA for every step, so this line changes nothing. The Windows leg of this step has embedded the commit all along, which is why build.rs reads it without any env:. Removing the line avoids suggesting the variable was missing:
| GITHUB_SHA: ${{ github.sha }} |
| published as `desktop-latest`, which this does not read, so it starts its | ||
| server with `--no-update-check`, which turns the setting off over the config | ||
| file. | ||
| Linux, or in a build from source, whose commit the release will never name. |
There was a problem hiding this comment.
The paragraph still opens with "On macOS," a few lines up, so a Windows reader takes these instructions as not theirs. ./codetrial --version is also not how the Windows binary is run (.\codetrial.exe --version). The same macOS-only wording remains in the CODETRIAL_UPDATE_CHECK row of README.md ("macOS release binaries only") and in the module comment at the top of src/web/update.rs; update both in this change.
| values.get("CODETRIAL_UPDATE_CHECK").map(String::as_str), | ||
| env!("CODETRIAL_RELEASE_COMMIT"), | ||
| cfg!(target_os = "macos"), | ||
| cfg!(any(target_os = "macos", target_os = "windows")), |
There was a problem hiding this comment.
On Windows a running codetrial.exe cannot be overwritten or deleted. The notice's "Replace the executable and keep config/ beside it." (in web/update-notice.js) therefore fails as written unless the server is stopped first, and the new build arrives as codetrial-x86_64-pc-windows-msvc.zip, not an .exe. Issue #547 asks for update instructions that fit Windows: say there to stop the server and unzip over the old executable, for example by including the platform in the /api/update answer.
| // Supported platforms, including Windows CLI builds, can use the existing | ||
| // update-check mechanism when explicitly enabled. |
There was a problem hiding this comment.
This comment says the test covers Windows builds, but the test passes true by hand, so reverting the cfg! in src/main.rs leaves it green. Drop the Windows claim here. As a follow-up, a Windows smoke test that enables the setting and reads /api/update against a stub release would cover the gate itself.
| /// The update check requires the setting, a supported platform, and a | ||
| /// release commit recorded by CI. Local builds and unsupported platforms | ||
| /// must not receive update notices. |
There was a problem hiding this comment.
Moving this test out of tests/config.rs into a new file is unrelated to enabling Windows and makes the diff larger than the change. Keep it where it was and only rename the platform argument. The rewrite also dropped the reason the CI commit is required (a local build's HEAD is never named by the latest release, so it would be told to update forever), and the new inline comments such as // Update checking is opt-in. restate the asserts below them. Please restore the original doc comment and drop the inline comments.
| values.get("CODETRIAL_UPDATE_CHECK").map(String::as_str), | ||
| env!("CODETRIAL_RELEASE_COMMIT"), | ||
| cfg!(target_os = "macos"), | ||
| cfg!(any(target_os = "macos", target_os = "windows")), |
There was a problem hiding this comment.
main no longer builds WebServerConfig here: the update_check_commit call moved to src/launch.rs (cfg!(target_os = "macos") is there now), which is why this PR conflicts. When resolving, apply the cfg!(any(target_os = "macos", target_os = "windows")) change at the call site in src/launch.rs and update the "off macOS this is always None" comment above it, or Windows builds will still never enable the check.
| published as `desktop-latest`, which this does not read, so it starts its | ||
| server with `--no-update-check`, which turns the setting off over the config | ||
| file. | ||
| Linux, or in a build from source, whose commit the release will never name. |
There was a problem hiding this comment.
The sentence a few lines up (the one that starts "On macOS, CODETRIAL_UPDATE_CHECK=true...") still names only macOS, as do the CODETRIAL_UPDATE_CHECK row in README.md ("macOS release binaries only") and the module comment in src/web/update.rs ("for a macOS build CI made"). Update those with this change. Also, the notice text in web/update-notice.js says "Replace the executable", which Windows refuses while the server is running. As a follow-up, say to stop CodeTrial first on Windows, here and in the notice.
| if: runner.os != 'Linux' | ||
| env: | ||
| CODETRIAL_GITHUB_CLIENT_ID: ${{ vars.CODETRIAL_GITHUB_CLIENT_ID }} | ||
| GITHUB_SHA: ${{ github.sha }} |
There was a problem hiding this comment.
GitHub Actions already sets GITHUB_SHA in every step, and build.rs reads it from the environment, so the Windows (and macOS) release builds already record the commit. The added line changes nothing, and the description's claim that the Windows build "now receives" it is not accurate. Drop the line, or keep it only if there is a reason to pin it explicitly.
|
Some review comments on this pull request are not settled yet. Please refine the change per the review comments listed below, reply on each thread with what you changed or why you did not, and mark each thread resolved yourself once it is settled (Resolve conversation, at the bottom of the thread). The pull request stays blocked while review threads are open. Not addressed at the current head:
Checked at d480b1e. |
A PR with open threads kept every earlier "not settled yet" reminder, because only the review that posts a new one trimmed the old copies and the sweep deleted them only once every thread was resolved. #561 showed four. The sweep now lists every copy but the newest as superseded, and apply-pr-actions.sh re-reads the live comments for each row before deleting one, so a concurrent review cannot leave the PR with none. The trim covers only PRs within 100 comments and 100 threads. Change-Id: Ib9c31f785a541290fe5094aeea21b21da736ea96
|
@Yu-Ming-Chang After the rebase, run |
|
@Yu-Ming-Chang This pull request has not had a push since 2026-11-02, it conflicts with |
jserv
left a comment
There was a problem hiding this comment.
Rebase onto latest main branch and resolve conflicts.
|
Converting this PR to a draft for now due to inactivity. Feel free to mark it as ready for review whenever you're ready. |
Extend the update-check platform condition to include Windows builds. This allows Windows users to receive update notifications through the existing update-check mechanism, while keeping the feature opt-in.
Closes #547
Summary by cubic
Extends update-check notifications to Windows builds so Windows users receive update notices, where previously the check ran only on macOS. The feature stays opt-in and only runs on CI builds with a release commit.
update_check_commitnow takes asupported_platformflag instead of amacosflag, keeping the platform rule testable on Linux runners; the test suite covers the setting, platform, and CI-commit requirements.src/main.rsenables the check on macOS and Windows.GITHUB_SHAin CI so it has a release commit to compare against.docs/install.mdupdated to reflect that the update check runs on macOS and Windows, not on Linux or in source builds.Closes #547.
Written for commit d480b1e. Summary will update on new commits.