Skip to content

Validate the project trust store's shape with arktype - #394

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-5678-project-trustts-hand-rolls-json-validation-that-duplicates
Aug 8, 2026
Merged

Validate the project trust store's shape with arktype#394
TheGreatAxios merged 2 commits into
mainfrom
cl-5678-project-trustts-hand-rolls-json-validation-that-duplicates

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • project-trust.ts hand-rolled typeof/Array.isArray checks for JSON shape (src/trust/project-trust.ts:31-60, 117-120) while path-trust.ts validated its structurally-similar store via arktype (src/trust/path-trust.ts:15-17)
  • Replaced the manual shape checks with an arktype schema; array fields stay typed unknown[] rather than string[] so a mixed-type array keeps its valid string entries instead of invalidating the whole record, preserving existing drop/warn behavior

Test plan

  • bun run typecheck (pre-existing arktype narrowing errors unrelated to this change, present identically in untouched path-trust.ts)
  • bun run build
  • bun run test (1 pre-existing unrelated failure in lsp-availability.test.ts)

@linear-code

linear-code Bot commented Aug 8, 2026

Copy link
Copy Markdown

CL-5678

project-trust.ts hand-rolled typeof checks for a JSON shape identical
in kind to the one path-trust.ts already validates via arktype. The
array fields stay typed as unknown[] rather than string[], since this
store must keep valid string entries out of a mixed-type array instead
of rejecting the whole record, unlike path-trust.ts's stricter schema.
@TheGreatAxios
TheGreatAxios force-pushed the cl-5678-project-trustts-hand-rolls-json-validation-that-duplicates branch from 71a371f to d29669a Compare August 8, 2026 18:57
The arktype object schema accepts arrays (they are typeof "object"),
so a trust-store file containing a bare JSON array silently degraded
to an empty-but-valid store instead of being flagged invalid. Explicit
Array.isArray check restores the original rejection before validation.
@TheGreatAxios
TheGreatAxios merged commit 9a0e40c into main Aug 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant