Skip to content

refactor: post-phase-3 consolidation (behaviour-preserving, witness-proven)#10

Merged
Jammy2211 merged 4 commits into
mainfrom
refactor/post-phase3-consolidation
Jul 9, 2026
Merged

refactor: post-phase-3 consolidation (behaviour-preserving, witness-proven)#10
Jammy2211 merged 4 commits into
mainfrom
refactor/post-phase3-consolidation

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Behaviour-preserving consolidation after three fast instrument phases, per #8. Default present-and-wait run; maintainer approved plan and ship in-session (incl. Heart-YELLOW acknowledgement of the same pre-existing reason set as PRs #3/#5/#7).

Proof of preservation

End-to-end witnesses re-run after the refactor against baselines captured immediately before it (same cached inputs, offline):

Witness data.fits noise_map.fits psf.fits psf_full.fits reduction.json
ACS slacs0008-0004 byte-identical byte-identical byte-identical byte-identical identical mod timestamps
JWST F444W ring byte-identical byte-identical byte-identical byte-identical identical mod timestamps

85/85 unit tests (incl. a new randomized equivalence test for the vectorized crowding rejection). Public API unchanged.

The refactor

  • pipeline.reduce_target decomposed into per-stage functions (_acquire_evict) sharing a _StageContext; record layout/key order unchanged.
  • autoreduce/validation/parity.py: sub-pixel registration + parity statistics extracted from the integration scripts (both thinned onto registered_ratios, a superset of the originals).
  • drizzle/_common.py: chdir_scratch context manager + combine_provenance (canonical key order) shared by both combine backends.
  • psf/stars.reject_crowded vectorized (broadcasted distance matrix, identical selection semantics).
  • Dead imports pruned; comments clarified.

Disclosed fix riders (found by the witness baselines themselves)

  1. CPDIS/fobj: the footprint filter crashed on ACS FLC headers (lookup-table distortion needs the open HDUList) — a phase-3 regression on the ACS path that JWST data never trips.
  2. ePSF extraction window +20: photutils 2.3 crashes (malformed overlap_slices) when recentering drift overruns the +10 window; +20 restores its designed warn-and-skip. JWST ePSFs shift marginally with the wider window (disclosed on refactor: post-phase-3 consolidation (behaviour-preserving) #8); baselines were captured with both riders in, so the refactor's byte-identity claim is unaffected.

Gate legs

  1. Tests: 85/85. Downstream n/a (no dependents). 2. Smoke: n/a (stated). 3. Review: finder pass → 3 cosmetic findings, fixed; head/tail provenance contract, API surface, and untouched-path checks explicitly cleared. 4. Heart: YELLOW (6 pre-existing organism reasons, unrelated); maintainer acknowledged at ship approval.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WNhuuvZLgZjHvWBGdhUst3

Jammy2211 and others added 4 commits July 9, 2026 11:27
…distortion)

Phase-3 regression: covers_target broke the ACS path — FLC headers
carry lookup-table distortion astropy can only resolve with fobj; JWST
cal files don't, so the four-band integration never tripped it. Caught
by the refactor witness baseline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WNhuuvZLgZjHvWBGdhUst3
…rash

Drifting stars at maxiters=10 hit a malformed overlap_slices inside
photutils 2.3 when the fitting region overruns the +10 window; +20
restores its designed warn-and-skip handling. Broke the ACS path on
main (star set changed by the phase-2/3 selection fixes); JWST ePSFs
shift marginally with the wider window — disclosed on issue #8.
edge_margin follows the window (46).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WNhuuvZLgZjHvWBGdhUst3
- reduce_target decomposed into per-stage functions with a _StageContext;
  record layout and key order unchanged.
- autoreduce/validation/parity.py extracts sub-pixel registration +
  ratio statistics; slacs0008 and cosmos_web_ring scripts thinned onto
  it (registered_ratios is a superset of both originals).
- drizzle/_common.py: chdir_scratch context manager + combine_provenance
  (canonical key order preserved); both backends rewritten onto them.
- reject_crowded vectorized (broadcasted distance matrix); randomized
  equivalence test against the original loop.

85 tests. Witness byte-comparison vs _baseline_refactor follows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WNhuuvZLgZjHvWBGdhUst3
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