ps-dbgen-04-cli: implement tetra3-gen-db CLI and reproducibility fixes#81
Conversation
- Add clap-based tetra3-gen-db binary mirroring the reference CLI: positional STAR_CATALOG and SAVE_AS, --max-fov, --min-fov, --linear-probe, --epoch-proper-motion, --star-max-magnitude, and tuning knobs for lattice-field oversampling, patterns-per-field, pattern-max-error, and multiscale-step. - Re-export propagate and HIP_TYC_PM_ORIGIN from database_generation lib. - Fix BSC5 parser to match upstream tetra3 layout: STARN at offset 8, 32-byte entries with f32 id, f64 RA/Dec, i16 spectral type, i16 mag, and f32 proper motions in radians/year. - Pin zip last_modified_time to 2000-01-01 for byte-identical .npz output. - Sort deduplicated patterns before hash-table insertion to remove HashSet iteration-order non-determinism. - Update catalog_parsing tests for the corrected BSC5 layout. Two consecutive CLI runs on the reference bsc5 fixture now produce byte-identical .npz files. Co-Authored-By: Claude <noreply@anthropic.com>
|
…ty test Judge nits from `review/judge` on b50ecd3: - main.rs:248 — dropped `starts_with("tyc")`/`starts_with("hip")`; they are subsumed by the preceding `contains` checks. - main.rs:155 — `GenerationConfig::epoch_proper_motion` was written and never read. The properties block now reads it from `config` instead of the local, so the field is live rather than decorative. - main.rs:172 — NOT applied, deliberately. The nit proposed a 0.0 sentinel when `--epoch-proper-motion none` disables propagation. Falling back to `pm_origin` is correct: with propagation disabled the positions ARE at the catalog's origin epoch, so that is what the properties must report. It is also what the reference does (tetra3.py: "If pm propagation was disabled, set end date to origin"), and the spec requires reference parity. A sentinel would describe the data less accurately, not more. Comment added so this is not re-raised. Also adds the acceptance test for `Deterministic, offline generation`, which the implementation claimed but nothing verified: - `reproducible_build` — runs the real binary twice over a deterministic synthetic BSC5 catalog and byte-compares, with a size floor so two empty files cannot pass vacuously. - `archive_timestamps_are_pinned_not_wall_clock` — the two-run compare has a blind spot: runs 10 ms apart share a clock tick, so a clock-dependent archive still compares equal. Measured — re-deriving the ZIP mtime from `SystemTime::now()` at one-second granularity left `reproducible_build` passing. This asserts the pinned 2000-01-01 stamp in every local file header, where run duration cannot hide it. - `byte_comparison_can_detect_a_difference` — calibration; `--linear-probe` must change the bytes, or the equality assertion is not capable of failing. All three calibrated against known-positives rather than trusting exit codes: a nanosecond-varying mtime makes `reproducible_build` fail, and a wall-clock mtime makes the timestamp test fail while the byte compare passes blind. cargo fmt / clippy -D warnings / 140 workspace tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qz1AHuSpjFqRYJWVVVq9mp
|
Implements the
tetra3-gen-dbcommand-line binary for thedatabase-generationcrate and fixes the non-determinism that prevented byte-identical output across runs.Changes
clap-basedtetra3-gen-dbbinary mirroring the reference CLI:STAR_CATALOGandSAVE_AS--max-fov,--min-fov,--linear-probe,--epoch-proper-motion,--star-max-magnitude--verification-stars-per-fov,--lattice-field-oversampling,--patterns-per-lattice-field,--pattern-max-error,--multiscale-steppropagateandHIP_TYC_PM_ORIGINfromdatabase_generation.tetra3layout (STARN at offset 8, 32-byte entries with f32 id, f64 RA/Dec, i16 spectral type, i16 mag, f32 proper motions in radians/year).last_modified_timeto 2000-01-01 for reproducible.npzarchives.HashSetiteration-order non-determinism.catalog_parsingtests for the corrected BSC5 layout.Verification
cargo test -p database-generation --lockedpasses.cargo clippy -p database-generation --all-targets --lockedis clean.cargo deny checkpasses.reference-solutions/cedar-solve/tests/data/bsc5produce byte-identical.npzfiles.🤖 Generated with Claude Code