Repository navigation
Conversation
No unit test ran the idle shutdown timer, so dropping the seconds to milliseconds conversion would make --idle-timeout-seconds 3600 shut code-server down after 3.6 seconds and every test would still pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No linked issue: this PR only adds a test.
If the idle shutdown timer ever lost its
* 1000,--idle-timeout-seconds 3600would shut code-server down after 3.6 seconds of idleness instead of an hour, and no test would notice.Tests only: one test (+42 lines) in
test/unit/node/main.test.ts. No change to library code.What the test pins
--idle-timeout-secondsis documented as "Timeout in seconds to wait before shutting down when idle." No unit test runs the timer inrunCodeServer. The new test startsrunCodeServerwith--idle-timeout-seconds=120under fake timers, withcreateAppandregistermocked as in the existing tests and a heart that never reports activity, and checks thatwrapper.exitis not called after 119 seconds and is called with0at 120 seconds.How it was checked
On main
c094099c:./test/node_modules/.bin/jest --coverage=false test/unit/node/main.test.ts: 5 passed (the new one included).pnpm run test:unit: all 23 suites pass.prettier --checkandeslint --max-warnings=0on the file are clean.}, args["idle-timeout-seconds"]! * 1000)changed to}, args["idle-timeout-seconds"]!)insrc/node/main.ts, this new test is the only one that fails (4 pass, 1 fails:wrapper.exitcalled before 119 seconds); the rest oftest/unitstill passes.This test was written with Claude Code during a planted-bug run by SK @ Trenyx.