Queryer: an explicit archived filter overrides the active-only default, per node

Filter keys arrive as "path/field:$op", so the override check that compared the
key to the bare "archived" never matched: the hidden NOT archived clause was
always added and an explicit archived filter could not return archived rows.
The match is on the node's own archived path, so a root filter lifts the
default for the root only — nested includes the filter never mentioned keep
hiding archived rows. The two queryer fixtures that filter on archived had
snapshotted the contradiction (NOT archived AND archived = $1); they now expect
the filter alone. 1286 library tests pass.

Pinned by api's TestArchive_CascadesDownTheTree (test/punc/lineage_test.go).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AvkGU4kQ4wsqxHFpXtZKZM
This commit is contained in:
2026-09-02 10:55:04 -04:00
parent 15e826cbcb
commit b699061f2f
2 changed files with 17 additions and 7 deletions

View File

@ -1246,8 +1246,7 @@
" )",
" FROM agreego.entity entity_1",
" WHERE",
" NOT entity_1.archived",
" AND entity_1.archived = ($1 #>> '{}')::BOOLEAN",
" entity_1.archived = ($1 #>> '{}')::BOOLEAN",
" AND entity_1.archived <> ($2 #>> '{}')::BOOLEAN",
" AND entity_1.created_at = ($3 #>> '{}')::TIMESTAMPTZ",
" AND entity_1.created_at > ($4 #>> '{}')::TIMESTAMPTZ",
@ -1718,8 +1717,7 @@
" JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id",
" JOIN agreego.person person_3 ON person_3.id = organization_2.id",
" WHERE",
" NOT entity_1.archived",
" AND person_3.age = ($1 #>> '{}')::NUMERIC",
" person_3.age = ($1 #>> '{}')::NUMERIC",
" AND person_3.age > ($2 #>> '{}')::NUMERIC",
" AND person_3.age >= ($3 #>> '{}')::NUMERIC",
" AND person_3.age < ($4 #>> '{}')::NUMERIC",
@ -2702,4 +2700,4 @@
}
]
}
]
]