Skip to content

fix: preserve Friday equity bars during weekend validation - #88

Merged
stefan-jansen merged 2 commits into
mainfrom
fix/equity-friday-weekend
Oct 15, 2026
Merged

stefan-jansen merged 2 commits into
mainfrom
fix/equity-friday-weekend

Conversation

@stefan-jansen

@stefan-jansen stefan-jansen commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Closes #87

Outcome

Equity asset validation now flags only Saturday and Sunday as weekend data. Polars dt.weekday() returns ISO day numbers, so the prior >=5 predicate incorrectly included Friday. The production change is one threshold, >=6.

The public AssetValidator.validate regression exercises valid NYSE/SPY OHLCV rows on each Monday-Friday date and asserts no issues. Saturday/Sunday cases assert the exact weekend issue, preserving weekend detection rather than disabling the check.

Failing base and passing fix

  • Affected base/main and immutable v0.2.1: 6888629.
  • Regression-only commit: 0cbe5de. Its production src tree is identical to the affected base. With this commit checked out, uv run --no-sync pytest tests/assets/test_validation.py::TestValidateEquity -q -ra exits 1: Friday fails, eight cases pass.
  • Fixed head: bf9743e. The same regression command passes all nine cases.
  • Exact audit reproduction: datetime(2025, 7, 11, 10), OHLC 100/101/99/100, volume 1000, AssetInfo(symbol="SPY", asset_class=AssetClass.EQUITY, exchange="NYSE"). Before the fix validate returns {'equity_specific': ['Found 1 weekend data points']} instead of {}.
  • Verified locally with Polars 1.43.2.

Verification

  • Asset, crypto and cross-validation tests with ResourceWarning as an error: 156 passed.
  • Repository-wide Ruff, format (336 files), ty and diff checks: passed.
  • All 26 applicable PR-head public checks passed, including the full supported-platform test/package matrix, coverage, strict documentation and security. One validated Python 3.15 exception lane is intentionally skipped.
  • Full local offline suite: 3,774 passed, 292 deselected, 85.99% coverage. Public coverage lane: 3,774 passed, 86.00% coverage.
  • Full local ResourceWarning-as-error lane: 3,774 passed, 292 deselected.
  • Actionlint, all-file pre-commit, strict MkDocs, development wheel/sdist builds, twine and isolated artifact installs with dependency/import/CLI/README verification passed.
  • Merged main 28677d6 passed all four applicable workflows, with 24 successful checks and two explained skips (PR-only dependency review and the validated Python 3.15 exception). No failed or pending checks remain.

Scope

No calendar API/configuration, provider policy, timezone or holiday architecture changes. Published v0.2.1 and its immutable artifacts are untouched. No new release or documentation deployment is authorized by this repair.

Primary API reference

https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.dt.weekday.html

AI assistance

AI assisted with reproduction, regression tests and the focused repair. The maintainer owns the executed verification and review.

Copilot AI balanced review requested due to automatic review settings October 15, 2026 20:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@stefan-jansen
stefan-jansen merged commit 28677d6 into main Oct 15, 2026
27 checks passed
@stefan-jansen
stefan-jansen deleted the fix/equity-friday-weekend branch October 15, 2026 20:58
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.

fix: do not classify Friday equity bars as weekend data

2 participants