Skip to content

fix(preprocessor): clear the stale mark after a successful fit - #139

Merged
mkumar73 merged 2 commits into
OpenTabular:mainfrom
xillig:fix/lifecycle-stale-after-fit
Nov 27, 2026
Merged

mkumar73 merged 2 commits into
OpenTabular:mainfrom
xillig:fix/lifecycle-stale-after-fit

Conversation

@xillig

@xillig xillig commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Problem

mark_stale() flags the current fitted state as outdated. Fitting the same object again replaced that state, but lifecycle_state_ kept reporting STALE with the old reason.

pre = Preprocessor().fit(df, y)
pre.mark_stale("drift")
pre.fit(df_new, y_new)
pre.lifecycle_state_  # 'STALE', expected 'FITTED'

Fix

A successful fit removes the mark; a fit that raises keeps it. The attribute is removed rather than reset to None, so to_spec() and fingerprint_ of a never-stale preprocessor are unchanged. FROZEN handling is untouched.

Tests and docs

Five tests in tests/integration/test_frozen_lifecycle.py (fit, fit_transform, failed fit, unchanged spec / fingerprint, spec round trip); the mark_stale docstring and reproducibility.md are updated.

Validation

Checks: full suite (2549 passed, 59 skipped, 7 xfailed, coverage >= 94.79%), ruff format / ruff check, pyright (no new diagnostics), docs build with -W, scripts/quickstart.py. Merges cleanly with main and with #136.

xillig and others added 2 commits November 11, 2026 05:32
mark_stale() flags the current fitted state as outdated. Fitting the same
object again replaced that state, but lifecycle_state_ kept reporting
STALE with the old reason, so a freshly fitted preprocessor looked
unusable.

A successful fit now removes the mark and the state returns to FITTED. A
fit that raises leaves the mark in place. The attribute is removed rather
than reset, so the spec and fingerprint of a never-stale preprocessor are
unchanged.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mkumar73 mkumar73 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@xillig , thank you for the contribution.

  • PR looks appropriate. CI, passed

Approved.

@mkumar73
mkumar73 merged commit 826e78e into OpenTabular:main Nov 27, 2026
19 checks passed
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.

3 participants