Title: fix: Avoid importing feast.feature_store at mcp_server import time by larrysingleton007 · Pull Request #6634 · feast-dev/feast · GitHub
Open Graph Title: fix: Avoid importing feast.feature_store at mcp_server import time by larrysingleton007 · Pull Request #6634 · feast-dev/feast
X Title: fix: Avoid importing feast.feature_store at mcp_server import time by larrysingleton007 · Pull Request #6634 · feast-dev/feast
Description: What this PR does / why we need it: feast/infra/mcp_servers/mcp_server.py imported feast.feature_store.FeatureStore at module load, but used it only for a type annotation on add_mcp_support_to_app. Because the feast.infra.mcp_servers package __init__ eagerly imports mcp_server, importing the package pulled the entire feature_store import graph in as a side effect. Under parallel unit-test collection (pytest -n), that heavy import intermittently raced with an in-progress feature_store import and failed collection of tests/unit/infra/feature_servers/test_mcp_server.py with KeyError: 'feast.infra.mcp_servers.mcp_server'. The tests pass in isolation, so it shows up as a flaky unit-test-python failure. Moving the import under TYPE_CHECKING with a forward-reference annotation removes feature_store from mcp_server's module-load path, so importing mcp_server no longer triggers that graph. Public API and the annotation are unchanged. Which issue(s) this PR fixes: Fixes #6633 Checks I've made sure the tests are passing. My commits are signed off (git commit -s) My PR title follows conventional commits format Testing Strategy Unit tests Integration tests Manual tests Testing is not required for this change test_mcp_server.py passes (23), and feast.infra.mcp_servers still exposes add_mcp_support_to_app and McpFeatureServerConfig. ruff and mypy clean. Misc Release note: NONE. As an outside contributor I can't apply labels, so a maintainer will need to add kind/bug and run ok-to-test.
Open Graph Description: What this PR does / why we need it: feast/infra/mcp_servers/mcp_server.py imported feast.feature_store.FeatureStore at module load, but used it only for a type annotation on add_mcp_support_to_app....
X Description: What this PR does / why we need it: feast/infra/mcp_servers/mcp_server.py imported feast.feature_store.FeatureStore at module load, but used it only for a type annotation on add_mcp_support_to_app....
Opengraph URL: https://github.com/feast-dev/feast/pull/6634
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:954935b8-63b0-b3c1-dc9f-dcd2a4fe751e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9A04:84C13:100F705:153C60B:6AFE9E4E |
| html-safe-nonce | ec3f6f8f045b12cb32d823e8934f9d18f9decf29918ebd373b63d0075e3b479d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTA0Ojg0QzEzOjEwMEY3MDU6MTUzQzYwQjo2QUZFOUU0RSIsInZpc2l0b3JfaWQiOiIyMDE4ODY1OTEwNjA4OTkzODcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 69dffc0004185cf8b33ba09a35efd95df052b748f72b3e5a27508c4035bdc425 |
| hovercard-subject-tag | pull_request:4113467692 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/feast-dev/feast/pull/6634/files |
| twitter:image | https://avatars.githubusercontent.com/u/166439969?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/166439969?s=400&v=4 |
| og:image:alt | What this PR does / why we need it: feast/infra/mcp_servers/mcp_server.py imported feast.feature_store.FeatureStore at module load, but used it only for a type annotation on add_mcp_support_to_app.... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/feast-dev/feast git https://github.com/feast-dev/feast.git |
| octolytics-dimension-user_id | 57027613 |
| octolytics-dimension-user_login | feast-dev |
| octolytics-dimension-repository_id | 161133770 |
| octolytics-dimension-repository_nwo | feast-dev/feast |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 161133770 |
| octolytics-dimension-repository_network_root_nwo | feast-dev/feast |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width