Repository navigation
test: one config test owns the shared server's configuration (#440) - #443
Merged
Merged
Conversation
UpdateConfig writes the global file and only requests a debounced reload that publishes config.updated when the loaded entries change. The persist test wrote and cleared the shell without waiting for that reload, so on a slow runner its pending reload absorbed the read-back test's identical write and no event came. The file checks fold into the read-back test, which settles the loaded state after each write.
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.
What
ConfigClientLiveTestsnow has one test that writes the shared server's configuration, and it settles the loaded state after each write. That removes the cross-test residue that ejected #439 from the merge queue (#440).Fixes #440.
Root cause
The comment on #440 has the measurement in full. In short:
packages/core/src/config.ts:316-328, 380-401:experimental.config.updatewrites the global file and only requests a reload, through a sliding PubSub(1) with a 100 ms debounce, serialized underreloadLock;config.updatedonly if the loaded entries change.UpdateConfigAsync_Should_Persist_And_Clear_The_Shellwrote the shell and then null, but checked only the file, so it ended with reloads still pending. When the runner was slow, the next test's identical write landed inside that pending reload. The reload saw no change and published nothing, and the read-back test waited 60 s for an event that never came.Red repro, measured before the fix
A scratch test against the pinned simulated server, not committed, ran five rounds:
config.updated(the loaded state is now the shell).Result: no
config.updatedarrived within 5 s in 5 of 5 rounds, and the loaded config still showed the shell. As a control, a real change (shell → null) published the event in 5 of 5 rounds.The change
Folded into one test. The persist test is deleted. Its two file assertions move into the read-back test, right after each
204:shellequals the path;shellproperty.The test is renamed
UpdateConfigAsync_Should_Persist_The_Shell_GetConfigAsync_Reads_Back_And_Clear_It, because it now proves the file write, the reload and the clear.Its doc comment records that it is the only writer of the shared server's configuration, and why.
No other writer.
ConfigClientLiveTestsholds the onlyUpdateConfigAsynccalls, andConfigClientContractTestsruns on a fake scenario. No test writes into the run root'sconfig/opencodeat test time, and none of the other 40SimulatedDriveServerFixtureusers touches the shell or the global file.No retry, and no bound was widened.
Rejected: state-first
Reading
config.getbefore waiting for the event would also stop the timeout. It was rejected because, against a stale loaded shell, it can pass without proving that this test's write reached the loaded configuration. The event-then-read order is what makes the read-back a proof.Proof
OpenCode.Sdk.Tools.Testsproject (Category!=Packaging&Category!=NativeAot): 2019/2019.tools/jscpd/tests.baseline.jsononly removes two entries,41ff4bb4c970a18aandc96ee9924b3f4ea7, and adds none. Those were the duplicated config arrange that the fold eliminated; left in, they would fail the gate as stale. This is the ratchet moving down.9253bde3(master3b235436): all 8 steps, and 10,482 tests including net472 with 0 failed. The first run failedverify-clonesbecause the two baseline entries the fold removed were still listed; this commit drops them.Need help on this PR? Tag
@codesmith-botwith what you need.