Repository navigation
Description
#302 (right-align a stream's data in both directions) and #319 (marginalise absent observations) both rewrite the two scoring loops in ObservationErrorModels/methods.jl. Neither branch contains the other, and the merge conflicts in exactly the place that matters.
Recording this before either merges, because the obvious resolution — take the newer branch's side — is a latent BoundsError.
The two changes
# #302 adds a guard so the scored window cannot start before the data
_scored_steps(diff_t, Y_t) = max(1, 1 - diff_t):length(Y_t)
# #319 rewrites the same loops to skip absent entries, keeping the old bound
for i in eachindex(Y_t)
idx = i + diff_t
y.present[idx] || continueeachindex(Y_t) is only safe while diff_t >= 0. #302 exists to make diff_t < 0 reachable: that is the case where the expected series is longer than the data, which is what removes the caller's structural padding.
Measured
Merging the two branches gives three conflicts in methods.jl, two of them precisely _scored_steps(diff_t, Y_t) against eachindex(Y_t). On a sparse series of the shape #299 describes, 120 days with 33 measured and a 24-step chain lead-in:
carrier = MissingObservations{Vector{Float64}, BitVector}
present count = 33 of 120
diff_t = -24
_scored_steps = 25:144 # idx = i + diff_t -> 1:120, in bounds
eachindex(Y_t) = 1:144 # idx = i + diff_t -> -23:120, OUT OF BOUNDS
With #302's guard the same model evaluates and reports 0 y_t latents, which is #319 working as intended.
Also diverging in the same file
_TrialDist differs too. #302 adds an n_diff field and reads d.N_t[i + d.n_diff] so a BinomialError's trials right-align like its observations; #319 carries main's d.N_t[i]. Git resolves that one in #302's favour on its own, but only because #319 happens not to touch the line. It is worth checking rather than assuming after any rebase.
Resolution
Keep #319's marginalisation body and #302's _scored_steps bound. The two are complementary once reconciled: #302 decides which steps are in the scored window, #319 decides what happens at a step whose observation is absent.
Whichever merges second should carry a test with diff_t < 0 and a partially-missing carrier together. Neither branch has one today, because on each branch alone that combination is unreachable.
This was opened by a bot. Please ping @seabbs for any questions.
Activity
merge fix/285-split-lead-in into fix/marginalise-missing-observations
seabbs-bot commentedon Aug 26, 2026
Resolved on the branches. #319 now has #302 merged into it and its PR base retargeted to
fix/285-split-lead-in, so the two cannot land in the broken order.The resolution is the one this issue proposes: #319's marginalisation body with #302's
_scored_stepsbound.Two things worth recording that this issue did not anticipate.
#302's other changes had to be ported by hand. A three-way resolve on
methods.jldrops prose from whichever side loses the hunk, so the two-way alignment docstring, both dropped@assert diff_t >= 0, and_TrialDist'sn_diffwere applied explicitly on top of #319's file rather than picked from a conflict.There was a second clash, and it is quieter than the
BoundsError.BinomialError right-aligns its trials with the data, a test from #302, asserts0 <= out.y_t[2] <= N_data[2]for a gap, with a comment saying "the gap is drawn against the trials of the day it falls on". That is the pre-marginalisation behaviour. Merged, the gap comes backmissingand the assertion throws:Neither branch is wrong. The test encodes semantics #319 deliberately removes, and nothing could see it until the two met. It is now rewritten to assert the gap is
missingand to pin the alignment with a log-joint rather than a bounds check, which the original did not actually do.The regression test this issue asks for is added:
a longer expected series marginalises a carrier's gaps.Closing once #302 and #319 land, since the fix lives on those branches rather than on
main.This was opened by a bot. Please ping @seabbs for any questions.