Repository navigation
fix(plugins): isolate malformed plugins and proposals, warn on duplicate names, honour late network opt-in - #379
Merged
Merged
Conversation
…ate names, honour late network opt-in Plugin failures escaping isolation (#297): - _cap_and_stamp drops proposals for a column the plugin was not given (an expert's own column; a backend's frame columns) instead of letting them reach the executor, where they raised KeyError. Logged once per plugin so a confused expert does not warn for every column. - The provenance merge and dataclasses.replace are guarded: a proposal with non-mapping provenance is logged and dropped rather than raising. A non-string risk is ranked as "high", as unknown risks already were. - _max_risk requires a string, so unhashable metadata such as max_risk=["low"] falls back to the documented "high" default instead of raising TypeError. - _ensure_entry_points registers each entry point inside its own try. Previously a _register failure escaped after _entry_points_loaded was set, so every later entry point in the group was never registered. - A plugin raising inside propose() stays isolated (unchanged). Duplicate plugin names (#298): - _register logs a WARNING naming the replaced and replacing plugin when a name is reused within a kind. Last registration still wins, as docs/plugins.md describes; re-registering the same object is silent. Late FRESHDATA_ALLOW_NETWORK_PLUGINS opt-in (#299): - A network-using plugin registered without allow_network=True is stored with network_blocked=True. Every registry accessor re-reads the environment variable, so setting it after registration activates the plugin and unsetting it deactivates it again. allow_network=True stays unconditional, missing dependencies still win, and without the variable network plugins remain inactive (offline by default). Tests in tests/test_plugin_isolation.py cover each issue's reproduction; docs/plugins.md describes the dropped proposals, entry-point skipping, the duplicate-name warning and when the variable is read. Closes #297 Closes #298 Closes #299
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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 |
FreshData benchmark report —
|
| fixture | n_rows | n_cols | p50 s | p95 s | peak MB | repair % | false-repair % | preserve % | trust | monotonic | export % |
|---|
Authored-code reduction (Metric 6)
This was referenced Sep 15, 2026
kevincostner17
added a commit
that referenced
this pull request
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three plugin-registry bugs in
src/freshdata/plugins.py.KeyErrorin apply._max_riskfalls back to the documented"high"default for non-string or unhashable values.try, so one malformed entry point is skipped and the rest of its group still registers.propose()stay isolated.allow_network=Trueare markednetwork_blocked. Every registry accessor re-readsFRESHDATA_ALLOW_NETWORK_PLUGINSat call time, so setting the variable after registration activates the plugin. Without it, network plugins stay inactive (offline by default is unchanged). A missing dependency still keeps a plugin inactive.docs/plugins.mdnow covers dropped off-target or malformed proposals, entry-point skipping, the duplicate-name warning, and when the environment variable is read.Behaviour changes
FRESHDATA_ALLOW_NETWORK_PLUGINSlater also turns an env-enabled network plugin off again; plugins registered withallow_network=Trueare unaffected.logging, as the module already does).Tests
New
tests/test_plugin_isolation.py:propose()stays isolated.max_riskfalls back to"high".caplog, including the same-object and cross-kind cases.1; unsetting it deactivates env-gated plugins;allow_network=Truedoes not depend on the variable; missing dependencies still win.Verification
ruff check .: passed.mypy src/freshdata: no issues.pytest -m "not online and not large":tests/test_plugins.pyand example plugin contracts): passed.Closes #297
Closes #298
Closes #299