Files
msd-core/.changeset/1581-config-set-coercion.md
Tom Boucher 77aa85007a fix(#1581): config-set no longer silently coerces Infinity / project_code (#2023)
* fix(#1581): config-set no longer silently coerces Infinity/project_code

The value parser used !isNaN(Number(val)), which admits Infinity/-Infinity;
JSON.stringify then renders those as null on disk while the CLI echoed the
non-finite value (output ≠ disk). Leading-zero strings like project_code
'007' were also silently number-coerced to 7.

- config.cts parser: Number.isFinite instead of !isNaN, so Infinity falls
  through to the JSON branch (rejected) and stays a string.
- project_code: always persisted as a string (identifier; leading zeros
  matter), bypassing number coercion.
- context_window: new per-key validator — must be a finite positive integer
  (rejects Infinity/0/negatives/non-integers with a non-zero exit).
- tests/config.test.cjs: #1581 regression (Infinity rejected, 0 rejected,
  200000 accepted finite, project_code '007' string-preserved, granularity
  numeric coercion unchanged).

Closes #1581

* docs(#1581): backfill changeset pr 2023
2026-07-05 14:02:53 -04:00

724 B

type, pr
type pr
Fixed 2023

config-set no longer silently coerces values into something the disk never sees — Number.isFinite replaced !isNaN in the value parser so Infinity/-Infinity are no longer coerced to non-finite numbers that JSON.stringify then renders as null on disk while the CLI echoes Infinity (output ≠ disk). context_window now has a per-key validator requiring a finite positive integer (rejects Infinity, 0, negatives, non-integers with a non-zero exit), and project_code is always persisted as a string so a leading-zero code like 007 survives verbatim instead of collapsing to 7. Numeric coercion for genuine numeric keys (e.g. granularity 42) is unchanged. (#1581)