← Back to Pull requests

fix: filter on meta.<time_field> in the CacheChecker TTL check #13985

Open
unknown opened this pull request with 318 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 28, 2026 16:35 UTC
Author

Related Issues

  • None. The TTL check came in with #12987, which no release contains yet (not in v3.6.0-rc0).
  • Proposed Changes:

    With ttl set, CacheChecker strips meta. from time_field and filters on the bare name. The docstring calls it a metadata field, which the filter docs spell meta.<name>. Only the legacy fallback in utils/filters.py, marked for removal, maps it to meta, so Qdrant and pgvector miss. The range conditions now use meta.<time_field>.

    Merged before 3.6, the bare-name filter never ships. I can fold the fixes note into #12987's enhancement note.

    # one document, meta={"url": ..., "cached_at": now (ISO)}; CacheChecker(store, cache_field="meta.url", ttl=3600)
    # main 979c6fd
    Qdrant (":memory:", qdrant-haystack 14.0.0)   -> misses: ['https://example.com']
    pgvector (pg17, pgvector-haystack 8.2.1)       -> DocumentStoreError: UndefinedColumn('column "cached_at" does not exist ...
    # this branch
    Qdrant                                          -> hits the document, misses: []
    pgvector                                        -> misses: []
    

    How did you test it?

    test_build_filters_with_ttl now expects meta.cached_at; a new test covers time_field="meta.cached_at".

    $ python -m pytest test/components/caching -q
    main 979c6fd:                 40 passed
    this branch:                  41 passed
    cache_checker.py reverted:    2 failed, 39 passed
    $ python -m pytest -m "not integration" test -q -o addopts=""
    main 979c6fd:                 54 failed, 7781 passed, 10 skipped
    this branch:                  54 failed, 7782 passed, 10 skipped
    # the same 54 on both: NLTK sentence-splitter tests, punkt data missing on this machine
    $ ruff check . && ruff format --check .      # ruff 0.17.6
    All checks passed! / 8642 files already formatted
    $ mypy --install-types --non-interactive haystack test   # mypy 2.4.1
    Success: no issues found in 573 source files
    # not run: integration tests
    

    Checklist

  • I have read the contributor guidelines and code of conduct.

  • I have updated the related issue: there is none.

  • I have added unit tests; docstrings unchanged.

  • I have documented my code.

  • I have used a conventional commit type for my PR title.

  • I have added a release note file.

  • I have run ruff and mypy, as quoted.
  • @bogdankostic, I would keep cache_field as given: "id" or "content" matches the Document attribute today. Both TTL examples in cachechecker.mdx pass cache_field="url", which needs the same fallback. Shall I switch them to "meta.url" in this PR?

    Diff: 318 lines (+238 / -80) across 3 files Reviewer: chrikrah Review duration: 3041m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 318 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.345
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #13985"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.5% · Safe to merge
    21.5%