Skip to content

batched_refs_overlay_only walks the overlay assert-only, so a revoked rdf:type still grants until the first index build #1704

Closed

Description

@aaj3f

Found during review of #1698. That PR fixes the identical defect in overlay_only_flakes; this is the third overlay-only path in the same file and it was not swept.

What happens

batched_refs_overlay_only (fluree-db-query/src/binary_range.rs:1132) opens its walk callback with:

&mut |flake| {
    if !flake.op {
        return;
    }

That is overlay_only_flakes' pre-#1698 code verbatim, and there is no lifecycle resolution anywhere in the function (:1110-1157). The overlay is a log, not a current-state view, so an rdf:type asserted and then retracted within the same novelty window comes back asserted.

Its two sibling paths in the same function both resolve correctly — resolve_overlay_ops at :1005 and apply_raw_overlay_deltas_to_batched_refs at :1060 — so this arm is the odd one out in exactly the way overlay_only_flakes was.

Why it matters

It's the no-PSOT-branch fallback of binary_lookup_subject_predicate_refs_batched_v3 (:870, reached at :953), and that function's own doc comment at :868 says it serves policy rdf:type lookups and stats refresh.

So on a ledger with no PSOT branch yet, a policy that grants by class membership keeps granting on a type that was revoked, until the first index build. That's the fail-open direction.

The same lookup also feeds class attribution for fluree info: LedgerInfoStatsLookup::lookup_subject_classes (fluree-db-api/src/ledger_info.rs:466-481) → fluree_db_policy::lookup_subject_classes → class_lookup.rs:42 → lookup_subject_predicate_refs_batched → binary_range.rs:358 → binary_lookup_subject_predicate_refs_batched_v3 → :953 → here. So counts attributed to a class can include a subject whose rdf:type was retracted.

Scope, honestly

The trigger is narrower than #1683's: "no PSOT branch" rather than "bound component has no persisted id", so this is genesis and pre-first-index ledgers rather than any indexed one. But that is precisely the window the overlay-only paths exist to serve, and the policy consequence is the kind that shouldn't wait on an index build.

Suggested direction

apply_raw_overlay_deltas_to_batched_refs, directly above it at :1060, is already the correct rule — reuse it rather than writing a third variant. A guard test should assert that a same-window assert+retract of rdf:type does not report the class, on a ledger with no PSOT branch.

Activity

  1. added
    bug
    P1
    area:query
    on Aug 26, 2026
  2. added a commit that references this issue on Aug 26, 2026
    5d8e20a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1area:querybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions