feat(provider): wire system options with mixing_kernels#56
Merged
jc-macdonald merged 6 commits intomainfrom Apr 8, 2026
Merged
feat(provider): wire system options with mixing_kernels#56jc-macdonald merged 6 commits intomainfrom
jc-macdonald merged 6 commits intomainfrom
Conversation
Add a Mapping[str, Any] meta field to CompiledRhs with an empty MappingProxyType default. Existing callers are unaffected — the field is optional and backward-compatible. Part of #11.
Pass rhs.meta to CompiledRhs in compile_rhs(), preserving axes, kernels, and operators metadata through the compile pipeline. Part of #11.
Verify that: - compile_rhs preserves axes and kernels metadata - bare specs produce empty meta collections - compile_spec facade round-trips meta end-to-end Refs: #11
Populate self.options = {"mixing_kernels": ...} in model_post_init()
so that op_engine can retrieve kernels via system.option("mixing_kernels").
Refs: #42
CompiledRhs.meta is now guaranteed to exist (added in feat/11-compile-meta-threading). Replace defensive hasattr checks with direct attribute access.
Add tests for: - bare SIR spec exposes empty mixing_kernels dict - spec with gaussian kernel exposes it via system.option() Refs: #42
TimothyWillard
approved these changes
Apr 8, 2026
Collaborator
TimothyWillard
left a comment
There was a problem hiding this comment.
Minor comment, take it or leave it.
I am a bit confused, does this need to be caught back up with main? I think some of the changes here were merged via #53.
Comment on lines
-104
to
+111
| coords = np.asarray(ax.get("coords", np.arange(size)), dtype=np.float64) | ||
| raw_coords = ax.get("coords", None) | ||
| try: | ||
| coords = ( | ||
| np.asarray(raw_coords, dtype=np.float64) | ||
| if raw_coords is not None | ||
| else np.arange(size, dtype=np.float64) | ||
| ) | ||
| except (ValueError, TypeError): | ||
| coords = np.arange(size, dtype=np.float64) |
Collaborator
There was a problem hiding this comment.
I think the current version could also be simplified with:
coords = np.arange(size, dtype=np.float64)
try:
coords = np.asarray(raw_coords, dtype=np.float64)
except (TypeError, ValueError):
passBut what ValueError/TypeError are you expecting here? Something along the lines of raw_coords being a list of strings? In that case maybe something like:
coords = np.asarray(raw_coords)
if not np.can_cast(coords, np.float64):
coords = np.arange(size, dtype=np.float64)
coords = coords.astype(np.float64, copy=False)
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
Wires
self.optionsin the op_system provider so thatsystem.option("mixing_kernels")works as expected by op_engine.Changes
Commit 1:
feat(provider): wire self.options with mixing_kernelsself.options = {"mixing_kernels": mixing_kernels}inmodel_post_init()after kernel constructionCommit 2:
refactor(provider): remove hasattr guards for compiled.metahasattr(compiled, "meta")introspection guards —CompiledRhs.metais now guaranteed (PR feat(compile): thread meta from NormalizedRhs through CompiledRhs #53)"mixing"→"kernels"(bug found and fixed)np.asarray(["a","b"], dtype=float64)raises ValueError — added try/except fallback tonp.arange(size)(bug found and fixed)Commit 3:
test(provider): verify options expose mixing_kernelstest_option_mixing_kernels_bare_spec— bare spec produces empty kernel listtest_option_mixing_kernels_with_kernel— spec with gaussian kernel populates correctlyTesting
All 5 provider tests pass. Lint clean.
Related
feat/11-compile-meta-threading)operatorsandoperator_axisoptions in provider #54 (wireoperators/operator_axis)