Files
mattgodbolt-molty 86f909ea3e storage: tighten getSafeHash signature, reject non-object inputs
Address the latest Copilot review on PR #8644: the shallow-clone via
{...inputConfig} silently changes behaviour for non-plain inputs that
were never expected — strings spread to per-character objects, null /
undefined spread to {}, neither hashing the same as before.

In-tree call sites all pass plain objects (or class instances without
toJSON, which behave identically under JSON.stringify), so nothing is
broken today; this is purely defence against future drift:

- Tighten the parameter type from `any` to `Record<string, any>` so a
  TypeScript caller passing a string or null fails at compile time.
- Add a runtime assert for the same cases (and arrays, which spread
  weirdly even though the type would allow them).
- Tests cover string/null/undefined/number/array rejection plus a new
  test that confirms the input object is not mutated by the call (the
  pre-refactor implementation mutated in place; my refactor explicitly
  shallow-clones to avoid that).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 20:08:21 -05:00
..
2021-10-05 01:45:05 +02:00
2019-08-21 01:26:16 +02:00
2025-01-29 10:41:03 -06:00
2021-09-13 20:22:27 +02:00
2024-10-27 15:28:38 +02:00
2024-10-26 17:42:22 +02:00
2024-03-08 22:25:09 -06:00
2024-03-08 22:25:09 -06:00
2024-03-08 22:25:09 -06:00
2026-02-08 12:50:20 +01:00
2024-03-08 22:25:09 -06:00
2024-03-08 22:25:09 -06:00
2025-07-28 10:34:46 -05:00