Skip to content

Phase 3 — fixture and pipeline hygiene#10

Merged
sakobu merged 1 commit into
mainfrom
phase-3/fixture-and-pipeline-hygiene
Apr 12, 2026
Merged

Phase 3 — fixture and pipeline hygiene#10
sakobu merged 1 commit into
mainfrom
phase-3/fixture-and-pipeline-hygiene

Conversation

@sakobu
Copy link
Copy Markdown
Owner

@sakobu sakobu commented Apr 12, 2026

Summary

Phase 3 of the FINAL_CLEANUP.md sweep. Closes C-2, L-1, L-2, L-3, L-5 and verifies M-7 is already complete from Phase 2. Pure hygiene — no algorithmic changes, no public API changes, no new tests.

  • C-2 — replace opaque FAR_FIELD_* ECI Cartesian constants in far_field_input() with a Keplerian derivation (iss_like_elements() + 50 km SMA offset + 0.2 rad mean-anomaly offset). δa/a ≈ 7.4e-3 crosses the default roe_threshold = 5e-3, classifying the pair as FarField. Note: a pure in-track offset would always classify as Proximity because dimensionless_norm excludes δλ per Koenig Sec. V — δa is the lightest physical component that crosses the threshold. Mirrors the existing proximity_input() idiom.
  • L-1 — pre-size eclipse_samples to chief_results.len() when earth_frame.is_some(); leave as Vec::new() when eclipse is disabled.
  • L-2 — flip f64::from(u32::try_from(5 + j).unwrap()) to f64::from(5_u32 + u32::try_from(j).unwrap()) so the arithmetic stays in u32.
  • L-3 — drop four narrative comments in validation/statistics.rs (mechanical binary-search narration, test-value tables, test-case restatements). Keep load-bearing comments (time-sorted invariant, sum/sum-sq recovery math, +0.0 bit-pattern empty-input contract, all-zero summaries contract).
  • L-5 — normalize two #[ignore = "Requires MetaAlmanac …"] to lowercase-r so all 25 MetaAlmanac ignore sites use the canonical string.
  • M-7 — verified already complete from Phase 2; both 709.0 call sites are named as const MID_COAST_BURN_ELAPSED_S.

Plan: docs/superpowers/plans/2026-04-11-phase-3-fixture-and-pipeline-hygiene.md (untracked, not in this PR — matches Phase 1/2 convention).

Test plan

  • cargo test --workspace -- --include-ignored — 586 passed / 0 failed / 0 ignored (unchanged from post-Phase-2 baseline)
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo doc --workspace --no-deps — no missing-docs warnings
  • wasm-pack build rpo-wasm --target web — clean
  • cargo run -p rpo-cli -- mission --input examples/mission.json --json — byte-identical to pre-Phase-3 baseline
  • cargo run -p rpo-cli -- validate --input examples/validate.json --auto-drag --json — byte-identical to pre-Phase-3 baseline
  • cargo run -p rpo-cli -- mc --input examples/mc.json --auto-drag --json — byte-identical modulo elapsed_wall_s (non-deterministic wall clock)
  • Grep audits: zero FAR_FIELD_* Cartesian literals, zero raw 709.0 outside the named const, zero capital-R "Requires MetaAlmanac" hits

Closes C-2, L-1, L-2, L-3, L-5 from FINAL_CLEANUP.md. Verifies M-7 is
already complete from Phase 2.

- C-2 (pipeline/mod.rs): replace the four opaque FAR_FIELD_* ECI
  Cartesian constants in the far-field test fixture with a Keplerian
  derivation — iss_like_elements() + 50 km SMA offset + 0.2 rad mean
  anomaly offset. δa/a ≈ 7.4e-3 crosses the default roe_threshold of
  5e-3, classifying the pair as FarField. δλ is deliberately excluded
  from dimensionless_norm per Koenig Sec. V, so a pure in-track offset
  would always classify as Proximity regardless of separation — the SMA
  bump is the lightest physical component that crosses the threshold.
  Mirrors the existing proximity_input() idiom.

- L-1 (validation/trajectory.rs:249): pre-size eclipse_samples to
  chief_results.len() when earth_frame.is_some(); leave it as
  Vec::new() when eclipse validation is disabled so the disabled
  path stays zero-allocation.

- L-2 (validation/trajectory.rs:1071): flip
  f64::from(u32::try_from(5 + j).unwrap()) to
  f64::from(5_u32 + u32::try_from(j).unwrap()) so the arithmetic stays
  in u32 rather than casting a usize sum.

- L-3 (validation/statistics.rs): drop four narrative comments that
  restated what the code does — mechanical "compare candidates" at the
  binary search, a three-line test-value table, two "leg excluded" /
  "no input" test narrations. Keep the load-bearing comments (time-
  sorted input invariant, sum/sum-sq recovery math, +0.0 bit-pattern
  empty-input contract, all-zero summaries contract).

- L-5 (validation/trajectory.rs:1833, 1945): normalize two #[ignore]
  strings from capital-R "Requires MetaAlmanac" to lowercase-r
  "requires MetaAlmanac" so all 25 MetaAlmanac ignore sites use the
  same canonical string. SPICE-kernel-specific strings in
  nyx_bridge/almanac.rs describe a different prerequisite and are
  intentionally left alone.

- M-7: verified as already complete — Phase 2 named both 709.0 call
  sites as const MID_COAST_BURN_ELAPSED_S.

Verification: 586 passed / 0 failed / 0 ignored across the workspace
with --include-ignored (unchanged from Phase 2 baseline). Clippy,
docs, and wasm-pack build all clean. rpo-cli mission/validate/mc
JSON outputs are byte-identical to the pre-Phase-3 baseline (modulo
non-deterministic elapsed_wall_s in MC).
@sakobu sakobu merged commit 412415b into main Apr 12, 2026
1 check passed
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