Skip to content

fix: Keep HybridOnlineStore routing_tag across FeatureViews - #6769

Merged
ntkathole merged 4 commits into
feast-dev:masterfrom
jang-hs:fix/hybrid-online-store-routing-tag
Nov 18, 2026
Merged

ntkathole merged 4 commits into
feast-dev:masterfrom
jang-hs:fix/hybrid-online-store-routing-tag

Conversation

@jang-hs

@jang-hs jang-hs commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #6768

What this fixes

HybridOnlineStore.update() applies the first FeatureView and then fails on the second, no matter how the views are tagged:

ValueError: FeatureView must have a 'tribe' tag to use HybridOnlineStore.

The message reports 'tribe' even when the repo config sets a custom routing_tag, because that string is the fallback in

tag_name = getattr(config.online_store, "routing_tag", "tribe")

Getting the fallback means config.online_store is no longer the HybridOnlineStoreConfig by the time the second view is read. In practice this makes the store unusable for any repo with more than one FeatureView.

Root cause

1. _prepare_repo_conf mutated the caller's RepoConfig. rconfig = config is an alias, not a copy, so rconfig.online_config = ... and the data = rconfig.__dict__ writes all landed on the caller's object — replacing online_store with the selected backend's config. It also injected type into online_store.conf, which belongs to the user's config and is read again on the next lookup.

2. update() and teardown() rebound the config parameter inside their loops. Even with (1) fixed, the next iteration would receive the narrowed config instead of the hybrid one.

online_write_batch() and online_read() rebind as well, but those are single-use per call; fixing (1) is what makes them safe, so they are left as they are to keep the diff small.

The change

  • _prepare_repo_conf builds its result from dict(config.__dict__) and constructs a new dict for the backend conf instead of injecting into the caller's. The returned kwargs are identical to what the mutating version produced — online_config and online_store are both set to the selected backend's conf, exactly as before — so nothing downstream changes.
  • update() and teardown() assign the per-backend RepoConfig to a local store_config rather than rebinding config.

Tests

New unit test at sdk/python/tests/unit/infra/online_store/test_hybrid_online_store.py:

  • test_update_routes_every_feature_view — two views with a custom routing_tag, one per backend; asserts both backends' update() are called once and the caller's routing_tag survives.
  • test_prepare_repo_conf_does_not_mutate_caller_config — asserts the caller's online_store object and its conf dict are untouched.

Both fail on master and pass with this change:

# master
E   ValueError: FeatureView must have a 'tribe' tag to use HybridOnlineStore.
E   AssertionError: assert {'redis_type'...ype': 'redis'} == {'redis_type'...calhost:6379'}
2 failed

# with this change
2 passed

ruff check, ruff format --check, and mypy are clean on both files (the mypy errors that remain in the tree are pre-existing and in other modules).

The existing sdk/python/tests/integration/online_store/test_hybrid_online_store.py covers the write/read path; I could not run it locally as it needs testcontainers/Docker, but this change does not alter the config those paths receive.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes HybridOnlineStore configuration mutation when processing multiple FeatureViews.

Changes:

  • Builds backend configurations without mutating the caller.
  • Preserves the hybrid configuration across update and teardown iterations.
  • Adds regression tests for multi-backend routing and immutability.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
hybrid_online_store.py Preserves hybrid routing configuration.
test_hybrid_online_store.py Adds regression coverage.
Suppressed comments (2)

sdk/python/tests/unit/infra/online_store/test_hybrid_online_store.py:35

  • Add the return annotation required for Python function signatures.
def repo_config():

sdk/python/tests/unit/infra/online_store/test_hybrid_online_store.py:70

  • Add parameter and return annotations to this new Python function signature.
def test_update_routes_every_feature_view(repo_config, entity):

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jang-hs
jang-hs force-pushed the fix/hybrid-online-store-routing-tag branch 2 times, most recently from 2d401f9 to 9d8a2c1 Compare August 25, 2026 11:53
@jang-hs

jang-hs commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@franciscojavierarceo @ntkathole Could you approve the workflow runs on this PR? All checks are stuck on "action_required" since this is my first PR here, so none of them have run yet.

Would appreciate a review afterwards — this fixes HybridOnlineStore dropping routing_tag when iterating over multiple FeatureViews (the backend config was being mutated in place), with regression tests for multi-backend routing and config immutability.

@codecov-commenter

codecov-commenter commented Sep 17, 2026 •

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.
✅ Project coverage is 53.33%. Comparing base (69ac7b0) to head (8aa637b).
⚠️ Report is 1 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6769      +/-   ##
==========================================
+ Coverage   53.19%   53.33%   +0.14%     
==========================================
  Files         459      459              
  Lines       58400    58396       -4     
  Branches     8627     8625       -2     
==========================================
+ Hits        31065    31145      +80     
+ Misses      25224    25140      -84     
  Partials     2111     2111              
