query: make Scope the receiver for checking and verifying #102

Merged
PerishFire merged 1 commit from scope-check into main 2026-07-21 07:01:31 +00:00
Owner
No description provided.
query: make Scope the receiver for checking and verifying
All checks were successful
guard / guard (pull_request) Successful in 1m38s
f31fedae9f
I called this a layering blocker last round. It was not, and the reason
is worth recording: the five plan arguments were not asking to become
Plan methods, they were re-resolving what analyze had already resolved.

analyze fetched the root Unit, then handed plan and the unit's NAME to
check and check_links, each of which looked the same unit up again --
three lookups of one thing. check_nest wanted the target unit from the
plan, but range already computes exactly those targets; it simply ran
after the checks instead of before.

So analyze reorders: resolve, build the range table, make the Scope, and
let the Scope check the tree. Nothing needs plan below that line.

verify was the tell I missed when I wrote it in #92 -- verify(scope,
tree) and verify_pred(scope, pred) already took Scope first. They were
Scope methods wearing free-function clothes, and the check_ family is the
same shape one step behind. Both families move onto Scope: check, pred,
cell, nest, kind, verify, weigh. The shared "some needs inner" unwrap
becomes inner().

involved moves onto Tree rather than Scope, deliberately. serve/route
calls it as the veil gate, and the gate has to decide BEFORE anything
validates: resolving a Scope there would run the checks first, so a
veiled unit queried with a bad field would answer "unknown field"
instead of "no such route" and thereby admit the unit exists. Nothing is
reordered; only the receiver moves, and "which tables does this query
touch" is the query's own question.

query/check.rs 11 debts -> 0. Total 18 -> 7, and the receiver law joins
param and dispatch at zero. The seven left are the two piles that need a
ruling: four set_tie and three into_response.

guard clean, 46 tests green on sqlite and on real postgres.
PerishFire deleted branch scope-check 2026-07-21 07:01:31 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
PerishLab/keel!102
No description provided.