DAO unit test suite covering all eight tables #23

Member

Adds test_dao_matrix.py: the Feature-02 closing suite. A World fixture chains all DAOs over one migrated temporary DB; per-table tests prove insert/read/update/constraint-violation for children, admin_users, schedule_rules, task_definitions, presence_schedules, presence_overrides, task_instances, completion_events; plus task_instances upsert idempotency (with raw-INSERT UNIQUE backing proof) and the completion_events no-mutation guarantee (method whitelist + package-wide mutation-SQL scan, re-asserted standalone). Leak guards extended with narrowly-justified exemptions + compensating self-scans. 12 new tests; suite 484 passed.

Adds test_dao_matrix.py: the Feature-02 closing suite. A World fixture chains all DAOs over one migrated temporary DB; per-table tests prove insert/read/update/constraint-violation for children, admin_users, schedule_rules, task_definitions, presence_schedules, presence_overrides, task_instances, completion_events; plus task_instances upsert idempotency (with raw-INSERT UNIQUE backing proof) and the completion_events no-mutation guarantee (method whitelist + package-wide mutation-SQL scan, re-asserted standalone). Leak guards extended with narrowly-justified exemptions + compensating self-scans. 12 new tests; suite 484 passed.
orchestrator-agent added 1 commit 2026-09-14 08:49:09 -04:00
overseer added 1 commit 2026-09-14 08:52:33 -04:00
- task-instances matrix test asserts same row id + rewritten due_time
  + pre-refresh None (the vacuous refreshed_same_id walrus is gone)
- compensating guard parses the two sanctioned functions' ASTs: each
  must contain its raw INSERT (children NOT NULL, admin_users PK),
  lexically inside a pytest.raises block, and no other raw SQL may
  name these tables anywhere else in the matrix file
overseer added 1 commit 2026-09-14 08:54:40 -04:00
overseer added 1 commit 2026-09-14 08:56:52 -04:00
- raises block must be pytest.raises (func attr check) with matcher
  exactly naming IntegrityError (dotted-name boundary match, so
  NotIntegrityError fails)
- INSERT OR IGNORE/quoted/qualified table spellings normalized before
  matching so they cannot bypass the raises-block requirement
- probe count is per-function (each of the two sanctioned functions
  must hold exactly one probe), not an aggregate
overseer added 1 commit 2026-09-14 08:58:53 -04:00
- raises block: func must be Attribute pytest.raises or a bare Name
  'raises'; matcher must be a Name/Attribute chain whose final segment
  is exactly IntegrityError (fake.IntegrityError/NotIntegrityError fail)
- insert target matching tokenizes the leading identifier, strips
  quotes/brackets, and takes the last dot-segment, so INSERT OR IGNORE
  INTO "main"."children" and attached-qualified spellings all count
  as table inserts requiring the raises block
overseer added 1 commit 2026-09-14 09:00:28 -04:00
overseer added 1 commit 2026-09-14 09:03:25 -04:00
- every raw statement naming either table in a sanctioned function must
  be exactly that function's expected-table probe (cross-table inserts
  rejected); per-function count still enforces exactly one
- bare Name('raises') is trusted only when the file imports it from
  pytest (from pytest import ... raises); other import bindings
  rejected
overseer added 1 commit 2026-09-14 09:04:51 -04:00
- probe guard now inspects execute, fetch_one, fetch_all AND
  execute_many calls, so bypasses through read/many paths are caught
- bare Name('raises') trusted only when the file's actual ImportFrom
  nodes bind 'raises' from pytest; competing imports shadowing
  'raises'/'pytest' from other modules fail closed
overseer added 1 commit 2026-09-14 09:06:47 -04:00
overseer added 1 commit 2026-09-14 09:08:54 -04:00
pytest raises aliases are collected across the whole file FIRST, then
every competing import (wherever it appears, even before the genuine
binding) is rejected - closing the reversed-order spoof
overseer added 1 commit 2026-09-14 09:10:51 -04:00
The probe guard now walks Call nodes (execute/fetch_one/fetch_all/
execute_many) rather than bare Await nodes, so calls wrapped inside
asyncio.gather or helper awaitables are still classified and cannot
hide a raw write from the sanctioned-function scan.
orchestrator-agent merged commit 0db7d4d519 into feature/8940567d-7b50-41ef-a510-8b234fe7290e-sqlite-data-layer 2026-09-14 09:12:39 -04:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Maniacs_Mansion/NestQuest#23