Files
msd-core/.changeset/gentle-jaguars-munch.md
Tom Boucher 752df8adb4 fix(#1657): recover malformed (non-object) ~/.gsd/defaults.json in finishInstall (#1661)
* fix(#1657): recover malformed (non-object) ~/.gsd/defaults.json in finishInstall

JSON.parse of defaults.json succeeds for valid-JSON-but-non-object values (null, [],
42, "str"), which then bypassed the parse catch: null threw a TypeError on property
access (swallowed by the outer try/catch), and array/number/string had resolve_model_ids
set on a non-object whose JSON.stringify round-trip kept the broken shape. The non-Claude
finishInstall step now resets any non-object (null, non-object, or array) parse result to
{} before reading/writing, so the file is repaired and resolve_model_ids defaults normally.
Regression folded into the owning tests/bug-410-install-defaults-test-mode-guard.test.cjs
(parameterized over null/[]/42/"str").

* chore(#1657): backfill changeset pr ref to 1661
2026-06-24 13:48:16 -04:00

689 B

type, pr
type pr
Fixed 1661

gsd install/upgrade now recovers a malformed ~/.gsd/defaults.json instead of leaving it broken — a defaults.json containing a valid-JSON-but-non-object value (null, [], a number, or a string) bypassed the parse catch and flowed through unrecovered: null threw a TypeError (swallowed by the outer guard, logging a confusing "Could not write" warning and leaving the file as null), while []/42/"str" silently kept their broken shape on every install. The non-Claude finishInstall step now resets any non-object parse result to a fresh {} before reading/writing it, so the file is repaired and resolve_model_ids defaults normally.