entity.parent_id -> entity matches every type pair in both directions, and the
discovery loop kept forward whenever reverse also matched — so an array
include compiled as `parent.parent_id = child.id` and every nested list read
back empty. Includes always start from the parent and list what hangs under
it; nothing reads the edge from a child up to its parent object. So the edge
is reverse, full stop. 1286 library tests pass. Pinned by api's accounting
suites on branch activity-task-assignment-lines.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AvkGU4kQ4wsqxHFpXtZKZM
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
Resolves a query compilation bug in JSPG where reverse/incoming polymorphic
edges (where edge.forward == false, e.g. pet ➡️ cover_attachment) mistakenly
appended the destination type constraint to the parent query's WHERE clause
(e.g., producing `entity_1.type = 'attachment'` on a pet entity query,
causing it to match 0 rows and return null).
- Modifies `compile_polymorphic_bounds` in `compiler.rs` to only compile
type checks when `edge.forward` is true. For reverse edges, the parent's
type check does not belong on the parent table and is already implicitly
restricted by parent ID joins.
- Updates the `fk_attachment_attachable_entity` relation in the queryer test
fixture to correctly model a two-column polymorphic relation, ensuring
this code path is exercised by the unit test suite.