Skip to content

fix: Resolve SortedFeatureView lookups and materialization in SqlRegistry - #386

Merged
piket merged 1 commit into
masterfrom
fix/sql-registry-sorted-feature-view-lookup
Oct 12, 2026
Merged

piket merged 1 commit into
masterfrom
fix/sql-registry-sorted-feature-view-lookup

Conversation

@piket

@piket piket commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

Fixes three bugs in SqlRegistry / SqlFallbackRegistry that break SortedFeatureViews. These are the registries behind eg-feature-store-registry and mlpfs-remote-registry.

1. get_any_feature_view never finds a SortedFeatureView

SqlRegistry._get_any_feature_view checks feature_views, then on_demand_feature_views, then stream_feature_views, then sorted_feature_views. The stream lookup passed not_found_exception=FeatureViewNotFoundException, so it raised before the sorted table was ever checked. Every get_any_feature_view call for a SortedFeatureView fails whenever the cache is cold or bypassed, including:

  • gRPC GetAnyFeatureView (used by RemoteRegistry.get_any_feature_view)
  • gRPC GetMaterializationIntervalHistory, which resolves the view for its permission check
  • utils._get_feature_views_to_use, the retrieval path, on a cache miss

Reproduced against the test mlpfs-remote-registry (read-only): GetAnyFeatureView for a sorted view returns NotFound with allow_cache=false. It only succeeds with allow_cache=true when the cache is already warm.

Fix: not_found_exception=None on the stream lookup. The final sorted lookup still raises FeatureViewNotFoundException for unknown names, so behaviour for missing views is unchanged.

2. apply_materialization corrupts SortedFeatureViews

_infer_fv_classes checked isinstance(fv, FeatureView) before SortedFeatureView, which is a FeatureView subclass. So apply_materialization read the row from sorted_feature_views (_infer_fv_table already had the right order) but decoded it with FeatureViewProto. SortedFeatureViewSpec.original_entities and FeatureViewSpec.feature_transformation are both field 15, so this either raises UnpicklingError / EOFError from dill, or, for a view with no entities, silently writes the row back without sort_keys. This is why eg-feature-store-registry#199 currently returns 501 for sorted-view materialization.

Fix: check SortedFeatureView before FeatureView, matching _infer_fv_table.

3. SqlFallbackRegistry.get_any_feature_view caches SortedFeatureViews in the wrong cache

It stored SortedFeatureViews in cached_feature_views. As a result, get_feature_view(name, allow_cache=True) could return a SortedFeatureView, and the plain-view cache refresh (which re-reads via _get_feature_view) evicted it as not found.

Fix: cache SortedFeatureViews in cached_sorted_feature_views.

Tests

9 new unit tests. The new tests fail without the fix (5 failures, 2 fixture errors) and pass with it.

  • test_sql_registry.py
    • get_any_feature_view returns a SortedFeatureView (with sort_keys), returns a plain FeatureView, and raises for an unknown name.
    • apply_materialization on a SortedFeatureView keeps sort_keys and sort order, caps intervals, archives history, and doesn't create a feature_views row.
    • SqlFallbackRegistry: a sorted view is cached in the sorted cache, get_feature_view(allow_cache=True) doesn't return it, and cached get_any_feature_view still does.
  • test_materialization_interval_history_rpc.py
    • GetMaterializationIntervalHistory and GetAnyFeatureView(allow_cache=false) handlers work for a SortedFeatureView.

Run locally:

  • tests/unit/infra/registry + feature view / sorted feature view unit tests: 96 passed
  • unit tests matching registry_server / sql_fallback / sorted: 73 passed
  • test_universal_registry.py (sqlite / local variants): 7 passed. Postgres/MySQL variants need Docker and are left to CI.
  • ruff check, ruff format --check, mypy on changed files: clean

Which issue(s) this PR fixes:

Misc

Follow-ups once released:

  • mlpfs-remote-registry: bump eg-feast. Fixes gRPC GetAnyFeatureView / GetMaterializationIntervalHistory for sorted views.
  • eg-feature-store-registry: bump eg-feast and remove the 501 guard for SortedFeatureViews in apply_materialization_interval, with its test.

Not in scope: gRPC ApplyFeatureView's permission check looks the view up with get_feature_view, which only searches plain views. It's skipped under write_auth_only, but would matter under full RBAC.

🤖 Generated with Claude Code

…stry

- _get_any_feature_view raised FeatureViewNotFoundException at the
  stream_feature_views lookup, so sorted_feature_views was never checked.
  Breaks get_any_feature_view for every SortedFeatureView on a cold or
  bypassed cache, including the GetAnyFeatureView and
  GetMaterializationIntervalHistory gRPC handlers.
- _infer_fv_classes checked FeatureView before its SortedFeatureView
  subclass, so apply_materialization decoded sorted rows with
  FeatureViewProto (UnpicklingError, or sort_keys silently dropped).
- SqlFallbackRegistry.get_any_feature_view cached SortedFeatureViews in
  cached_feature_views, so get_feature_view(allow_cache=True) could return
  one and the plain cache refresh evicted it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: piket <timonpike@gmail.com>

@Manisha4 Manisha4 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.

LGTM

@piket
piket merged commit f6a26e1 into master Oct 12, 2026
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.

2 participants