open-brainy/scripts
David Snelling f758d7dc42 feat(contract): declare contract 1, serve three operators, refuse four by name
Open Brainy's side of the API contract the accelerated engine published.

DECLARED: package.json carries "brainyContract": 1 and the engine states its
own via contractVersion() / BRAINY_CONTRACT_VERSION — two engines compare an
integer instead of probing prototypes, and a tool reads the package field
without importing the engine. Pinned so the two can never drift apart.

SERVED: hasAll, noneOf and excludes now work on the index path. The defect
underneath was worse than the reported divergence — the metadata index's
operator switch had NO DEFAULT CASE, so any operator without a case left the
field's match set at its initial [] and find() returned an empty page.
Documented, validator-accepted, matcher-implemented operators answering
silently wrong. hasAll intersects each element's posting set (an empty operand
is vacuously true of every row that has the field), noneOf complements their
union, excludes complements contains.

REFUSED BY NAME: startsWith, endsWith, matches and length raise
INVALID_QUERY naming the operator, the field and the reason. An equality/range
posting index cannot evaluate a substring, a pattern or an array length without
reading every row — which is the cost this path exists to avoid — so it refuses
rather than answering an empty page. Both engines now agree on all 25 tokens
and contract 1 has no remaining operator divergence. This is a visible change
for a consumer calling those four through find({ where }): an empty page
becomes a typed refusal.

EMITTED: scripts/emit-contract-manifest.mjs generates docs/api-contract.json
from the BUILT surface — prototype doors, exported error classes, the operator
sets read out of their single definitions, the field-addressing vocabulary, the
health verdicts. Nothing hand-maintained, so a diff between two manifests is a
diff between two engines. `--check` fails on a stale manifest, which makes the
announce-every-addition duty mechanical rather than remembered.

RATIFIED in docs/contract-1-ratification.md: the 41-of-57 required split with
the promise spelled out (a refusal is part of a door; deprecation is not
removal), the serving-withholding list confirmed exhaustive and identical, the
minor/major rule adopted with the announcement duty, the 30 storage seam
methods committed as supported surface until Stage 2, and a finding filed
against the spec — is / isNot / greaterEqual / lessEqual are listed there as
served aliases and have never existed in this engine, which throws
INVALID_QUERY on all four.
2026-08-28 10:57:43 -07:00
..
gate ci(gate): the machine-health preflight and the truncation verdict guard 2026-08-20 08:22:48 -07:00
lib build: derive generated-file stamps from git commit time, not wall clock 2026-08-27 09:18:45 -07:00
build-candle-wasm.sh feat: migrate embeddings to Candle WASM + remove semantic type inference 2026-01-06 12:52:34 -08:00
buildEmbeddedPatterns.ts build: derive generated-file stamps from git commit time, not wall clock 2026-08-27 09:18:45 -07:00
buildTypeEmbeddings.ts build: derive generated-file stamps from git commit time, not wall clock 2026-08-27 09:18:45 -07:00
check-patterns.cjs fix: use .cjs extension for check-patterns script 2025-08-27 10:00:56 -07:00
check-type-embeddings.cjs perf: pre-compute type embeddings at build time (zero runtime cost) 2025-10-09 18:08:57 -07:00
emit-contract-manifest.mjs feat(contract): declare contract 1, serve three operators, refuse four by name 2026-08-28 10:57:43 -07:00
push-docs.js chore: push public docs to the soulcraft.com ingest door on release 2026-07-18 14:02:23 -07:00
release.sh docs: repository links point at soulcraftlabs/open-brainy — the soulcraft/brainy path becomes the native engine's repo tonight 2026-08-27 17:26:44 -07:00
setup-dev.sh feat: migrate embeddings to Candle WASM + remove semantic type inference 2026-01-06 12:52:34 -08:00