Fix: audit logscale missing - #640
Conversation
LogScaleAnnotations.post_rule_annotations! errors when :logscale was never set and inputs are not all PointMass. When MessageMapping short-circuits result to missing (any inbound message/marginal is missing), no rule ran, so the post-rule processors must not run on a deferred message. Guard the loop so a legitimately-deferred message propagates instead of crashing.
The fix in the previous commit shipped without a test. Adds coverage in `test/annotations/logscale_tests.jl` for a node whose rule input is not a `PointMass` and whose body never sets `@logscale` -- the exact configuration in which `LogScaleAnnotations` would `error()`. Three testsets, structured so the important one cannot pass vacuously: * A control asserting that a *concrete* non-PointMass message still reaches the processor and still errors. Without this, the `missing` test below would also pass if the processor simply stopped running altogether. * The actual regression: a `missing` message comes back as `missing`, and carries no `:logscale` -- no log-scale is invented for a message that never went through a rule. * A deferred message multiplied against a concrete one, in both orderings. That last testset also documents something worth recording: this fix is *sufficient* on its own. A `missing`-data message does still reach `compute_product_of_two_messages`, which calls `post_product_annotations!` unconditionally -- but the generic `post_product_annotations!` already dispatches on `::Missing` for `left_dist`/`right_dist` (src/annotations.jl) and copies the other side's annotations through without consulting the per-processor method. So `LogScaleAnnotations.post_product_annotations!` is never reached with an absent `:logscale`, and no `KeyError` replaces the original `error`. The test pins that behaviour so a future change to those dispatches cannot silently reintroduce the crash one layer down. Regression gate: with `src/message.jl` reverted to its pre-fix state the two `missing` testsets error out; the control testset passes in both runs. Also records the fix in CHANGELOG.md, which the original commit omitted. Refs ReactiveBayes#623 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
8ca7d88 to
aebeeb9
Compare
|
Maintainer review — the defect is real and the one-line fix is correct. I have rebased this branch and pushed a regression test plus a CHANGELOG entry (thanks for enabling maintainer edits). Rebased to a single concernAs submitted, this branch sat on top of #641's GCV commit, so its diff included Verified reachableConfirmed by code trace: One correction to the reasoning, in the fix's favourI initially expected this fix to be insufficient — a It does not, and the reason is worth recording: the generic Regression test added
The control testset passes in both runs. Note on the submitted descriptionThe PR body listed |
Whitespace and line-wrapping only, produced by `make format`; no logic change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
[Verified audit fix] — branch
fix/audit-logscale-missing.Commit:
Skip post-rule annotation processors when rule short-circuits to missingChanges
src/message.jl | 5 ++++-
src/rules/gcv/w.jl | 6 +++---
2 files changed, 7 insertions(+), 4 deletions(-)
Verification
Confirmed against
mainin the ReactiveBayes audit (Julia 1.12.6); sources verified read-only. See the branch diff.