Repository navigation
Description
Three tutorial blocks build a second object from scratch where the prose says only one thing changes. PR #366 swept this pattern and converted every case whose target @set handles correctly today. These three were left alone because @set on their target silently produces a different object from the hand-built one (#369), and they need an edit here after the fix in #372 lands. None of them self-corrects.
The pages are correct and build as they are. What is missing is the demonstration, not correctness.
| Page | Block | Target | Why held |
|---|---|---|---|
docs/src/tutorials/split-observations.md |
cases and deaths, lines 52-59 |
Ascertainment.latent_model |
Ascertainment wraps its latent prior in a PrefixLatentModel at construction, so @set with an unwrapped prior skips the wrapping and the derived stream samples different variable names |
docs/src/tutorials/delays-dayofweek.md |
tv_observation at line 242, derived from observation at line 84 |
LatentDelay.delay |
LatentDelay stores its pmf reversed today, so @set on the delay stores an unreversed vector where the hand-built stores a reversed one. #372 changes the stored form |
docs/src/tutorials/patch-models.md |
independent, pooled, coupled at lines 51, 70 and 104 |
Renewal.rt |
Renewal bakes a recurrent_step at construction that @set leaves stale, giving an object matching neither the original nor the hand-built one |
docs/src/tutorials/time-varying-damping.md |
tv at line 35, derived from constant at line 22 |
AR.damp |
AR picks transform from the type of damp, tanh for a process and identity for a Distribution, so @set on the damp keeps identity where the hand-built gets tanh. Found while writing #366 and not part of the original #369 sweep, which only set same-type values |
Each is a one-line derivation once the target is safe, for example deaths = @set cases.model.latent_model = Intercept(Normal(log(0.015), 0.25)) in place of the second hand-built chain, and the narrating sentence above it goes at the same time.
Do not write a helper function instead. The idiom wanted here is define once, derive the variant.
Verify each conversion by building the derived object and the hand-built one in the same session and comparing them field by field, recursively. == and isequal both fall back to === at struct level and return false for structurally identical objects that hold different Vector instances, so neither is a usable check here.
This was opened by a bot. Please ping @seabbs for any questions.
Activity
seabbs-bot commentedon Sep 4, 2026
Correction to the premise for the fourth row: #372 does not clear the
ARcase. The other three are unblocked by it; this one is not, so do not pick the issue up as a single unit once #372 merges.#372 derives
pand re-derivesinitinside the inner constructor, but takestransformas given and never touches it. The default still lives only in the keyword constructor:So an
@seton.dampreconstructs through the inner constructor carrying the oldtransform, which is exactly the behaviour this row describes.Why it is not the same fix as the others
pis derived-only — no caller may legitimately disagree with it, so deriving it in the inner constructor is safe.transformis defaulted fromdampbut deliberately overridable:transform = identityon a process is a valid choice. Once stored as a concrete function, "the user choseidentity" and "it defaulted toidentity" are indistinguishable, so unconditional re-derivation would silently discard a deliberate override. That is a worse bug than this one and an invisible one.The distinction has to survive the fix. One shape that preserves it is to keep the derivation lazy rather than eager — a sentinel stored in the field and resolved where it is used, so an
@seton.dampcarries the sentinel through and resolves correctly, while an explicit function is preserved because it is a different value. That runs against #369's general direction of deriving at construction, which is correct for fields nobody may override and not for this one.Also worth recording
The property test on #372 passes over this field. It never sets
dampto a process, and bothDistributionandVector{<:Distribution}map toidentity, so the two sides agree by accident. Any test for this must cross all threePriorLikekinds, and should be seen to fail before the fix.This was opened by a bot. Please ping @seabbs for any questions.
seabbs-bot commentedon Sep 5, 2026
#390 does the three rows #372 unblocked, split, patch and delays, each verified field by field against the hand-built object.
The
AR.damprow stays open here, for the reason in the comment above:transformis defaulted fromdampin the keyword constructor only, and re-deriving it unconditionally would discard a deliberatetransform = identity.That needs a decision on how
ARrecords whethertransformwas chosen or defaulted before the page can derivetvfromconstant.Generated by Claude Code