Skip to content

fix: propagate __options__ to child Context for multi-/named-output submodels - #316

Open
docxology wants to merge 1 commit into
ReactiveBayes:mainfrom
docxology:fix/multioutput-submodel-options
Open

fix: propagate __options__ to child Context for multi-/named-output submodels#316
docxology wants to merge 1 commit into
ReactiveBayes:mainfrom
docxology:fix/multioutput-submodel-options

Conversation

@docxology

Copy link
Copy Markdown

Description

Fixes #1. When a composite submodel is called with a multi-output ((a, b) ~ sub(...)) or
named-output ((a = x, b = y) ~ sub(...)) left-hand side, the generated make_node!
built the child Context without the NodeCreationOptions from the where { ... } clause.
The single-output path already passes it. As a result inline where { constraints = ... }
(and any compound-context option) was silently ignored for those submodels.

Change

src/model_macro.jl — in both generated composite make_node! bodies:

- __context__ = GraphPPL.Context(__parent_context__, $ms_name)
+ __context__ = GraphPPL.Context(__parent_context__, $ms_name, __options__)

(Tuple-LHS path, previously line ~860; NamedTuple-LHS path, previously line ~882.)

Tests

Added a regression test in test/plugins/variational_constraints/variational_constraints_tests.jl
asserting that a multi-output submodel call with where { constraints = ... } exposes the
expected Constraints via get(context_options(inner_context), :constraints, nothing) and
materializes the requested factorization — mirroring the existing single-output
"inline constraints on submodel calls" test.

Verification

  • test/plugins/variational_constraints/variational_constraints_tests.jl: pass
  • test/multi_and_zero_output_tests.jl: pass

…bmodels

Inline where { constraints = ... } (and other context options) were silently
dropped for multi-output and named-output submodel calls because the generated
make_node! built the child Context without NodeCreationOptions. Mirror the
single-output path.
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.

hierarchical composition of models

1 participant