Skip to content

feat: Raise early errors when sampling - #433

Open
Oliver Borchert (borchero) wants to merge 2 commits into
mainfrom
early-error
Open

Oliver Borchert (borchero) wants to merge 2 commits into
mainfrom
early-error

Conversation

@borchero

Copy link
Copy Markdown
Member

Motivation

Fixes #429.

Thanks Brendan Cooley (@brendancooley) for raising :)

@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (51af31b) to head (9196981).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #433   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           46        46           
  Lines         2601      2615   +14     
=========================================
+ Hits          2601      2615   +14     

☔ 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.

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.

🟡 Changes recommended

Sampling validation can incorrectly reject valid samples because selector dependencies are missed and empty-column projections discard the intended row count.

2 open issues
What changed in this PR

This PR addresses #429 by making Schema.sample reject invalid overrides early and report more relevant sampling failures.

Changes:

  • Validate rules determined entirely by fixed overrides before sampling.
  • Report failures from the last sampling iteration using shared formatting.
  • Add tests for early errors, override holes, and cross-column checks.
File Description
tests/​schema/​test_sample.py Updates error expectations and adds override-validation tests.
dataframely/​schema.py Adds early override checks and improves sampling failure reporting.

Review effort: Balanced

Comment thread dataframely/schema.py Resolved
Comment thread dataframely/schema.py Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 2, 2026 01:46

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.

🔵 Needs a closer look

Prevalidation loses the row count when every override column contains holes, causing column-independent rules to reject valid overrides or accept impossible sampling requests.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Reduce the fail-fast regression test to one sampling iteration

tests/​schema/​test_sample.py:276

If fail-fast validation regresses, this test can run one million sampling rounds before failing, potentially tying up CI for hours. The expected early-error message already distinguishes prevalidation from iteration exhaustion, so one iteration is sufficient and makes regressions fail quickly.

2 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
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] Schema.sample fails fast when overrides are invalid

2 participants