Queryer: an explicit archived filter overrides the active-only default
Filter keys arrive as "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. 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:
@ -579,7 +579,13 @@ impl<'a> Compiler<'a> {
|
||||
|
||||
// Dynamically apply the 'active-only' default ONLY if the client
|
||||
// didn't explicitly request to filter on 'archived' themselves!
|
||||
let has_archived_override = self.filter_keys.iter().any(|k| k == "archived");
|
||||
// Keys arrive as "field:$op" (extract_filters), so match the field, not the bare name —
|
||||
// compared to "archived" alone this never matched and an explicit archived filter
|
||||
// could not return archived rows.
|
||||
let has_archived_override = self
|
||||
.filter_keys
|
||||
.iter()
|
||||
.any(|k| k == "archived" || k.starts_with("archived:"));
|
||||
|
||||
if !has_archived_override {
|
||||
where_clauses.push(format!("NOT {}.archived", entity_alias));
|
||||
|
||||
Reference in New Issue
Block a user