Skip to content

fix(#84): hygiene sweep — audit P2+P3, areas a1-a8 - #135

Merged
marzukia merged 3 commits into
mainfrom
pi-bg/20261015-233556-2119820
Oct 16, 2026
Merged

marzukia merged 3 commits into
mainfrom
pi-bg/20261015-233556-2119820

Conversation

@monkytheluffy

Copy link
Copy Markdown
Collaborator

Issue #84 (2026-10-09 audit): 51 P2 + 29 P3 findings, areas a1-a8. 1 commit + review-minor follow-up, 29 files, +1700/-250 vs main.

Intended behaviour changes (each pinned in tests/test_audit_84.py, +46 tests)

  • a1: unknown --compress codec → exit 2 + written-tag readback guard; empty --out → exit 2; malformed --calibration → named exit 2; non-numeric role columns named in the error; run_summary volumetrics now sized from the final output-CRS raster (was the work grid).
  • a2: corrupt parquet → named exit 1; duplicate role columns → exit 2; Pipeline rejects the five named typos as unexpected keywords (were silently ignored).
  • a3: count lock scoped to accumulation (byte-identical output); non-default work/out CRS pair one-shot warning; PPGRID_FORCE_MEMMAP documented.
  • a4: wall-range keyed on regime+workers; hard-kill temp cleanup gains the unnameable globs; failed turbo run discards fresh calibration.json.
  • a5: grid_index_mt actually used for workers > 1 (provably bit-identical to the serial index, reviewer-verified); saturation <= 0 → ValueError; downsample_sum shape-validated.
  • a6: CPLCompressor struct version checked before pfn read; _decompressor round-trip probed; dir-path → named ValueError.
  • a7: fill cap tuned in the transform space actually used; transform_state / percentile_quantiles LUTs always agree (was mismatched in one forced-percentile path); calibration.json format change (per-bin CV rows, per-block cap_km copies dropped — anchor regenerated; older files load unchanged, now pinned).
  • a8: CHANGELOG test-count deltas fixed; sparse-output design doc §11.

Bonus: pre-existing order-dependent logging failure fixed (rebind_ppgrid_streams() in main()).

Review (adversarial, behaviour-drift lens)

20261016-043442-2332603 — PASS, zero blockers/majors. Reviewer re-ran all gates (621 passed/2 skipped macOS-only, anchors byte-identical on all six melb resolutions, ruff 0.16.2 clean). Five minors + one info — all five applied in the follow-up commit (CHANGELOG wording, raw_bytes declaration, docstring fix, old-format load pin).

Gates (final tip)

  • pytest: 622 passed / 2 skipped (reviewer 621 + the new old-format pin)
  • bench/check_anchors.py: PASS byte-identical, six melb resolutions
  • ruff check + format: clean (0.16.2 pin)

Base is the rewritten main (6cd1d2b, the monky→monkytheluffy identity fix; content-identical to pre-rewrite main).

monkytheluffy added 2 commits October 16, 2026 16:31
2026-10-09 audit: 51 P2 + 29 P3 findings, worked area by area. Most items
behaviour-preserving (full suite green, bench/check_anchors.py byte-identical);
the intended behaviour changes are pinned in tests/test_audit_84.py (+45,
552 -> 597).

a1 CLI: --compress preflight (exit 2) + written-tag readback; --out '' exit 2;
malformed --calibration named exit 2; non-numeric column named; --plan text
header + workers/max-band-parallel split (turbo n_threads label); idwgrid -m
guard; README table rows.
a2 ingest: corrupt parquet exit 1; dup role columns exit 2; mapping
RuntimeError; row-count mismatch warn; all-missing-columns one pass;
__init__ rejects the five named kwargs in the **kwargs slot.
a3 grid/reproject: count-accumulation lock scoped; non-default CRS pair
one-shot warn; --force-memmap documented; staging names via constants
(_support_tmp.tif asymmetry pinned — the a1 derivation had silently dropped
it from the run-temp cleanup set, caught by two full-suite residue failures).
a4 turbo: wall range keyed on regime+workers; hard-kill temp globs; classic
4GiB guard on DST size; cgroup-v1 docstring; per-box in-flight count;
__all__; failed turbo run discards fresh calibration.json; presets derived
from SIZING_TABLE.
a5 pullpush: grid_index_mt for workers>1; saturation<=0 ValueError;
downsample_sum shape validation; copy=False; shared _level_support_m.
a6 compression: CPLCompressor nStructVersion check before pfn read;
_decompressor() round-trip probe; _open_fresh_memmap dir -> ValueError;
_gdal_path message; docstrings (stock GTiff ZSTD tiles, probe-sized files).
a7 calibrate: fill cap in the transform space actually used (forced
transforms no longer get a cap tuned in the auto space); transform_state /
percentile_quantiles LUT pairing; per-bin CV rows ship in calibration.json
(per-block cap_km copies dropped — file format change, anchor regenerated);
explicit calibrate_fill_cap kwargs; icc/CVDetail/CVCurve removed; _p cached.
a8 tests/docs: CHANGELOG deltas fixed (+27 -> +29); DESIGN-sparse-output
section 11 lost-harness note; auto-anchor test compares decoded arrays +
exact metadata (byte gate stays in bench/check_anchors.py); all six melb
resolutions anchored (25/50/100/250m were unanchored); non-ZSTD --compress
e2e round-trip pins (all six codecs); bench harnesses: lazy tempdir +
bench/_helpers.py (no tests-package import); a2 pin's fork
DeprecationWarning contained (default run ends with an empty warnings
summary).

Also fixed along the way: order-dependent logging failures —
rebind_ppgrid_streams() in main() rebinds the rich handler to the live
sys.stderr before config applies (pre-existing bug, not #84-introduced).

Gates: pytest 595 passed / 2 skipped; bench/check_anchors.py PASS
(byte-identical, 12 melb rasters); ruff: 3 pre-existing baseline findings,
zero new.
…ocstring, old-format pin

Review 20261016-043442-2332603 PASS, five minors:
1. a1 bullet declares the run_summary raw_bytes/compression_ratio
   semantic change (final output-CRS raster, not the work grid) + the
   plan disk_bytes divergence.
2. Test-count line corrected post-rebase: 578 -> 624 (+46).
3. _raw_csv_header_names docstring now matches behaviour (quoted
   multi-line header yields the partial first-line list, not None).
4. a2/a3 wording: named parameters (not a **kwargs slot), the
   PPGRID_FORCE_MEMMAP env var (not a --force-memmap flag), work/out
   not the 6933/3857 default (src irrelevant to the tile-skip premise).
5. New pin test_a7_old_format_calibration_loads: pre-#84
   calibration.json (per-block cap_km, no rows) still validates,
   rebuilds, and fwd/inv round-trips — the 'older files load
   unchanged' claim.
…d ValueError

Linux unlink(2) on a directory returns EISDIR (IsADirectoryError, already
handled); BSD/macOS returns EPERM (PermissionError), which propagated and
failed test_a6_memmap_dir_path_raises_valueerror on all four macOS CI
runners. Catch PermissionError too, disambiguate with is_dir() so a
genuine permission error on a regular file still propagates. New pin
test_a6_memmap_dir_eperm_maps_to_valueerror exercises the BSD branch on
every platform via a monkeypatched Path.unlink.

(#84; PR #135)
@marzukia
marzukia merged commit 9b5ff1e into main Oct 16, 2026
11 checks passed
@monkytheluffy monkytheluffy mentioned this pull request Oct 16, 2026
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.

2 participants