writeonce/tests/corpus/run/db-query-corpus/fixture.wo
shoney.arickathil 5941a092f7 feat(query-corpus): iteration 9g corpus #1 — skillhost needs no new query grammar
- resolved 9g's forks EMPIRICALLY against the running compiler:
  - count(<query>) and len(<query>) already work (fork 2 collapses to
    zero code)
  - skillhost's correlated NOT EXISTS is a backlink emptiness in
    writeonce (`where len(x.children) == 0`), using only 9b machinery
    (fork 1) — verified on a self-referential ?ref/backlink table
  => corpus #1 forces NO new grammar; per the method ("add only what a
     corpus uses"), exists/not-exists was NOT built
- docs/examples/skill-catalog: mirrors skillhost's `skills` table
  (name @unique, description/location/root, parent ?ref Skill, children
  backlink) and translates all five of its SQL statements 1:1
  (insert+dup-trap, get-by-name, list, roots via backlink-emptiness,
  count); scripts/skill-catalog-accept.sh 7/0, WAL-durable, dup trap
  persists across restart
- fixture run/db-query-corpus (count(query) + backlink NOT EXISTS);
  just skill-catalog module; target/ gitignored
- general exists/not-exists left unbuilt and recorded as "enters when a
  corpus forces a non-relation correlation"
- gates: oop-e2e 80/0, woc-test 566/0, skill-catalog 7/0; story + board
  record the finding

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 4c82461634d45f11eca1a252702031c03d999c7f)
2026-09-15 01:15:30 +02:00

17 lines
603 B
Text

-- iteration 9g: skillhost's grammar on the 9b surface. count(query) for
-- COUNT(*), backlink-emptiness for a correlated NOT EXISTS. No new grammar.
@table(name: "skills", index: [name], index: [parent])
class Skill {
name: Text
parent: ?ref Skill
children: backlink Skill.parent
}
fn main() {
let git = insert Skill { name: "git", parent: nil }
insert Skill { name: "git-commit", parent: git }
insert Skill { name: "docker", parent: nil }
print_int(count(from x in Skill select x))
for s in from x in Skill where len(x.children) == 0 order by x.name select x {
print(s.name)
}
}