Repository navigation
feat(settings): add opt-in atomic write mode - #29
Conversation
Add serialized Windows atomic replacement with backup, staged in-memory publication, permission preservation, failure reconciliation, crash tests, release metadata, and gated package publishing.
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42874f354d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!publishData) | ||
| { | ||
| // Atomic mode must preserve siblings in the actual parent, not recreate | ||
| // nested containers by looking for their names at the document root. | ||
| context = GetOrCreateAtomicChild((JToken)context, currentKey, int.TryParse(split[i + 1], out _)); |
There was a problem hiding this comment.
Preserve numeric keys when the parent is an object
When atomic mode updates a configuration such as {"Years":{"2024":"old"}} through configuration["Years:2024"] = "new", this branch routes the mutation through the JSON navigator without calling base.Set. The final segment is classified as an array index solely because it parses as an integer; since its parent is a JObject, no assignment occurs, the operation returns successfully as a no-op, and both memory and disk retain old. Numeric object keys are valid and commonly produced by dictionaries, so index handling needs to depend on the parent token type rather than the key text alone.
Useful? React with 👍 / 👎.
| if (index < array.Count) return array[index]; | ||
| JToken child = nextIsArrayIndex ? (JToken)new JArray() : new JObject(); | ||
| // Preserve the existing append/merge behavior rather than truncating array tails. | ||
| array.Add(child); | ||
| return child; |
There was a problem hiding this comment.
Reject or preserve the requested sparse array index
For a nested write past an array's tail, such as setting Items:2:Name when Items is empty, this code appends exactly one child at index 0 and then applies the edit there. The save therefore succeeds but changes Items:0:Name, while the requested Items:2:Name remains absent after the candidate data is reparsed. Either pad the array through the requested index or reject sparse indices rather than silently writing to a different configuration key.
Useful? React with 👍 / 👎.
Summary
WritableJsonConfiguration8.1.0 after merge.Changes
CHANGELOG.md.master.Validation
dotnet build WritableJsonConfiguration.sln -c Release --no-restore— 0 errors (2 pre-existing nullable warnings inConfigTests).dotnet test WritableJsonConfiguration.sln -c Release --no-build --no-restore— 38 passed, 1 expected non-Windows contract skip on Windows.WritableJsonConfiguration.8.1.0.nupkg; verified version, MIT license, README, release notes,.NET Standard 2.0library and dependencies.A68384F2DC328DA97E0EF8904068577F0D76CA15808408190DFF3E092846F6ED(local candidate; CI rebuild will have its own deterministic delivery artifact).Risks / Rollback
Links