-
Notifications
You must be signed in to change notification settings - Fork 0
Stage the renderer components, and stop a missing one being silent #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ | |
|
|
||
| import importlib.metadata | ||
| import logging | ||
| import os | ||
| import re | ||
| import threading | ||
| import time | ||
|
|
@@ -44,7 +45,7 @@ | |
| ParserAdapter, | ||
| RendererAdapter, | ||
| ) | ||
| from intentumdiff.plugins.exceptions import PluginFuelExhausted, PluginNotFoundError | ||
| from intentumdiff.plugins.exceptions import PluginFuelExhausted, PluginNotFoundError, PluginLoadError | ||
| from intentumdiff.plugins.language_metadata import fallback_language_info | ||
| from intentumdiff.plugins.loader import LoadedPlugin, load_plugin | ||
|
|
||
|
|
@@ -1046,6 +1047,7 @@ def _load_parsers( | |
| def _load_renderers(fuel: int = 10_000_000) -> list[RendererAdapter]: | ||
| """Discover and instantiate all registered renderer plugins.""" | ||
| adapters: list[RendererAdapter] = [] | ||
| failed: list[str] = [] | ||
| for ep in importlib.metadata.entry_points(group=_RENDERER_GROUP): | ||
| try: | ||
| wasm_path = _wasm_path_from_ep(ep) | ||
|
|
@@ -1056,6 +1058,22 @@ def _load_renderers(fuel: int = 10_000_000) -> list[RendererAdapter]: | |
| logger.debug("Loaded renderer plugin: %s (%s)", ep.name, wasm_path) | ||
| except Exception as exc: | ||
| logger.warning("Failed to load renderer plugin %r: %s", ep.name, exc) | ||
| failed.append(ep.name) | ||
| # A renderer that fails to load used to be a warning and nothing else: the adapter was | ||
| # simply omitted and every caller carried on with a smaller set. CI ran the whole suite | ||
| # with ZERO renderers and reported green - each test touching --format html|patch|llm| | ||
| # terminal was skipping, hitting a Python fallback, or asserting on degraded output, and | ||
| # nothing distinguished those from real coverage (#22). | ||
| # | ||
| # Opt-in rather than always-on, because a user with a partial install should still get a | ||
| # working diff - degrading is right for THEM and wrong for a gate. CI sets this so an | ||
| # incomplete component set stops the run where the cause is legible. | ||
| if failed and os.environ.get("INTENTUMDIFF_REQUIRE_ALL_COMPONENTS") == "1": | ||
| raise PluginLoadError( | ||
| f"{len(failed)} renderer plugin(s) failed to load: {', '.join(sorted(failed))}. " | ||
| "INTENTUMDIFF_REQUIRE_ALL_COMPONENTS=1 is set, so an incomplete component set is " | ||
| "an error rather than a silent downgrade - stage the components, or unset it." | ||
|
Comment on lines
+1072
to
+1075
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Whenever a renderer fails to load while Useful? React with 👍 / 👎. |
||
| ) | ||
| return adapters | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the newest successful core run belongs to another branch or commit, this unfiltered query selects its renderer artifact even though
stage_core()builds the native host fromCORE_REF; the publish workflow also invokes this mode when constructing PyPI wheels. This can therefore package renderer components from an incompatible revision, and any unpinned renderers will not be rejected by the checksum check. Filter the workflow runs using the exact revision staged inCORE_DEST, as the parser artifact flow already does.Useful? React with 👍 / 👎.