Skip to content

SleekDB adapter: support related-model criteria paths without changing public DBAL contract #508

@armanist

Description

@armanist

Summary

Add Quantum-level support in the SleekDB adapter for filtering by related model fields (join paths) while keeping the existing DbalInterface API unchanged.

Problem

With the current SleekDB execution model, root where criteria are evaluated before join data is attached. This means criteria like filtering users by related fields (e.g. profiles.firstname, nested paths like user_meetings.tickets.type) cannot be expressed with SQL-like semantics today.

Goal

Implement a contract-preserving enhancement in Quantum SleekDB adapter to route related-path criteria to appropriate join subqueries and prune unmatched parents.

Constraints

  • Do not change public method signatures in DbalInterface.
  • Preserve current behavior for root-only criteria and existing joins.
  • Keep backward compatibility with existing tests.

Proposed Phase-1 Semantics

  • Support AND across root and related-scope criteria.
  • Keep existing grouped criteria behavior in same scope.
  • Defer/reject ambiguous cross-scope OR semantics for now.

Acceptance Criteria

  • Root criteria continue to behave exactly as before.
  • Criteria with related paths are applied to join subqueries at correct depth.
  • Parent records are filtered out when constrained related branch has no match.
  • Existing SleekDB adapter tests remain green.
  • New tests cover:
    • single related path filter
    • deep related path filter
    • root + related AND combination
    • invalid relation path handling
    • unsupported cross-scope OR behavior (explicit failure or documented no-op)

Notes

This is a Quantum adapter enhancement on top of SleekDB internals and does not require upstream SleekDB changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions