Skip to content

feat(features): implement lifecycle compute method (#109)#111

Merged
w7-mgfcode merged 1 commit into
devfrom
feat/featuresets-lifecycle
May 12, 2026
Merged

feat(features): implement lifecycle compute method (#109)#111
w7-mgfcode merged 1 commit into
devfrom
feat/featuresets-lifecycle

Conversation

@w7-mgfcode
Copy link
Copy Markdown
Owner

Summary

Lands PRP-3.1B — the lifecycle compute slice for time-safe featuresets.

  • Adds FeatureEngineeringService._compute_lifecycle_features (private method).
  • Wires it at step 6 of compute_features, gated on self.config.lifecycle_config.
  • Defensive no-op when launch_date / discontinue_date columns are absent from the input DataFrame — emits an info log and returns zero new columns. End-to-end loader extension (joining product attrs) lands in PRP-3.1E.
  • Two features when fully configured:
    • days_since_launch_lag{N} (lagged per (store_id, product_id))
    • days_since_discontinue_lag{N} (signed delta — LightGBM learns the sign; do not clip)

Time-safety

  • Uses the canonical groupby(entity).shift(lag) idiom — row i reflects only data at row i - lag.
  • No changes to test_leakage.py invariants for the existing families.

Scope

  • Files touched: service.py, tests/test_leakage.py, tests/test_service.py (3 files, +304/-0).
  • No schemas.py / routes.py / conftest.py / migration / docs edits.
  • Additive-contract snapshot (config_hash_unchanged_when_phase2_omitted) still passes.

Test plan

  • ruff check + ruff format --check
  • mypy --strict app/
  • pyright --strict app/
  • pytest -v on the slice (82 tests pass)
  • CI green on PR

Refs

Part of #109 (Phase 2 feature wiring). PRP-3.1E will land the loader extension that actually populates launch_date / discontinue_date from the product table.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Sorry @w7-mgfcode, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ac49956d-c103-4d55-a0c9-b2fbc1135504

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/featuresets-lifecycle

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant