Skip to content

feat: Allow FailureInfo to persist only failing rule columns - #400

Open
Danila Pechenev (Danila-Pechenev) wants to merge 1 commit into
Quantco:mainfrom
Danila-Pechenev:feat/failure-info-only-invalid-rules
Open

feat: Allow FailureInfo to persist only failing rule columns#400
Danila Pechenev (Danila-Pechenev) wants to merge 1 commit into
Quantco:mainfrom
Danila-Pechenev:feat/failure-info-only-invalid-rules

Conversation

@Danila-Pechenev

Copy link
Copy Markdown

Motivation

Fixes #296.

Persisted FailureInfo objects can become very wide because they include an output column for every validation rule, even when most rules never fail.

Changes

  • Add the keyword-only only_invalid_rules option to FailureInfo.write_parquet().
  • When enabled, persist all data columns but only rule columns containing at least one False.
  • Keep the parquet metadata consistent with the retained rule columns.
  • Preserve existing lossless behavior by default.
  • Support round-tripping reduced empty failure information.
  • Document that the reduced representation intentionally omits successful and unknown-only rule outcomes.

Testing

  • Added coverage for failing, successful, unknown, and empty rule columns.
  • Added eager-read and lazy-scan round-trip coverage.
  • Added repeated reduced-serialization coverage.
  • Verified counts and co-occurrence counts remain unchanged.

@Danila-Pechenev Danila Pechenev (Danila-Pechenev) changed the title Allow FailureInfo to persist only failing rule columns feat: allow FailureInfo to persist only failing rule columns Sep 6, 2026
@github-actions github-actions Bot added the enhancement New feature or request label Sep 6, 2026
@Danila-Pechenev Danila Pechenev (Danila-Pechenev) changed the title feat: allow FailureInfo to persist only failing rule columns feat: Allow FailureInfo to persist only failing rule columns Sep 6, 2026
@Danila-Pechenev
Danila Pechenev (Danila-Pechenev) marked this pull request as ready for review September 6, 2026 17:41
Copilot AI lite review requested due to automatic review settings September 6, 2026 17:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation matches the stated behavior, keeps parquet metadata consistent, preserves default lossless behavior, and includes targeted tests and documentation for key edge cases.

Pull request overview

This PR adds an opt-in serialization mode to reduce the width of persisted FailureInfo parquet files by writing only rule-output columns that actually contain at least one failing (False) value, addressing issue #296.

Changes:

  • Added keyword-only only_invalid_rules to FailureInfo.write_parquet() to omit always-successful / unknown-only rule columns when enabled.
  • Adjusted FailureInfo.details() to handle the edge case of an empty rule_columns list.
  • Added tests and documentation covering reduced serialization, metadata consistency, and round-tripping (including empty failure info).
File summaries
File Description
tests/failure_info/test_parquet.py Adds fixtures and tests for reduced parquet serialization, metadata, and round-trip behavior (eager + scan).
docs/guides/features/serialization.md Documents the new only_invalid_rules=True option and its intentionally lossy semantics.
dataframely/filter_result.py Implements only_invalid_rules in FailureInfo.write_parquet() and handles empty rule-columns in details().
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution Danila Pechenev (@Danila-Pechenev)! Just some small suggestions

Comment on lines +131 to +133
if len(self._rule_columns) == 0:
return self.invalid()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Comment on lines +184 to +187

Setting ``only_invalid_rules`` produces a reduced, intentionally lossy
representation that omits rule columns containing only successful or unknown
outcomes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument is already documented below

Suggested change
Setting ``only_invalid_rules`` produces a reduced, intentionally lossy
representation that omits rule columns containing only successful or unknown
outcomes.

Args:
file: The file path or writable file-like object to which to write the
parquet file.
only_invalid_rules: Whether to write only rule columns containing at least

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

Suggested change
only_invalid_rules: Whether to write only rule columns containing at least
only_failing_rules: Whether to write only rule columns containing at least

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2b03dad) to head (1ada3f9).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #400   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           46        46           
  Lines         2590      2598    +8     
=========================================
+ Hits          2590      2598    +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add an argument to FailureInfo.write_parquet(only_invalid_rules: bool = False)

3 participants