Skip to content

DRAFT: LISA ILE driver — portfolio policy + AV state/collapse safety (passes 4–5a, stacked on #99) - #100

Closed
oshaughnessy-junior wants to merge 5 commits into
claude/lisa-l0-rescuefrom
claude/lisa-sampler-plumbing
Closed

DRAFT: LISA ILE driver — portfolio policy + AV state/collapse safety (passes 4–5a, stacked on #99)#100
oshaughnessy-junior wants to merge 5 commits into
claude/lisa-l0-rescuefrom
claude/lisa-sampler-plumbing

Conversation

@oshaughnessy-junior

@oshaughnessy-junior oshaughnessy-junior commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Draft. Consolidated passes 4–5a, stacked on #99 (which is stacked on #98). The head branch was safely fast-forwarded from #100 through #101; no history was rewritten.

Closes 17 of the 108 remaining drift items (gap 108 → 91):

  • 12 portfolio freeze/allocation-policy options;
  • --sampler-save-state, --sampler-load-state, --sampler-anisotropic-bins, --reject-collapsed-live-volume, and _reject_if_collapsed.

Portfolio policy

The named CLI options now reach mcsamplerPortfolio.setup(). Unset values stay out of the override dict so sampler defaults remain authoritative; zero remains a meaningful value; and --portfolio-varaha-can-freeze wins over --portfolio-varaha-never-freeze.

AV state and collapse safety

State load/save and anisotropic-bin allocation are wired into both LISA event variants. State is now saved only after the result guard and collapse gate accept the run. A rejected or failed L0 rescue marks its warm grid non-persistable, while the marker resets at the start of every later event so one rejection cannot suppress a healthy future save.

The collapse gate runs once per event variant. The main driver also gates a later replica pool; that second site remains explicitly deferred with --mc-error-replicas, which this driver does not yet implement.

Adversarial-review correction

The original #100 layer exposed --nf-flow-load/save, but LISA's portfolio factory cannot construct an NF member and the portfolio aggregate has no load_flow/save_flow API. Those flags and dead hooks were removed. The drift ledger records them as PORT until NF member construction and member-directed persistence land together.

Validation

  • 160 stacked LISA drift/fair-draw/rescue/plumbing/AV tests pass.
  • 123 plumbing + AV + rescue tests pass.
  • Driver and modified tests compile.
  • Generated drift ledger matches its rule source.
  • git diff --check is clean.

The full local LISA script reached 188 passes; its six failures are environment-only subprocess failures from missing NumPy/igwn_ligolw in the selected host Python. #98's full GitHub Actions matrix, including lisa-check, is green. This consolidated draft should receive a full matrix before it is marked ready.

Still deferred

  • NF member construction plus flow persistence.
  • The seven --internal-gmm-* options, which require an ecliptic-sky grouping decision.
  • MC-error replicas and their second collapse-gate call site.

…low persistence

Pass 4 of the catch-up (pass 3, MC-error replicas, deferred).  Closes 14 of the 108
remaining gap items (gap 108 -> 94).

Pure pass-through to samplers this driver ALREADY wires: it exposes the same
ok_lnL_methods as the main driver and builds mcsamplerPortfolio the same way, and its
portfolio setup block was byte-identical to main's apart from the missing kwargs.  Before
this the knobs were reachable only through --sampler-portfolio-args, an eval-able dict;
the pipeline passes the named flags.

Option definitions are copied verbatim, and a test asserts default/type/action/choices
match the main driver's for all 14.  A knob that means something different in the two
drivers is worse than a missing one: the same pipeline command line would otherwise
produce two different integrations.

The freeze-policy assembly is inline in both drivers rather than a function, so the tests
extract the block and exec it against a fake opts -- testing the real source rather than a
paraphrase.  That covers the property the assembly exists for: an option left UNSET must
stay out of the dict so the sampler keeps its own default, and 0 (which disables
probing/reviving) is a REAL value that truthiness would silently drop.

NF flow load/save go through _maybe_load_nf_flow / _maybe_save_nf_flow for the same reason
the L0 rescue did: this driver has TWO analyze_event variants, and wiring only one would
be a silent half-port.  A test asserts both get both hooks and that they straddle the
integration in the right order.

TESTS.  test_lisa_sampler_plumbing.py (55), wired into lisa-check.  Revert-checked with 7
mutations: a drifted default, a dropped `is not None` guard, inverted VARAHA precedence, a
dict that never reaches setup(), a lost hasattr guard, a misplaced save hook, and an
unguarded NF exception.

The hasattr mutation came back WEAK and the test was rewritten.  Asserting "does not
raise" was worthless there: the body is wrapped in `except Exception`, so dropping the
guard still does not raise -- it announces "loading pre-trained flow", calls a method that
does not exist, and swallows the AttributeError, so every non-NF run would log a flow load
that never happened.  The test now asserts the hook stays SILENT for a sampler with no
flow support.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift August 16, 2026 01:01 — with GitHub Actions Active
…collapse gate

Pass 5a of the catch-up.  Closes 5 of the 94 remaining gap items (gap 94 -> 89):
--sampler-save-state, --sampler-load-state, --sampler-anisotropic-bins,
--reject-collapsed-live-volume, and _reject_if_collapsed.

All four are sampler-agnostic.  The saved state is the AV sampler's own live-volume grid,
which carries no detector convention; the bin allocation is per-axis on that same grid.

THE ONE THING TO CARRY FORWARD.  The main driver calls its collapse gate TWICE -- on the
first run AND on the replica pool, because replication can turn a healthy first run into a
collapsed POOL, and gating only the first would silently bypass the flag for exactly the
case pooling introduces.  This driver has no replica pooling yet, so only the first call
exists here.  That is recorded in the helper's docstring, in the drift ledger, and in a
test that asserts the warning is still written where whoever ports --mc-error-replicas
will be working.

The helpers are hoisted to module level rather than nested (as _reject_if_collapsed is in
main), because this driver has TWO analyze_event variants and nesting would mean two
copies.  A test pins the hoisted body AST-identical to main's nested one.

THIS EXPOSED A FALSE POSITIVE IN THE DRIFT AUDIT, now fixed.  It compared FUNC items by
QUALIFIED name, so main's analyze_event._reject_if_collapsed did not match this driver's
correctly-hoisted top-level _reject_if_collapsed, and the item would have sat in the gap
forever no matter how well it was ported.  A gate that cannot be satisfied is a gate people
learn to ignore.  FUNC items are now matched on the bare name as well.

TESTS.  test_lisa_av_state.py (27), wired into lisa-check.  Revert-checked with 8
mutations: the lost AV-method restriction on save, bins not reaching portfolio members,
bins ceasing to be opt-in, a gate that ignores its flag, a gate that fires on healthy runs,
a collapse that is no longer announced, the gate moved before the not(res) guard, and
deletion of the second-call-site warning.  Each caught by its named test; file restored
byte-identical.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift August 16, 2026 11:00 — with GitHub Actions Active
@oshaughnessy-junior oshaughnessy-junior changed the title DRAFT: LISA ILE driver — portfolio freeze/allocation policy + NF flow persistence (pass 4, stacked on #99) DRAFT: LISA ILE driver — portfolio policy + AV state/collapse safety (passes 4–5a, stacked on #99) Aug 16, 2026
@oshaughnessy-junior

Copy link
Copy Markdown
Owner Author

Superseded by #106, which consolidates this stack onto current rift_O4d (d904e72d), adds RO's review commit, and fixes what an adversarial audit found. Content is included there; closing to leave one PR for the review cycle.

@oshaughnessy-junior
oshaughnessy-junior deployed to private-review-dispatch-rift August 16, 2026 11:18 — with GitHub Actions Active
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