Skip to content

fix: evaluate only the requested metadata comparator - #11

Merged
haolpku merged 1 commit into
OpenDCAI:mainfrom
DivyamTalwar:codex/dm-01-comparator-dispatch
Sep 17, 2026
Merged

haolpku merged 1 commit into
OpenDCAI:mainfrom
DivyamTalwar:codex/dm-01-comparator-dispatch

Conversation

@DivyamTalwar

Copy link
Copy Markdown
Contributor

@haolpku

Summary

Metadata filters now evaluate only the comparator requested by the caller.

Root cause

matches_metadata built a dictionary of all eight boolean comparator results before selecting op. For numeric equality or ordering, the unrelated membership expression could raise TypeError; for string membership, an unrelated ordering expression could fail. The broad handler then converted valid matches into false negatives.

Change

  • Replace eager boolean-map construction with explicit comparator dispatch.
  • Preserve existing negative-match and malformed-operand handling.
  • Keep nested $and/$or, scalar shorthand, and supported operator validation unchanged.

Regression coverage

The new tests cover true and false cases for all eight operators plus nested boolean filters, including the original numeric equality, numeric greater-than, and string membership witnesses.

Verification: python -m pytest -q — 211 passing, 5 optional SDK tests skipped.

No dependencies, public filter schema, or provider behavior outside comparator dispatch changed.

Please review and merge if CI confirms the focused fix.

@DivyamTalwar

Copy link
Copy Markdown
Contributor Author

@haolpku — Could you please review this focused metadata-comparator fix and merge it if CI confirms the full no-network suite?

@haolpku
haolpku merged commit 767cef5 into OpenDCAI:main Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants