Skip to content

Overlay-flake translation silently drops novelty-only subjects/strings instead of routing them to the raw-flake lane #1563

Closed

Description

@zonotope

Summary

The overlay-to-V3 translation lane in fluree-db-query/src/binary_scan.rs routes a flake to the raw-flake fallback (untranslated) only when its translation fails with ErrorKind::Unsupported. Any other error kind — notably the NotFound that resolve_subject_v3/resolve_string_v3 return for a value present in neither the persisted nor the novelty dict — is dropped (with at most a tracing::warn!), producing silent wrong results with no raw fallback.

The generic-xsd:duration arm (PR #1544) works around this by deliberately returning Unsupported on a dict miss so its overlay flakes survive. That fixes durations but does not close the class: the next value type whose translation can miss the dict re-discovers the same drop.

Detail

Both collection sites gate on Unsupported only:

translate_overlay_flakes_with_untranslated (:2535-2541):

Err(e) => {
    if e.kind() == std::io::ErrorKind::Unsupported {
        untranslated.push(flake.clone());
    } else {
        tracing::warn!(error = %e, "failed to translate overlay flake to V3");
    }
}

and the cached-translation twin (:2616):

Err(e) if e.kind() == std::io::ErrorKind::Unsupported => {
    untranslated.push(flake.clone());
}

translate_one_flake_v3_pub resolves the subject via resolve_subject_v3 (:2744), which returns NotFound when the subject is in neither dict. A Ref-object flake likewise resolves through resolve_subject_v3, and the String/Json/langString arms resolve through resolve_string_v3, which returns NotFound on a dict miss. Every one of those NotFounds hits the else/non-Unsupported branch above and is dropped — so an overlay flake whose subject (or string/ref object) is novelty-only, and therefore absent from the persisted dict, is silently discarded rather than merged via the raw-flake path.

Impact

Silent wrong results (missing rows) for overlay flakes referencing a subject or string/ref object that exists only in novelty. Bounded to the overlay-translation path (uncommitted novelty over a binary base). Durations are already safe (they route Unsupported); this is about the remaining arms.

Proposed fix

Route all translation failures to untranslated, not just Unsupported. The raw-flake lane preserves the flake's full identity and is the correct fallback for "can't express this in V3 keys yet" regardless of why. This also makes the per-arm Unsupported-vs-NotFound choreography (the load-bearing error kind documented on the duration arm) unnecessary: with every failure falling back, the arm-level distinction collapses to "return any error → raw fallback".

If some error kinds genuinely should hard-fail the query rather than fall back (a real dict/mmap I/O error, say — see the find_string_id_v3 split in PR #1544 that keeps real I/O errors distinct from a miss), keep those propagating; route only the "value not expressible in V3" kinds (Unsupported, NotFound) to untranslated.

Acceptance criteria

  • An overlay flake whose subject is novelty-only (absent from the persisted dict) appears in query results via the raw-flake lane rather than being dropped.
  • Both collection sites (:2535 and :2616) agree on which error kinds fall back.
  • A regression test asserts an overlay query over a novelty-only subject/string returns the expected rows.

Notes

Surfaced by @bplatz in review of PR #1544 ("the hazard is live for the other arms too … should the else branch push to untranslated as well?"), seconded by @aaj3f as deserving an explicit decision. Confirmed pre-existing and independent of the duration fix; filed as a follow-up per the reviewers' request.

Activity

  1. aaj3f commented on Aug 25, 2026

    @aaj3f
    Contributor

    Housekeeping note from a full-backlog verification sweep (claude-assisted, verified at 47e96b7b6): it seems this one was fixed out from under the backlog by #1477 (f5daaad2f — authored 7/11, still in flight when this issue was filed). Every failed overlay translation now keeps the raw flake at the whole-graph site; the segment-cache twin declines caching on any non-Unsupported error and falls back to that fixed path; and the range-provider path was already keep-raw. So the per-arm Unsupported-vs-NotFound choreography this issue flags is obsolete at the collection sites — which is exactly the outcome the issue proposed.

    The fix commit also carries a white-box detached-dict differential (equal totals with a correct vs detached DictNovelty), so the silent-drop class is regression-pinned, not just patched.

    Closing as fixed by #1477 — if I've misread the remaining surface here, happy to reopen.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions