Skip to content

Breaking API cleanup (0.21): typed sgp4 error, time(scale=), lambert::Error - #123

Merged
ssmichael1 merged 3 commits into
mainfrom
api-0.21-breaking
Jul 7, 2026
Merged

Breaking API cleanup (0.21): typed sgp4 error, time(scale=), lambert::Error#123
ssmichael1 merged 3 commits into
mainfrom
api-0.21-breaking

Conversation

@ssmichael1

Copy link
Copy Markdown
Owner

The breaking / pre-1.0 API cleanup batch, kept separate from the non-breaking polish in #122 (this PR is stacked on ci-stubtest; retarget to main once #122 merges). These are the items worth inflicting on downstream exactly once.

Breaking

  • sgp4::Error::SatRecInit(i32)SatRecInit(SGP4Error) — the raw Vallado init code is mapped to the typed variant (eccentricity, mean motion, perturbed eccentricity, semi-latus rectum, orbit decay) at construction, so Display is now descriptive. SGP4Error moved from sgp4::sgp4_impl to sgp4::error; still re-exported at satkit::sgp4::SGP4Error, so the public path is unchanged.
  • LambertErrorlambert::Error — matches the module::Error convention used everywhere else (the last straggler from the thiserror migration). The old name stays as a #[deprecated] type alias, so downstream compiles with a warning; also added lambert::Result<T>.

Added (non-breaking)

  • scale= keyword on time(...) — Gregorian components can be interpreted in an explicit time scale, e.g. satkit.time(2020, 1, 1, scale=satkit.timescale.TAI), mirroring time.from_mjd(..., scale=...). Defaults to UTC, so all existing calls are unchanged. Backed by a new core Instant::from_datetime_with_scale.

Deliberately dropped

  • OMM.epoch String→Instant — OMM's JSON/XML wire has no native time type (EPOCH is an ISO-8601 string), so keeping the Rust field a String matches the wire; the typed-field win didn't justify the deserializer + Python-dict-contract work.

Validation

Verified UTC−TAI = 37.0 s / UTC−GPS = 18.0 s for the scale= path; no-scale calls unchanged. 206 Rust tests, 114 Python tests, clippy -D warnings, cargo fmt --check, and mypy.stubtest all clean on the integrated branch.

🤖 Generated with Claude Code

ssmichael1 and others added 3 commits July 5, 2026 09:18
Move the SGP4Error enum (and its i32 conversions) from sgp4::sgp4_impl
into sgp4::error, and change Error::SatRecInit(i32) to
Error::SatRecInit(SGP4Error). The raw Vallado init error code is mapped
to the corresponding SGP4Error variant at construction. SGP4Error stays
re-exported at satkit::sgp4::SGP4Error, so the public path is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a `scale=` keyword to the `satkit.time(...)` constructor so Gregorian
date/time components can be interpreted in an explicit time scale (default
UTC), mirroring `time.from_mjd(..., scale=)` / `time.from_jd(..., scale=)`.

Backed by a new scale-aware core constructor
`Instant::from_datetime_with_scale`, which delegates to `from_datetime`
for UTC (preserving exact leap-second behavior) and to `from_mjd_with_scale`
for the uniform time scales. Purely additive: calls without `scale` are
unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The last per-module error enum that missed the thiserror-era
`module::Error` convention (PRs #83-#86). Rename the enum to `Error`,
add a `lambert::Result<T>` alias, and keep a `#[deprecated]` type alias
`LambertError = Error` so downstream code still compiles.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ssmichael1
ssmichael1 changed the base branch from ci-stubtest to main July 7, 2026 23:27
@ssmichael1
ssmichael1 merged commit 42b4247 into main Jul 7, 2026
16 checks passed
@ssmichael1
ssmichael1 deleted the api-0.21-breaking branch July 7, 2026 23:28
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