Repository navigation
fix(machine): reject non-object config snapshots - #388
Merged
Merged
Conversation
what changed: Only non-array JSON objects may create or restore a last-good machine config snapshot. Added regressions for arrays, strings, numbers, booleans and null, plus preservation of an existing good backup. why: A JSON scalar or array holds no machine settings; restoring it after a parse failure silently enabled collector and fail-open defaults. Apply the existing ADR-0020/0023 fallback instead. No alternative design was set aside. what it touched: machine.mjs, machine tests, architecture map, changelog and README test inventory. No new config key, role or public interface. what you verified: verified - red-first reproduction (23 passed, two expected failures), then machine tests (25 passed, zero failures); handoff OK; root preflight PASS with its existing unstamped-brief warning; doctor READY on the collector with firecrawl-cli. The required full suite runs in the commit gate before acceptance. what you got wrong and fixed: nothing to report.
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.
Non-object JSON backups such as
[]and"x"were treated as last-good machine settings. When the live config then stopped parsing, the kit silently restored collector and fail-open defaults. Only non-array JSON objects may now create or restore the backup; unusable backups take the existing fail-closed/unknown-role fallback. Reading a scalar or array leaves an existing good backup intact.Fixes #368
what changed: Guarded snapshot creation and restoration, and added regressions for invalid backup shapes and preservation of a previously valid backup.
why: Restore ADR-0020 and ADR-0023's existing behavior when there are no settings to hold. No alternative design was set aside.
what it touched:
lib/machine.mjs, machine tests, architecture map row, changelog and README test inventory. No new setting or interface.what you verified: verified - red-first reproduction, followed by 25 passing machine tests; handoff OK and root preflight PASS. The required full-suite commit gate accepted this commit.
what you got wrong and fixed: nothing to report.
Full-suite detail: verified - 1779 passed, 0 failed, 12 unsupported capabilities on Windows/Node 24.20.0 in 1122.7 seconds, accepted under the gate's documented local policy. GitHub CI runs separately.