fix: reject corrupt Oil installed.json instead of wiping it - #252
Open
undivisible wants to merge 1 commit into
Open
undivisible wants to merge 1 commit into
undivisible wants to merge 1 commit into
Conversation
InstallState::new treated invalid JSON as an empty map, so a truncated or poisoned state file silently dropped the install record. Amp-Thread-ID: https://ampcode.com/threads/T-01a0a633-196d-75d1-845a-2e4778aca628 Co-authored-by: Max Carter <undivisible@vk.com>
|
Capy couldn't review this pull request because Max's workspace is out of credits, add credits or enable auto-reload to resume automatic reviews. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_27779fff-5881-47f2-9554-a5345c4bdfd4) |
|
Tick the box to add this pull request to the merge queue (same as
|
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.
InstallState::newdeserialized~/.oil/installed.jsonwithunwrap_or_default(), so truncated or poisoned JSON silently became an empty map and latersave()would persist the wipe.Now invalid JSON is an
OilError::Install. Covered bytest_install_state_rejects_corrupt_json.cargo test -p oil109 pass;--no-default-features94 pass.Review only: package/install state. Does not overlap #247 (redirect/keyname/APKINDEX cache).
Note
Low Risk
Narrow change to install-state loading; users with corrupt JSON will see an explicit error instead of a silent reset, which reduces accidental data loss.
Overview
InstallState::newno longer treats invalid~/.oil/installed.jsonas an empty package map. Deserialization failures now returnOilError::Installwith a "corrupt install state" message (including the path and parse error), so a latersave()cannot overwrite a broken file with a fresh empty state.Adds
test_install_state_rejects_corrupt_jsonto assert corrupt JSON fails load instead of succeeding with an empty map.Reviewed by Cursor Bugbot for commit b4286b1. Configure here.