Commit 97b0f25
fix: Feast apply silently ignoring ttl updates to None or timedelta(0) (#6709)
* fix: feast apply ignores ttl updates when new ttl is None or timedelta(0)
Fixes #6703. Registry._update_metadata_fields() routes ttl changes on
re-apply through a truthiness check:
if (... and updated_fv.ttl):
None and timedelta(0) are both the documented way to express "no
ttl", and both are falsy, so re-applying a FeatureView/LabelView with
ttl cleared silently kept the old finite ttl -- feast apply reported
the update but nothing changed in the registry.
Removing that outer truthy gate isn't sufficient by itself: for the
FeatureView branch, get_ttl_duration() returns Python None when
self.ttl is None, and the existing inner check
if ttl_duration:
existing_proto.spec.ttl.CopyFrom(ttl_duration)
would still silently skip CopyFrom in that case, leaving the stale
ttl in place. Fixed both by explicitly writing an empty Duration()
(which decodes back to timedelta(0), per FeatureView.from_proto's
existing ToNanoseconds()==0 check) whenever there's no real ttl to
write, instead of skipping the write.
The LabelView branch is adjusted the same way, guarding
FromTimedelta() against a None ttl now that the outer gate no longer
prevents ttl=None from reaching this branch.
Traced all three cases (None, timedelta(0), a finite value) through
the new branch logic in isolation and confirmed FeatureView and
LabelView now resolve identically: None and timedelta(0) both produce
a zero Duration, a finite ttl passes through unchanged.
Signed-off-by: saket3395 <sakettulsan95@gmail.com>
* address review nitpicks: hoist Duration import, guard FromTimedelta
- Move the Duration import to the top of the file with the other
google.protobuf imports, consistent with how Message and
RepeatedCompositeFieldContainer are already imported there.
- Wrap FromTimedelta() in the LabelView branch with a try/except,
re-raising as a ValueError naming the offending value, so an
invalid timedelta surfaces a clear error instead of a raw
protobuf exception.
Signed-off-by: saket3395 <sakettulsan95@gmail.com>
* test: cover ttl clearing in _update_metadata_fields (#6703)
Adds unit coverage requested in review:
- clearing a finite ttl to None or timedelta(0) now writes a zero
Duration (previously silently dropped)
- a finite-to-finite ttl update is preserved
_update_metadata_fields uses no instance state, so it is exercised
directly via the class, mirroring the FeatureView/FileSource/Field
construction used elsewhere in the unit tests.
Signed-off-by: saket3395 <sakettulsan95@gmail.com>
* style: apply ruff format to registry.py ttl block
Collapse the multi-line raise ValueError back to a single line per
ruff format (it fits within the 88-char limit), fixing the format
check.
Signed-off-by: saket3395 <sakettulsan95@gmail.com>
---------
Signed-off-by: saket3395 <sakettulsan95@gmail.com>
Co-authored-by: saket3395 <sakettulsan95@gmail.com>1 parent 7278dcf commit 97b0f25
2 files changed
Lines changed: 67 additions & 10 deletions
File tree
- sdk/python
- feast/infra/registry
- tests/unit/infra/registry
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
580 | 581 | | |
581 | 582 | | |
582 | 583 | | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
588 | 589 | | |
589 | 590 | | |
590 | | - | |
591 | | - | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
592 | 594 | | |
593 | | - | |
594 | | - | |
595 | 595 | | |
596 | | - | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
597 | 601 | | |
598 | 602 | | |
599 | 603 | | |
| |||
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments