fix(api): honor feature_frame_version >= 3 in ops + registry#339
Conversation
There was a problem hiding this comment.
Sorry @w7-mgfcode, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Root cause
Two feature-frame-version read helpers clamped any
Voutside{1, 2}down to1, so a run withfeature_frame_version >= 3was mis-classified as V=1:app/features/ops/service.py—_run_feature_frame_versionapp/features/registry/service.py—_extract_feature_frame_versionBoth did
if isinstance(value, int) and value in (1, 2): return valuethenreturn 1. Their docstrings ("Returns the int when the key is present, else V=1") and the registry SQL sibling_feature_frame_version_filter(which honors any int) were inconsistent with this clamp.Symptom (showcase_rich, fresh DB)
The
stale_alias_triggerstep registers a run withfeature_frame_version: 3and asserts thedemo-productionalias becomesstale_reason=feature_frame_version_mismatch. The clamp made the ops layer read the V=3 latest run as V=1, so_alias_stalenesssawalias_v(1) == latest_v(1)and returnednewer_success_run→ the decision-phase step failed and the run finished red.Fix
In both helpers, replace
value in (1, 2)withisinstance(value, int) and not isinstance(value, bool) and value >= 1— honor any positive int (matches the docstrings, the SQL filter, and the "opaque incrementing integer" model indocs/_base/DOMAIN_MODEL.md).boolis explicitly excluded (it subclassesint); non-int / zero / negative still resolve to V=1 (legacy back-compat).Tests
Updated the two tests that encoded the old clamp, and added regressions:
test_run_feature_frame_version_honors_any_positive_int— V=3 → 3;"2"/ 0 / -1 /True→ 1.test_alias_staleness_v1_alias_v3_latest_reports_mismatch— V1 alias + newer V3 latest →feature_frame_version_mismatch(the showcase scenario).test_extract_feature_frame_version_honors_any_positive_int— V=3 → 3, V=7 → 7;"2"/ 0 /True→ 1.(The
*_rejects_unsupported_valuetests previously asserted V=3 → 1 — they encoded the buggy clamp and are now corrected to the intended contract.)Validation
ruff check✅ ·ruff format --check✅mypy app/✅ — only pre-existingxgboostoptional-dep import errors in untouched filespyright app/features/ops app/features/registry✅ — only pre-existinglightgbm/xgboostoptional-dep import errorspytest -m "not integration"✅ 1651 passed, 12 skippedImpact note
Beyond unblocking a green
showcase_richrun, this corrects ops staleness verdicts and registry comparability/duplicate detection for any V≥3 run.Closes #338