← Back to Pull requests

[cleanup] Simplify cache_parquet internals #85

Closed
unknown closed this pull request without merging on Oct 20, 2026 22:51 UTC
View on GitHub
unknown unknown commented on Oct 20, 2026 00:34 UTC
Author

Description

Builds on #84; the nine [cleanup] commits are new here.

This simplifies the internals of cache_parquet in lazy_cache_parquet.py. Behaviour, the public API, and the on-disk layout and file names are unchanged. The module goes from 2187 to 2109 lines.

  • Remove code reached only by tests: the scan-path builder with the read-plan arguments that only it used, and key-handling arguments that were ignored.

  • Build partition file names in one function shared by the sink and the empty-file writes.

  • In the source generator, list the cache through one function, compute the partition-key scope at most once per query and only when expiry or REBUILD needs it, and look up the date dtype once.

  • Make always-passed helper arguments required and the sink arguments keyword-only, and drop an unused time_unit argument.

  • Find empty partitions by subtracting the written keys as strings instead of decoding them back into rows, which passed a strftime pattern where a template was expected.

  • Return only logical keys from the partition sink. The caller derives file names with the same function used elsewhere and subtracts the written keys from the gaps itself.

  • Add a "null" case to the test that rewrites reuse old partition file names, since writers before Polars 1.38 name null partitions null.
  • Each commit passes the cache_parquet tests on its own. Existing tests were updated where helper signatures changed.

    Type of Change

  • Bug fix

  • New feature

  • Documentation update

  • Refactor / code cleanup

  • CI / build configuration

  • Other (describe below)
  • Checklist

  • Linting passes (make lint-py, make lint-docs)

  • Tests pass (python -m pytest polars_io_tools/tests --ignore=polars_io_tools/tests/integration: 2027 passed with Polars 2.0.0, 2024 with Polars 1.44.1)

  • New tests added for new functionality

  • Documentation updated (if applicable)

  • Changelog / version bump (if applicable)
  • Diff: 247 lines (+185 / -62) across 3 files Reviewer: timkpaine Review duration: 1336m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 247 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    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.330
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #85"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 38.9% (MEDIUM) · Higher = larger blast radius
    38.9%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 16.8% · Safe to merge
    16.8%