Flag Coverage Δ
go-feature-server 30.96% <ø> (ø)
python-unit 54.89% <100.00%> (+0.15%) ⬆️
Files with missing lines Coverage Δ
..._stores/hybrid_online_store/hybrid_online_store.py 82.79% <100.00%> (+82.79%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 69ac7b0...8aa637b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jang-hs jang-hs changed the title fix: keep HybridOnlineStore routing_tag across FeatureViews fix: Keep HybridOnlineStore routing_tag across FeatureViews Sep 17, 2026
@jang-hs

jang-hs commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@franciscojavierarceo @ntkathole The failing "Validate PR title" check ran against the old lowercase title. I've since fixed it to sentence case, but the re-run is stuck on "action_required". Could you approve the workflow runs so the checks can pass? The Copilot review comments are all addressed.

@jang-hs

jang-hs commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

@franciscojavierarceo @ntkathole I updated the branch with the latest master (no conflicts), which put the workflow runs back into "action_required". All checks, including the PR title check, had passed on the previous head. Could you approve the runs again when you have a moment? A review would be much appreciated too. Thanks!

@jang-hs

jang-hs commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

@ntkathole @franciscojavierarceo I merged the latest master into the branch again (no conflicts), which puts the workflow runs back into "action_required". Could you approve them and take a look at the change when you get a chance? It keeps HybridOnlineStore's routing_tag from being lost when multiple FeatureViews are processed.

@jang-hs

jang-hs commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@shuchu @ntkathole Gentle ping. The workflow runs are waiting on approval ("action_required"); all checks passed on an earlier head. Could one of you approve them and review the change? It keeps HybridOnlineStore's routing_tag from being lost when multiple FeatureViews are processed, and each backend now only gets its own FeatureViews in update/teardown.

@ntkathole
ntkathole force-pushed the fix/hybrid-online-store-routing-tag branch from 9fbd38b to e4d492f Compare November 17, 2026 05:47
HybridOnlineStore.update() applied the first FeatureView and then failed on
the second with

  ValueError: FeatureView must have a 'tribe' tag to use HybridOnlineStore

no matter how the views were tagged. The message reports 'tribe' — the
fallback, not the configured routing_tag — because config.online_store is no
longer the HybridOnlineStoreConfig by the time the second view is read.

Two causes:

1. _prepare_repo_conf mutated the caller's RepoConfig. `rconfig = config` is
   an alias, so both the attribute assignment and the __dict__ writes landed
   on the caller's object and replaced online_store with the selected
   backend's config. It also injected `type` into online_store.conf, which
   belongs to the user's config.

2. update() and teardown() rebound the `config` parameter inside their loops,
   so the next iteration read routing_tag off the narrowed config even once
   the mutation was gone.

Build the returned mapping from a copy, construct a new dict for the backend
conf, and assign the per-backend RepoConfig to a local name in the loops.
Behaviour is otherwise unchanged: the returned kwargs are identical to what
the mutating version produced.

Adds a unit regression test covering both the multi-FeatureView routing and
the caller's config staying intact. Both fail on master.

Signed-off-by: Jade <retrorca@gmail.com>
Backends act on every FeatureView handed to them, so passing the full
keep/delete lists made e.g. SQLite create tables for Redis-routed views,
and teardown let each backend drop another backend's tables.

- group FeatureViews by routing tag once, call each backend with only its
  own subset
- update() now also reaches a backend that has deletions but no kept
  views; previously it was never called and its tables were never dropped
- teardown() drops the (tribe, type, id(conf)) dedup set: grouping already
  gives one call per backend, and the old dedup skipped the second view
  routed to the same backend

Signed-off-by: Jade <retrorca@gmail.com>
Per review feedback on the fixtures and test functions. The whole file is
covered rather than only the flagged lines, so the signatures stay
consistent.

No behaviour change; `ruff check` and `ruff format --check` pass on
sdk/python/feast and sdk/python/tests.

Signed-off-by: Jade <retrorca@gmail.com>
Codecov flagged the new _group_by_routing_tag branches as the only
uncovered lines in the patch: nothing exercised an untagged FeatureView
or a tag value with no configured backend.

- update() raises naming the *configured* routing tag, not the "tribe"
  default, when a kept view is untagged — that wrong name was the
  symptom this PR set out to fix
- update() skips an untagged view in tables_to_delete instead of raising
- update() raises NotImplementedError for a tag no backend claims
- teardown() skips such a tag rather than failing

_feature_view() takes Optional[str] so a view can be built without the
tag. No production change; 9 tests pass, patch coverage is now complete
(branch partials on the changed lines go to zero).

Signed-off-by: Jade <retrorca@gmail.com>
@ntkathole
ntkathole force-pushed the fix/hybrid-online-store-routing-tag branch from 8aa637b to 03bebdf Compare November 18, 2026 11:59
@ntkathole
ntkathole merged commit 4782ba3 into feast-dev:master Nov 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HybridOnlineStore loses routing_tag after the first FeatureView, so feast apply fails

5 participants