Skip to content

CIP: give the master sample mask a name it keeps - #357

Merged
oshaughnessy-junior merged 1 commit into
rift_O4dfrom
claude/cip-indx-ok-scope
Sep 19, 2026
Merged

oshaughnessy-junior merged 1 commit into
rift_O4dfrom
claude/cip-indx-ok-scope

Conversation

@oshaughnessy-junior

@oshaughnessy-junior oshaughnessy-junior commented Sep 16, 2026 •

Copy link
Copy Markdown
Owner

Cleanup found while reviewing #355. Not a live bug. Rebased onto 4adf96500.

indx_ok had two meanings

The master post-integration mask is applied to samples[p], dat_logL, joint_prior and
joint_s_prior. Six later blocks rebound the same name for local cuts: three spin-prior
range cuts, three "significant points" subsets in the corner plots. Nothing reads the master
mask after those four applications, so nothing was wrong; a new block indexing with indx_ok
would get an array of the right length and the wrong meaning, with no error. Renamed to
indx_in_range and indx_significant. The fit-point mask earlier in the file keeps its
name: it has one meaning and is dead before the master mask is built.

#361 walked into this while I had the branch open. It added
indx_ok = np.logical_and(indx_ok, divisible_sampling_density(...)) to two of these blocks,
chaining off the local cut, and gave the cartesian branch's version its own name indx_pw.
Same instinct, and the rebase carries those lines over as indx_in_range.

The driver diff contains no executable change. Un-rename the branch and its AST equals
4adf96500, token for token. That check alone cannot see a missed occurrence, since
un-renaming is idempotent, so the new guard covers that half: it fails if any indx_ok read
survives past the mask. Neither new name appears anywhere upstream, so no binding is captured.

The dead elif is left dead

Two branches of the reweighting chain have byte-identical conditions, so the second never
runs. 3dc31ff53 added both in one commit and copy-pasted the guard, and the intent is
recoverable: the first is labelled "Uniform sampling" and leaves prior_weight alone, the
second divides it out, which is what --pseudo-uniform-magnitude-prior-alternate-sampling
needs.

I first dropped the not, arguing the branch stays unreachable behind the
CODE PATH NOT YET WORKING sys.exit(0). Adversarial review showed that is wrong: the exit
is an elif on chiz_plus that s1z claims first, so

--parameter s1z --parameter chiz_plus --parameter chiz_minus
--pseudo-uniform-magnitude-prior --pseudo-uniform-magnitude-prior-alternate-sampling

slips past it. Measured: base exits 0, the guard edit exits 1 on KeyError: 's1y' after the
integral is paid for, because the body reads samples["s1x"] and ["s1y"], which an
aligned-spin chiz coordinate set does not have. The branch is reachable only where it raises.

Reverted. The branch stays dead and the comment records the intent, why a guard edit does not
deliver it, and not to retry without fixing the body.

Verified on this base

Check Result
driver AST, renames undone, vs 4adf96500 equal, no residual difference
.travis/test-posterior.sh, incl. the plotting arm exit 0
new guard on 4adf96500 vs on this branch fails / passes
.travis/test-ci-roster.py PASS

Tests

test_cip_indx_ok_scope.py, static, over CIP and util_ConstructEOSPosterior.py, wired into
.travis/test-posterior.sh. It asserts the anchor exists, that indx_ok is never rebound
after the mask is applied, that later reads only re-mask another samples[...] entry, and
that no helper rebinds it via global. The EOS driver already passes; it is in scope because
a repo-wide sweep found exactly two module-level dat_logL = dat_logL[mask] sites.

Adversarial review found three holes in an earlier version of the guard, all fixed: a foreign
re-mask passed, a helper one indent deeper was invisible while a top-level one went red on
correct code, and a missing driver skipped rather than failed. Mutants caught: each rename
reverted, a missed load, a foreign re-mask, a global rebind, a missing driver, the anchor
removed. A correct top-level helper stays green. Unmutated control on both sides, in a
throwaway worktree.

Gate 7c: skipped deliberately

No production-style multi-stage run. The driver diff has no executable change, so nothing an
operator types can reach different behaviour. RO agreed. If one is ever wanted, the settings
are in ~/pr223_e2e/S240426s_batchmode/common_args.txt.

🤖 Generated with Claude Code

@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift September 16, 2026 14:22 — with GitHub Actions Active
@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift September 17, 2026 12:39 — with GitHub Actions Active
@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift September 17, 2026 12:52 — with GitHub Actions Active
@oshaughnessy-junior oshaughnessy-junior changed the title CIP: give the master sample mask a name it keeps, and wake a dead elif CIP: give the master sample mask a name it keeps Sep 17, 2026
`indx_ok` names the master mask, applied to samples[p], dat_logL, joint_prior and
joint_s_prior.  Six later blocks rebound the same name for throwaway local cuts: three
spin-prior range cuts in the reweighting chain, and the "significant points" subset in
three corner-plot blocks.  Nothing read the master mask after its four applications, so
this was a trap rather than a bug -- a new block indexing with `indx_ok` gets an array of
the right length and the wrong meaning, with no error.  The local cuts are now
indx_in_range and indx_significant.  Un-rename the result and its AST equals base.

The reweighting chain also has two elif branches with byte-identical conditions, so the
second never runs.  3dc31ff added both in one commit and copy-pasted the guard, and the
intent is recoverable.  It is NOT fixed here.  Dropping the `not` reaches a body that reads
samples["s1x"]/["s1y"], which an aligned-spin chiz coordinate set does not have, so a CLI
combination that completes today dies on KeyError instead -- the CODE PATH NOT YET WORKING
exit does not cover it, being an elif on 'chiz_plus' that `s1z` claims first.  The branch
stays dead and the comment carries the anti-instruction.

test_cip_indx_ok_scope.py pins the naming, statically, over CIP and the EOS driver, and
runs in .travis/test-posterior.sh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@oshaughnessy-junior
oshaughnessy-junior marked this pull request as ready for review September 19, 2026 12:57
@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift September 19, 2026 12:57 — with GitHub Actions Active
@oshaughnessy-junior
oshaughnessy-junior merged commit d6ba261 into rift_O4d Sep 19, 2026
35 of 36 checks passed
@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift September 19, 2026 13:34 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
private-review-dispatch-rift — f9e75c30 Deployed Sep 19, 2026 by oshaughnessy-junior via Dispatch exact RIFT PR generation #1425
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.

1 participant