-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
area:toolingArea: tooling and CLIArea: tooling and CLIbugSomething isn't workingSomething isn't workingpriority:p2Priority P2 (medium)Priority P2 (medium)
Milestone
Description
Summary
globalCache.generateKey hashes raw string values and JSON.stringify for non-strings. This can produce collisions between different types (e.g., string "1" vs number 1, string "null" vs null).
Failure mode
generateKey('x', '1')andgenerateKey('x', 1)hash the same input sequence.generateKey('x', 'null')andgenerateKey('x', null)collide.- Collisions can return cached results for the wrong inputs.
Evidence
src/utils/cache.tsgenerateKeyuseshash.update(input)for strings andhash.update(JSON.stringify(input))for other primitives, withnull/undefinedalso mapped to'null'.
Proposed fix
- Prefix each input with a type tag (e.g.,
str:,num:,bool:,null:) before hashing. - Alternatively, use a stable JSON encoder that preserves types for primitives.
Acceptance criteria
- Distinct primitive inputs (string vs number vs null) produce distinct keys.
- Add tests verifying no collisions for
1, "1",true, "true",null, "null".
Metadata
Metadata
Assignees
Labels
area:toolingArea: tooling and CLIArea: tooling and CLIbugSomething isn't workingSomething isn't workingpriority:p2Priority P2 (medium)Priority P2 (medium)