Repository navigation
Show a lobby notice when a newer release is out - #545
Conversation
|
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 d883e8d. |
|
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:
Addressed at the current head; reply with what changed and resolve:
Checked at d0fa163. |
Always post in American English unless you are working on CJK-specific localization. As a computer science student, you should develop an international outlook and communicate your expertise to a global audience. |
Thank you for the correction and advice! I have updated the previous comment back to American English and will keep this in mind going forward. |
|
Commit d883e8d isn't the latest commit... please double-check the details before replying. Also, I suggest squashing your commits. |
d0fa163 to
241afc5
Compare
|
@LJY2000-max, When using AI tools, don’t ask them to translate review comments into Chinese. Use English as your working language, including your prompts and follow-up interactions. This can make token use more efficient while giving you practical experience communicating in English with AI assistance. Otherwise, you remain merely an AI tool operator, much like a convenience store clerk heating different foods in a microwave. You may appear to serve a variety of meals, but that does not mean you understand the food or even have the skills of a waiter. In the AI era, make sure these tools help you grow as a person. Do not let yourself become a subject of alienation: someone who pays to sustain AI services and supplies data for them to mine, yet gains little personal growth in return. |
|
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 241afc5. |
241afc5 to
5db4083
Compare
jserv
left a comment
There was a problem hiding this comment.
Rebase the current branch onto the upstream default branch and resolve any conflicts. Run /codetrial-review in AI agents (use $codetrial-review in Codex) and resolve all identified issues. Rework the series into minimal, logically coherent commits, squash closely related commits, and ensure all commit messages follow the project’s rules.
Thank you, Professor Jserv, for the thoughtful advice and guidance, as well as for sharing a practical tip on saving tokens that I was previously unaware of. |
jserv
left a comment
There was a problem hiding this comment.
Rebase onto latest main branch and resolve conflicts.
5db4083 to
94bdf55
Compare
|
The title reads "Show a lobby notice when a newer release is outFeature/update notice", with the branch name appended. Please edit it to "Show a lobby notice when a newer release is out". |
tests/web/accounts.rs sits at its 1900-line ceiling, so any route added to the router, which this test has to classify, would push it over. The test checks the router's shape rather than anything about accounts: every declared route is owner-scoped or anonymous, and every owner-scoped one refuses a request without a session. The router's shape is tested in tests/web/routes.rs, so it moves there unchanged, and the accounts ceiling ratchets down to what the file now holds.
A candidate running the macOS binary from the rolling latest release had no way to learn that a newer build existed short of comparing commits on the releases page by hand, since the package version never changes. With CODETRIAL_UPDATE_CHECK=true the server asks GitHub which commit latest names, caches the answer for ten minutes, and answers /api/update with whether it differs from the build; the lobby asks when it loads, which covers starting the binary and coming back from an interview, and on every hour it stays open. A newer release shows a notice linking to the release, written a frame after it appears so its status line is announced; dismissing it hides it for that release, and a later answer that no longer names a newer one takes it down. The page's connect-src is unchanged and every failure shows nothing. The check is off by default, since it reaches GitHub from the server with nobody signing in, and runs only in a macOS build CI made: build.rs now records whether the commit came from GITHUB_SHA, because a local build's HEAD is a commit latest will never name, and a test holds that record to the GITHUB_SHA CI sets. The desktop app starts its server with the new --no-update-check, since it is published as desktop-latest and latest never names the server inside it. Close sysprog21#543
94bdf55 to
d4e1576
Compare
I have updated the PR title. |
|
Thank @LJY2000-max for contributing! |
The macOS release binary can now tell the candidate when the rolling
latestrelease is a newer build, in the scope agreed on #543.How it is enabled:
CODETRIAL_UPDATE_CHECK=trueinconfig/codetrial.env.local. It is off by default, and documented in docs/install.md, the README configuration table andconfig/codetrial.env.example.What it does: the server asks GitHub (GET /repos/sysprog21/codetrial/releases/tags/latest) which commit latest names, caches the answer for ten minutes (kept even when the lobby that asked goes away mid-request), and answers /api/update with whether that differs from the build. The lobby asks when it loads, which covers both starting the binary and coming back from an interview, since leaving an interview navigates to /, and on every hour it stays open. An interview replaces the lobby page, so nothing is checked during one. A newer release shows a card in the lobby's corner with both commits and a link to the release page; its message is a status line, written a frame after the card shows so it is announced without taking focus. A later answer that no longer names a newer release, or a release dismissed in another tab, takes the card down. Dismissing it stores that release's commit and hides the card until a different one is named. The page's connect-src is unchanged.
When nothing is compared: the setting is off, the build is not macOS, CODETRIAL_BUILD_COMMIT did not come from GITHUB_SHA, or the server was started with --no-update-check, which the desktop app passes because it is published as desktop-latest and latest never names its server. build.rs now records the last as CODETRIAL_RELEASE_COMMIT, empty for a local build. The server then answers enabled: false, asks GitHub nothing, and the lobby stops asking. Every GitHub failure (no network, an error status or rate limit, the 404 while latest is republished, a body without a full commit) answers "no update" and shows nothing, and the lobby keeps checking on the hour; a lobby that cannot reach its own server stops until the next load.
/api/update answers without a session, like /api/session: both commits are public, and the cache means a caller cannot make the server ask GitHub more often.
Tests: tests/unit/web/update.rs runs the lookup against a stub GitHub for the matching-commit, differing-commit and failed-check cases (500, 403, 429, 404, a missing, short or non-hex target_commitish, a closed port), for the cache, and for a lookup whose caller went away mid-request; tests/web/update.rs goes through the router and shows a server with the check off makes no request to the stub; tests/config.rs pins the opt-in, platform and CI-commit rule, and checks that a CI build records its GITHUB_SHA as the release commit, which fails with build.rs recording nothing; tests/unit/bin.rs and desktop/tests/unit/server.rs cover --no-update-check and the launcher passing it; tests/browser/update-notice.test.js covers what the lobby shows, when its message is written, following a later release, taking it down without moving focus that was elsewhere, dismissing, the hourly schedule staying single across a restored page, and the stops, plus one Chromium run of the real lobby by keyboard. Each new assertion was checked to fail with its change reverted. The route allowlists in tests/web/routes.rs and tests/web/accounts.rs list the new route.
Validation, on the single commit rebased onto 38d53a7: ./scripts/test.sh rust, ./scripts/test.sh portable and the three browser shards pass locally, cargo clippy --all-targets -- -D warnings is clean, and cargo test in desktop/ passes. cargo-mutants was not available here, so the four mutants the gate missed, and the new flag's comparison and override, were applied by hand: each fails a test. The same was done for every new branch in web/update-notice.js, which the mutation gate does not cover.
Manual check on an Apple Silicon Mac, against the real GitHub API, with builds from this branch:
GITHUB_SHAset to an older commit ofmainandCODETRIAL_UPDATE_CHECK=true. The notice shows both commits, and its link opens the release page.normal.mov
dismiss.mov
latestnames.latestnames:git ls-remote https://github.com/sysprog21/codetrial refs/tags/latest.CODETRIAL_UPDATE_CHECK=truestill set, start the server built from that commit:GITHUB_SHA=<that commit> make web.codetrial:updateDismissedfrom the page's local storage, so the dismissal from step 2 does not hide the result, and reload the lobby.curl -s http://127.0.0.1:3000/api/updateanswers{"available":false,"enabled":true}.Latest.mp4
CODETRIAL_UPDATE_CHECK=truefromconfig/codetrial.env.local.GITHUB_SHA=<older commit> make web.curl -s http://127.0.0.1:3000/api/updateanswers{"enabled":false}.default.mp4
Close #543
Summary by cubic
The macOS release binary now shows a lobby notice when the rolling
latestrelease names a newer build, behindCODETRIAL_UPDATE_CHECK=true(off by default). Closes #543.How it works
latestnames, caches the answer for ten minutes, and answers/api/update; the lobby checks on load and hourly.connect-srcis unchanged.When nothing is compared
build.rsrecords theGITHUB_SHAcommit asCODETRIAL_RELEASE_COMMIT, and other builds answerenabled: falseand ask GitHub nothing.--no-update-check, overriding its config file, because it is published asdesktop-latest.Manual check on an Apple Silicon Mac, against the real GitHub API, with builds from this branch:
latestnames.Written for commit d4e1576. Summary will update on new commits.