Skip to content

double_buffered variant-windows: make Hartwig config fit (Layer 1 estimate fix or grow-or-split) — follow-up to #315 #322

Description

@d-laub

Summary

Follow-up to #315. PR #320 shipped the slot-fit hardening (derived slot_overhead, actionable SlotOverflowError, backend×schema property test) and turns the Hartwig double_buffered variant-windows overflow into a fail-loud, actionable error. This issue tracks the remaining work: making that config actually fit instead of failing.

Why it's deferred

Phase 0 (see docs/superpowers/specs/2026-07-21-phase0-findings.md) established that Dataset._output_bytes_per_instance is already a verified per-instance upper bound for every record type reproducible with the synthetic generator across VCF/PGEN/SVAR on the released Haps path (n_variants() == len(to_packed()) == emitted windows; real − est is a per-chunk constant covered by slot_overhead). The design doc's hypothesized estimate↔to_packed() selection mismatch is structurally impossible on that path. The real Hartwig divergence could not be reproduced without the corpus, so there is no reproducible case to correct — and correcting the estimate on a guess is explicitly avoided.

Unblock paths (either)

  1. Pin on the real corpus. Run diag_315_realcorpus.py / the corrected phase0_scaling.py on the actual Hartwig dataset + reference at the failing params (flank_length=128, buffer_bytes=2 GiB, 40×7089). Capture the offending (r_idx, s_idx), its ilen/ALT/genotype pattern, backend, and whether d(real−est)/d(inst) > 0 (per-instance under-count) vs a per-chunk constant. That dump is the fixture recipe for a targeted _output_bytes_per_instance (variant-windows branch) upper-bound fix + a regression case added to tests/unit/test_slot_fit_property.py.
  2. Grow-or-split producer auto-recovery (currently a non-goal). Producer-side reallocation of a larger slot / chunk splitting on overflow — guarantees correctness without an exact estimate. Larger change; needs no Hartwig data.

Workaround today

Lower batch_size or raise buffer_bytes (the SlotOverflowError message states this).

Relates to #315.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions