# Track 0 — Test Results

```
$ node --test tests/test-schema.js tests/test-validator.js tests/test-storage.js
TAP version 13
ok 1 - Schema: constructs with required id
ok 2 - Schema: rejects missing id
ok 3 - Schema: rejects invalid id format
ok 4 - Schema: rejects unknown field type
ok 5 - Schema: fieldList preserves insertion order
ok 6 - Schema: requiredFields filters correctly
ok 7 - Schema: buildDefault merges defaults
ok 8 - Schema: clean strips unknown fields and preserves meta
ok 9 - Schema: csvColumns starts with id
ok 10 - Schema: toAiPrompt describes fields
ok 11 - Schema: confidence must be in [0, 1] (A.L2)
ok 12 - Schema: computeContentId is full SHA-1 (A.L1)
ok 13 - Schema: computeContentId with identityKey is stable (A.L4)
ok 14 - Schema: stableIdentity matches existing record
ok 15 - Schema: registerSchemas creates a map
ok 16 - Validator: required field missing
ok 17 - Validator: unknown field rejected
ok 18 - Validator: meta fields skipped
ok 19 - Validator: string pattern check
ok 20 - Validator: string maxLength
ok 21 - Validator: url type
ok 22 - Validator: integer bounds
ok 23 - Validator: boolean strict type check
ok 24 - Validator: array maxLength
ok 25 - Validator: enum values
ok 26 - Validator: references integrity
ok 27 - Validator: datetime ISO 8601
ok 28 - Validator: color hex
ok 29 - Validator: empty optional field allowed
ok 30 - Validator: assertValid throws on invalid
ok 31 - Validator: schema.validate() is the public path
ok 32 - Validator: markdown field accepts long strings
ok 33 - MemoryStorageAdapter: round-trip get/set
ok 34 - MemoryStorageAdapter: get returns null for missing key
ok 35 - MemoryStorageAdapter: remove
ok 36 - MemoryStorageAdapter: keys lists all
ok 37 - MemoryStorageAdapter: clones values (no aliasing)
ok 38 - MemoryStorageAdapter: type tag
ok 39 - LocalStorageAdapter: round-trip get/set
ok 40 - LocalStorageAdapter: get returns null for missing key
ok 41 - LocalStorageAdapter: corrupted JSON returns null
ok 42 - LocalStorageAdapter: keys lists all
ok 43 - LocalStorageAdapter: size() returns bytes used
ok 44 - LocalStorageAdapter: throws when localStorage missing
ok 45 - Adapter factory: setStorageAdapter + resetStorageAdapter
1..45
# tests 45
# pass 45
# fail 0
```

## Conventions verified

- ✅ Every file < 200 lines
- ✅ StorageAdapter is the only path to localStorage (no raw `localStorage.setItem` outside `local-storage-adapter.js`)
- ✅ Reserved meta fields (`createdAt`, `updatedAt`, `createdBy`, `updatedBy`) skipped by validator
- ✅ Unknown fields rejected (AI safety net)
- ✅ 13 field types implemented
- ✅ 3 pressure-test fixes baked in (A.L1, A.L2, A.L4)
- ✅ Public API via `index.js` barrel only
- ✅ All Track 1+ paths reserved in `__RESERVED__` constant
- ✅ Tests use `MemoryStorageAdapter` (no Node-specific `localStorage` shim needed for unit tests)

## Next step

**Operator review.** When you confirm the foundation looks right, we launch Tracks 1, 2, 3 in parallel (the multi-agent build).

If anything in the foundation needs to change (e.g., you want fields to look different, or `confidence` should be a different range, or the validator should behave differently), now is the time to flag it. Tracks 1+ will write against this contract.

---

— cloud Mavis, 2026-07-02