Repository navigation
test(plugins): stop the fake Pi CLI from rewriting settings on read-only commands - #762
Merged
Merged
Conversation
…nly commands fakePiNpm is the Run fake for every target in a test Service, and it rewrote Pi's settings.json after any command other than --version and --help. Inventory queries all targets concurrently, so another target's read-only CLI call could truncate the file while the pi host read it. The pi host then saw no packages, and TestPluginHostStateProducerLegacyProjection/local failed with "local proof rejected". It failed three times on the v0.28.3 release run and on PR #745. Only install and remove change Pi settings, so only they write now.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
TestPluginHostStateProducerLegacyProjection/localfails intermittently in CI with:It failed three times on the v0.28.3 release run and once on #745, and blocked the release tag until a rerun passed.
Cause: the test fake, not production code.
fakePiNpmis theRunfake for every target in a testService. It re-marshaled and rewrote Pi'ssettings.jsonafter any command other than--versionand--help.Service.Inventoryqueries all targets concurrently, so another target's read-only CLI call could truncate the file (os.WriteFile) while thepihost was reading it. Thepihost then reported no packages, and the legacy proof was rejected.I confirmed this with temporary instrumentation under load: every failing run read the same settings path with zero entries.
Fix: only
installandremovechange Pi settings, so only they write. Every other command returns without touching the file. The real Pi CLI never rewrites settings on read-only commands either.Type
Linked Issue
None. Found while releasing v0.28.3.
Checklist
make check). The fix is to the test helper itself.Verification
All in the devcontainer:
-raceplugin test binary reproduced the failure in about 4 of every 48 runs.go test -race ./internal/pluginpasses.go vetandgofmtare clean.make checkpasses.Production Pi commands that reach the fake are
--version,--help,install,removeandupdate.updatelost its re-serialization of an existing file, and no test depends on that.Not covered
installandremovestill write withos.WriteFile. That would race only ifInventoryran concurrently with an apply, which no test does.