From fe1e36266af75c60e1f7dabccd0ae35d85448b83 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 03:06:57 +0000 Subject: [PATCH 1/8] Give Auto resolution a start-up window and burst-tolerant paused recovery Two parts of the #135 review of the display-resolution controller were still open. A fresh controller could lower resolution about 340 ms after the first frame, because lastChange started at -Infinity and only two warm-up frames were skipped. First frames share the main thread with shader compilation, texture decode and engine start-up, so that evidence describes loading. Slow frames in the three seconds after the first rendered Auto frame no longer count as overload. A device that stays slow is lowered just after the window, and returning to Auto later does not reopen it. A paused scene only draws while the pointer moves. Recovery needed 180 consecutive fast input frames with no gap over 250 ms, about three seconds of unbroken dragging, because every idle gap discarded the headroom count. The count now survives an idle gap between input bursts. Any slow frame still clears it, a resumed animation still restarts the assessment, and idle observations still cannot certify recovery. The integration test that expected a drop within half a second of the first frame now asserts both halves: no drop inside the window, the same drop after it. --- apps/web/js/renderQuality.js | 14 +++-- tests/web/orreryRenderQuality.test.mjs | 6 ++- tests/web/renderQuality.test.mjs | 75 ++++++++++++++++++++++++-- 3 files changed, 85 insertions(+), 10 deletions(-) diff --git a/apps/web/js/renderQuality.js b/apps/web/js/renderQuality.js index 35c0dad6..64f3456f 100644 --- a/apps/web/js/renderQuality.js +++ b/apps/web/js/renderQuality.js @@ -10,11 +10,16 @@ export function effectiveRenderDpr(deviceRatio,quality){ // An upgrade that is reversed soon after doubles the wait before the next attempt, // so a device that cannot sustain the higher tier settles instead of oscillating. const UPGRADE_HOLD_MS=6000,MAX_UPGRADE_HOLD_MS=300000,FAILED_UPGRADE_WINDOW_MS=15000; +// First frames share the main thread with shader compilation, texture decode and engine +// start-up. Slow frames in this window describe loading, not what the device can sustain. +const STARTUP_GRACE_MS=3000; export function createRenderQuality(){ let mode='auto',tier=2,current,lastTimestamp=null,lastChange=-Infinity,warmup=2,overload=0,underload=0; - let upgradeHold=UPGRADE_HOLD_MS,lastUpgrade=-Infinity; + let upgradeHold=UPGRADE_HOLD_MS,lastUpgrade=-Infinity,graceUntil=null; function publish(reason){current=Object.freeze({mode,tier:TIERS[tier],scale:SCALES[TIERS[tier]],reason});} - function resetEvidence(){warmup=2;overload=0;underload=0;lastTimestamp=null;} + // A paused scene only draws while the pointer moves, so its headroom evidence arrives in + // separate bursts. keepHeadroom carries that count across the idle gap between bursts. + function resetEvidence(keepHeadroom=false){warmup=2;overload=0;if(!keepHeadroom)underload=0;lastTimestamp=null;} publish('Initial display resolution.'); return { get current(){return current;}, @@ -26,7 +31,8 @@ export function createRenderQuality(){ if(mode!=='auto')return false; const {timestamp,frameMs,continuous,completed,rendered}=sample; if(!completed||!rendered||!Number.isFinite(timestamp)||!Number.isFinite(frameMs)||frameMs<0){resetEvidence();return false;} - if(lastTimestamp!==null&&(timestamp<=lastTimestamp||(timestamp-lastTimestamp>250&&!sample.continuation)))resetEvidence(); + if(graceUntil===null)graceUntil=timestamp+STARTUP_GRACE_MS; + if(lastTimestamp!==null&&(timestamp<=lastTimestamp||(timestamp-lastTimestamp>250&&!sample.continuation)))resetEvidence(!continuous&×tamp>lastTimestamp); // A resumed continuous chain has no interval; exclude its startup history. if(continuous&&sample.intervalMs===null&&!sample.continuation)resetEvidence(); lastTimestamp=timestamp; @@ -39,7 +45,7 @@ export function createRenderQuality(){ const inputLatency=Number.isFinite(sample.inputToSubmitMs)?sample.inputToSubmitMs:null; const spare=(continuous&&interval!==null&&frameMs<10&&interval<19) ||(!continuous&&inputLatency!==null&&frameMs<10&&inputLatency<19); - overload=slow?Math.min(8,overload+1):0; + overload=slow&×tamp>=graceUntil?Math.min(8,overload+1):0; underload=spare?Math.min(180,underload+1):0; if(overload===8&&tier>0&×tamp-lastChange>=1500){ if(timestamp-lastUpgrade<=FAILED_UPGRADE_WINDOW_MS)upgradeHold=Math.min(MAX_UPGRADE_HOLD_MS,upgradeHold*2); diff --git a/tests/web/orreryRenderQuality.test.mjs b/tests/web/orreryRenderQuality.test.mjs index 4e893739..761703b4 100644 --- a/tests/web/orreryRenderQuality.test.mjs +++ b/tests/web/orreryRenderQuality.test.mjs @@ -34,11 +34,15 @@ test('point marker DPR follows the backing-resolution tier at high density',asyn test('Auto uses sustained continuous delivery evidence and manual choices remain deterministic',async t=>{ const h=await paused(t);h.setAnimate(true); + // The first drawn frame was at 100 ms. Slow delivery during the three-second start-up + // window is loading, so the same evidence only lowers resolution once that window has passed. for(let i=1;i<=14;i++)h.frame(100+i*34); + assert.equal(h.state.renderQuality.tier,'high');assert.match(h.nodes.orreryQualityStatus.textContent,/Auto.*High/); + for(let i=1;i<=14;i++)h.frame(4000+i*34); assert.equal(h.state.renderQuality.tier,'balanced');assert.match(h.nodes.orreryQualityStatus.textContent,/Auto.*Balanced/); assert.equal(h.frames.size,1,'quality sampling shares the animation owner'); h.input('orreryQuality','high','change'); - for(let i=15;i<=40;i++)h.frame(100+i*34); + for(let i=15;i<=40;i++)h.frame(4000+i*34); assert.equal(h.state.renderQuality.tier,'high');assert.equal(h.nodes.orreryCanvas.width,800); }); diff --git a/tests/web/renderQuality.test.mjs b/tests/web/renderQuality.test.mjs index 4e6155b0..fb4d389d 100644 --- a/tests/web/renderQuality.test.mjs +++ b/tests/web/renderQuality.test.mjs @@ -2,11 +2,19 @@ import test from 'node:test'; import assert from 'node:assert/strict'; import {createRenderQuality,effectiveRenderDpr} from '../../apps/web/js/renderQuality.js'; +const STARTUP_GRACE_MS=3000; +const healthy=timestamp=>({timestamp,intervalMs:16,frameMs:5,inputToSubmitMs:null,continuous:true,rendered:true,completed:true}); +// A controller whose start-up window has already passed: one frame opens the window, +// then an idle gap longer than the window leaves the usual two-frame warm-up in force. +function settled(){ + const policy=createRenderQuality();policy.observe(healthy(16)); + return {policy,timestamp:16+STARTUP_GRACE_MS+2000}; +} function fixture(){ - const policy=createRenderQuality();let timestamp=0; + const start=settled(),policy=start.policy;let timestamp=start.timestamp; function feed(count,overrides={}){for(let i=0;i{timestamp+=ms;}}; } @@ -71,7 +79,7 @@ test('very slow continuous CPU frames can still lower resolution when delivery i test('an upgrade the device cannot sustain backs off instead of oscillating',()=>{ // Too slow at High (34 ms delivery), comfortable below it (16 ms). - const policy=createRenderQuality();let timestamp=0;const changes=[]; + const start=settled(),policy=start.policy;let timestamp=start.timestamp;const changes=[]; for(let i=0;i<120000/16;i++){ const interval=policy.current.tier==='high'?34:16;timestamp+=interval; if(policy.observe({timestamp,intervalMs:interval,frameMs:5,inputToSubmitMs:null,continuous:true,continuation:true,rendered:true,completed:true}))changes.push(timestamp); @@ -85,7 +93,7 @@ test('an upgrade the device cannot sustain backs off instead of oscillating',()= }); test('a paused scene lowered during slow interaction recovers on fast input-driven frames',()=>{ - const policy=createRenderQuality();let timestamp=0; + const start=settled(),policy=start.policy;let timestamp=start.timestamp; const frame=(frameMs,inputToSubmitMs,step)=>{timestamp+=step; policy.observe({timestamp,intervalMs:null,frameMs,inputToSubmitMs,continuous:false,continuation:false,rendered:true,completed:true});}; for(let i=0;i<12;i++)frame(30,30,30); @@ -95,7 +103,7 @@ test('a paused scene lowered during slow interaction recovers on fast input-driv }); test('returning to Auto clears the upgrade backoff',()=>{ - const policy=createRenderQuality();let timestamp=0; + const start=settled(),policy=start.policy;let timestamp=start.timestamp; for(let i=0;i<60000/16;i++){const interval=policy.current.tier==='high'?34:16;timestamp+=interval; policy.observe({timestamp,intervalMs:interval,frameMs:5,inputToSubmitMs:null,continuous:true,continuation:true,rendered:true,completed:true});} policy.setMode('auto');assert.equal(policy.current.tier,'high'); @@ -106,3 +114,60 @@ test('returning to Auto clears the upgrade backoff',()=>{ policy.observe({timestamp,intervalMs:16,frameMs:5,inputToSubmitMs:null,continuous:true,continuation:true,rendered:true,completed:true});} assert.ok(timestamp-droppedAt<=6100,`fresh Auto restored the 6 s hold, took ${timestamp-droppedAt} ms`); }); + +test('slow frames inside the start-up window cannot lower resolution',()=>{ + const policy=createRenderQuality();let timestamp=0; + const slow=()=>{timestamp+=30;return policy.observe({...healthy(timestamp),intervalMs:30,frameMs:30});}; + // 2.4 s of load-time hitches: far more than the eight slow frames that lower a settled view. + for(let i=0;i<80;i++)assert.equal(slow(),false); + assert.equal(policy.current.tier,'high'); + // The window bounds the exemption. A device that stays slow is still lowered just after it. + while(timestamp=STARTUP_GRACE_MS&×tamp<=STARTUP_GRACE_MS+30*9,`lowered at ${timestamp} ms`); +}); + +test('the start-up window opens with the first rendered Auto frame, not at construction',()=>{ + const policy=createRenderQuality(); + // Failed, skipped and manual-mode frames do not open it. + policy.observe({...healthy(100),rendered:false}); + policy.setMode('low');policy.observe(healthy(200));policy.setMode('auto'); + let timestamp=60000; + for(let i=0;i<60;i++){timestamp+=30;policy.observe({...healthy(timestamp),intervalMs:30,frameMs:30});} + assert.equal(policy.current.tier,'high','a view first drawn a minute after load still gets its window'); +}); + +test('a paused scene recovers from short drag bursts separated by idle gaps',()=>{ + const start=settled(),policy=start.policy;let timestamp=start.timestamp; + const frame=(frameMs,inputToSubmitMs,step)=>{timestamp+=step; + return policy.observe({timestamp,intervalMs:null,frameMs,inputToSubmitMs,continuous:false,continuation:false,rendered:true,completed:true});}; + for(let i=0;i<12;i++)frame(30,30,30); + assert.equal(policy.current.tier,'balanced'); + // Four one-second drags, each followed by two idle seconds. No single burst holds 180 fast frames. + let bursts=0; + while(policy.current.tier!=='high'&&bursts<4){bursts++;for(let i=0;i<60;i++)frame(4,8,16);timestamp+=2000;} + assert.equal(policy.current.tier,'high');assert.equal(bursts,4); +}); + +test('one slow frame between bursts discards the headroom a paused scene had gathered',()=>{ + const start=settled(),policy=start.policy;let timestamp=start.timestamp; + const frame=(frameMs,inputToSubmitMs,step)=>{timestamp+=step; + policy.observe({timestamp,intervalMs:null,frameMs,inputToSubmitMs,continuous:false,continuation:false,rendered:true,completed:true});}; + for(let i=0;i<12;i++)frame(30,30,30); + assert.equal(policy.current.tier,'balanced'); + for(let burst=0;burst<12;burst++){for(let i=0;i<50;i++)frame(4,8,16);frame(30,8,16);timestamp+=2000;} + assert.equal(policy.current.tier,'balanced'); +}); + +test('headroom from a paused scene does not carry into a resumed animation',()=>{ + const start=settled(),policy=start.policy;let timestamp=start.timestamp; + const paused=(frameMs,inputToSubmitMs,step)=>{timestamp+=step; + policy.observe({timestamp,intervalMs:null,frameMs,inputToSubmitMs,continuous:false,continuation:false,rendered:true,completed:true});}; + for(let i=0;i<12;i++)paused(30,30,30); + for(let i=0;i<170;i++)paused(4,8,16); + assert.equal(policy.current.tier,'balanced'); + // Animate is switched on: the first continuous frame has no interval and restarts the assessment. + timestamp+=2000;policy.observe({...healthy(timestamp),intervalMs:null}); + for(let i=0;i<30;i++){timestamp+=16;policy.observe(healthy(timestamp));} + assert.equal(policy.current.tier,'balanced','thirty animated frames are not sustained headroom'); +}); From 1018ac9e6bccf6ff38bf92eca80096361a4a1645 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 03:06:57 +0000 Subject: [PATCH 2/8] Bind the WASM receipt profile to the build and restrict legacy receipts The #135 review noted that the receipt recorded a constant profile and that read_receipt accepted Cargo's plain release profile for any sources. validate_receipt already rejected it for current sources, but the post-build manifest validator uses read_receipt alone, so a hand-made release receipt for a size-optimized build passed there. build_wasm.py now selects the Cargo profile and records the receipt from one name, and write_receipt refuses any profile other than wasm-release. read_receipt accepts the release profile only when the recorded root Cargo.toml digest is the one manifest that predates the browser profile (unchanged from master through 02aaec8). No published release carries a release receipt: the live release was built before receipts existed. --- docs/WASM_SOURCE_BINDING_20261108.md | 8 ++++++++ tests/python/test_wasm_provenance.py | 30 ++++++++++++++++++++++++++-- tools/build_wasm.py | 9 ++++++--- tools/wasm_provenance.py | 21 +++++++++++++++---- 4 files changed, 59 insertions(+), 9 deletions(-) diff --git a/docs/WASM_SOURCE_BINDING_20261108.md b/docs/WASM_SOURCE_BINDING_20261108.md index 6058c565..2200f7ea 100644 --- a/docs/WASM_SOURCE_BINDING_20261108.md +++ b/docs/WASM_SOURCE_BINDING_20261108.md @@ -31,6 +31,14 @@ manifest validator checks receipt-to-binary identity and, when corresponding source metadata is present, requires every declared source hash to match it. Changing an outer asset hash alone cannot clear those semantic checks. +The receipt names the Cargo profile that `tools/build_wasm.py` requested, and +`write_receipt` refuses any profile other than the dedicated browser profile +`wasm-release`. A receipt naming Cargo's plain `release` profile is readable only +when its recorded root `Cargo.toml` digest is the one manifest that predates the +browser profile (pinned in `LEGACY_PROFILE_MANIFESTS`); for any later manifest +the reader rejects it, so a size-optimized `--release` build cannot pass the +post-build manifest validator. No published release carries a `release` receipt. + Historical shells without the component portal keep their existing build and manifest contract. A receipt supplied to such a build is still validated. This backward compatibility does not qualify an old artifact or grant a release. diff --git a/tests/python/test_wasm_provenance.py b/tests/python/test_wasm_provenance.py index ee0e1947..13a9e010 100644 --- a/tests/python/test_wasm_provenance.py +++ b/tests/python/test_wasm_provenance.py @@ -60,13 +60,39 @@ def test_historical_release_receipt_remains_readable(self): document = self.write() document['profile'] = 'release' self.replace_receipt(document) - self.assertEqual(provenance.read_receipt(self.wasm)[0], document) + # The fixture manifest stands in for the one root manifest that predates the browser profile. + with patch.object(provenance, 'LEGACY_PROFILE_MANIFESTS', frozenset({document['source_inputs']['Cargo.toml']})): + self.assertEqual(provenance.read_receipt(self.wasm)[0], document) + + def test_release_profile_receipt_is_refused_for_any_later_root_manifest(self): + document = self.write() + document['profile'] = 'release' + self.replace_receipt(document) + with self.assertRaisesRegex(ValueError, 'profile release is not valid for this root manifest'): + provenance.read_receipt(self.wasm) + # The repository's own manifest defines the browser profile, so it can never be a legacy one. + current = hashlib.sha256((ROOT / 'Cargo.toml').read_bytes()).hexdigest() + self.assertNotIn(current, provenance.LEGACY_PROFILE_MANIFESTS) + self.assertEqual(provenance.LEGACY_PROFILE_MANIFESTS, frozenset({ + '98f5c3251cdc1e4f37011ead4c9bc510bd0cd36e5ccecf8f3a540109082e6b34'})) + + def test_receipt_records_the_requested_profile_and_refuses_any_other(self): + self.assertEqual(provenance.write_receipt(self.root, self.wasm, profile='wasm-release')['profile'], 'wasm-release') + (self.wasm / provenance.RECEIPT_NAME).unlink() + for profile in ('release', 'dev', ''): + with self.subTest(profile=profile), self.assertRaisesRegex(ValueError, 'no receipt written'): + provenance.write_receipt(self.root, self.wasm, profile=profile) + self.assertFalse((self.wasm / provenance.RECEIPT_NAME).exists()) def test_current_sources_require_the_browser_profile_receipt(self): document = self.write() document['profile'] = 'release' self.replace_receipt(document) - with self.assertRaisesRegex(ValueError, 'is not wasm-release; rebuild WASM'): + with self.assertRaisesRegex(ValueError, 'profile release is not valid for this root manifest'): + provenance.validate_receipt(self.root, self.wasm) + # Even a manifest admitted for legacy receipts cannot satisfy current-source validation. + with patch.object(provenance, 'LEGACY_PROFILE_MANIFESTS', frozenset({document['source_inputs']['Cargo.toml']})), \ + self.assertRaisesRegex(ValueError, 'is not wasm-release; rebuild WASM'): provenance.validate_receipt(self.root, self.wasm) def test_repeat_receipts_are_deterministic_and_bind_both_binaries(self): diff --git a/tools/build_wasm.py b/tools/build_wasm.py index 8c03a316..737954a0 100644 --- a/tools/build_wasm.py +++ b/tools/build_wasm.py @@ -105,11 +105,14 @@ def main() -> int: except (OSError, ValueError) as error: parser.exit(1, f"ERROR: WASM source inventory: {error}\n") + # One name selects the Cargo profile and is then recorded in the receipt, so the + # receipt cannot name a profile other than the one these commands requested. + profile = BUILD_PROFILE for crate in CRATES: - print(f"Building {crate} ({BUILD_PROFILE}, {TARGET})...") + print(f"Building {crate} ({profile}, {TARGET})...") try: result = subprocess.run( - ["cargo", "build", "-p", crate, "--target", TARGET, "--profile", BUILD_PROFILE, "--locked", "--message-format=json"], + ["cargo", "build", "-p", crate, "--target", TARGET, "--profile", profile, "--locked", "--message-format=json"], cwd=ROOT, check=True, stdout=subprocess.PIPE, @@ -133,7 +136,7 @@ def main() -> int: print(f"Staged {dst} ({dst.stat().st_size / 1024:.1f} KB)") try: - write_receipt(ROOT, dst_dir, expected_inputs=inputs) + write_receipt(ROOT, dst_dir, profile=profile, expected_inputs=inputs) except (OSError, ValueError) as error: parser.exit(1, f"ERROR: WASM source receipt: {error}\n") return 0 diff --git a/tools/wasm_provenance.py b/tools/wasm_provenance.py index 01074a44..3b82b3fd 100644 --- a/tools/wasm_provenance.py +++ b/tools/wasm_provenance.py @@ -15,8 +15,15 @@ RECEIPT_NAME = 'wasm-build.v1.json' BUILD_PROFILE = 'wasm-release' -# Historical receipts remain readable; exact source/output binding still applies. -SUPPORTED_PROFILES = ('release', BUILD_PROFILE) +# Receipts written before the dedicated browser profile existed name Cargo's plain +# release profile. They stay readable only for the root manifest that had no browser +# profile to select; exact source/output binding still applies. A plain release build of +# any later manifest optimizes the ephemeris for size and must not pass as a receipt. +LEGACY_PROFILE = 'release' +LEGACY_PROFILE_MANIFESTS = frozenset({ + '98f5c3251cdc1e4f37011ead4c9bc510bd0cd36e5ccecf8f3a540109082e6b34', # Cargo.toml through 02aaec8 +}) +SUPPORTED_PROFILES = (LEGACY_PROFILE, BUILD_PROFILE) WASM_FILES = ('solar_wasm.wasm', 'solar_ephemeris.wasm') CRATES = ('solar-core', 'solar-wasm', 'solar-ephemeris') ROOT_FILES = ('Cargo.toml', 'Cargo.lock', 'rust-toolchain.toml', @@ -88,12 +95,16 @@ def _wasm_hashes(root: Path) -> dict[str, str]: return result -def write_receipt(project: Path, wasm_root: Path, *, expected_inputs: dict[str, str] | None = None) -> dict: +def write_receipt(project: Path, wasm_root: Path, *, profile: str = BUILD_PROFILE, + expected_inputs: dict[str, str] | None = None) -> dict: + """Record the profile the caller requested from Cargo; only the browser profile is admitted.""" + if profile != BUILD_PROFILE: + raise ValueError(f'WASM built with profile {profile!r}, not {BUILD_PROFILE}; no receipt written') inputs = capture_source_inputs(project) if expected_inputs is not None and inputs != expected_inputs: raise ValueError('WASM source materials changed during build') document = {'schema_version': 'wasm-build.v1', 'target': 'wasm32-unknown-unknown', - 'profile': BUILD_PROFILE, 'locked': True, 'source_inputs': inputs, + 'profile': profile, 'locked': True, 'source_inputs': inputs, 'source_inputs_sha256': hashlib.sha256(_canonical(inputs)).hexdigest(), 'wasm_sha256': _wasm_hashes(wasm_root)} raw = _canonical(document) @@ -151,6 +162,8 @@ def read_receipt(wasm_root: Path) -> tuple[dict, bytes]: folded.add(name.casefold()) if document.get('source_inputs_sha256') != hashlib.sha256(_canonical(inputs)).hexdigest(): raise ValueError('WASM source inventory digest mismatch') + if document['profile'] == LEGACY_PROFILE and inputs['Cargo.toml'] not in LEGACY_PROFILE_MANIFESTS: + raise ValueError(f'WASM receipt profile {LEGACY_PROFILE} is not valid for this root manifest; rebuild WASM') if document.get('wasm_sha256') != _wasm_hashes(wasm_root): raise ValueError('WASM output differs from source receipt') return document, raw From b894758278f2f9250ede209fa46d9f3d84d689f2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 03:06:57 +0000 Subject: [PATCH 3/8] Record the precision work in the changelog and mark unretained evidence CHANGELOG.md had no entry for the precision branch. Add upgrade notes (ephemeris-snapshot.v4, updating a self-hosted server together with the web app, the solar-ephemeris API break that requires 0.3.0 at the next crates.io publish, the wasm-release profile) and the user-visible changes. The workspace version stays 0.2.0. Both engines stamp it into snapshots, the committed research data bundle and hash-bound evidence fixtures, so the bump belongs with the change that publishes the crate. docs/structural-remediation.md and its plan cited evidence under /workspace/sol-review and build/, which are local to the authoring workstation. Say so, and list what can be checked from the repository and CI. The 16 ms raw-position assertion lives in a tool no CI workflow runs, so that figure is recorded as a local result. Add an upgrade section to the ephemeris server README. --- CHANGELOG.md | 80 +++++++++++++++++++ docs/structural-remediation.md | 18 ++++- .../plans/2026-11-10-structural-completion.md | 6 +- services/ephemeris-server/README.md | 16 ++++ 4 files changed, 114 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74cc9507..a5e588c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,82 @@ crate follows [SemVer](https://semver.org/). ## [Unreleased] +### Upgrade notes + +- **The ephemeris snapshot contract is now `ephemeris-snapshot.v4`.** v4 adds the root + `star_frame`, catalogue right ascension and declination on stars, the `future_nominal_utc` + and `modeled_future` time states, and a nullable DUT1 uncertainty. The published v3 schema + is unchanged and still validates archived snapshots + (`tools/validate_ephemeris_snapshot.py --historical-v3`). See + [the contract notes](docs/EPHEMERIS_V3.md). +- **A self-hosted ephemeris server and the web app must be updated together.** The server now + answers `/v4/sky`; `/v1/sky`, `/v2/sky` and `/v3/sky` return HTTP 409 with an upgrade + message. A new web app pointed at an old server, or an old web app pointed at a new server, + receives no remote sky data. On-device computation is unaffected, and a deployment that sets + no `SOL_EPHEMERIS_SERVER` (including the public Pages site) needs no action. See + [the server notes](services/ephemeris-server/README.md). +- **`solar-ephemeris` has a breaking public API change; its next crates.io version must be + 0.3.0.** The public TOP2013 and VSOP2013 coefficient structs gained phase-index fields + (`TopTerm::phase`, the per-body `multipliers` table and the VSOP `phase` index), so external + code that builds these structs with literals no longer compiles. The workspace version stays + 0.2.0 in this tree because both engines stamp it into snapshots, the committed research data + bundle and the hash-bound evidence fixtures. Change the version, and regenerate those files, + in the same change that publishes the crate. crates.io already holds 0.2.0, so that version + cannot be published again. +- **Browser WASM is built with a dedicated Cargo profile.** `tools/build_wasm.py` builds with + `--profile wasm-release` (abort on panic, ephemeris optimized for speed) and records that + profile in the build receipt. Output from a plain `cargo build --release` is not accepted by + the release builder. Native `release` builds now unwind by default. + +### Changed + +- **The web app ships as bundled view and shared chunks.** A pinned esbuild step emits one + entry per view plus shared chunks, external source maps with embedded sources, and + original-source and output hashes in the release manifest. Full moon and star catalogues load + on selection, search or galaxy demand instead of at System startup. +- **Raw planetary positions are about five times cheaper to compute.** TOP2013 and VSOP2013 + reuse identical phase evaluations within one calculation while preserving argument and + summation order. The 4x CPU-throttled p95 fell from 45.3 ms to 8.8 ms under the unchanged + 16 ms gate, and 324 position values at 12 epochs match the previous WASM output bit for bit. +- **System labels stay attached to what they name.** A label needs a finite on-screen target + with adjacent clearance; crowded names are suppressed and remain reachable through search and + the catalogue. The selected body keeps its label near a canvas corner. A target hidden behind + the jump bar is not labelled. +- **Body and satellite-system framing share one policy**, and focusing a planet's satellite + system is a separate, accessible action from inspecting its globe. +- **One animation-frame scheduler owns drawing.** It coalesces input, owns cancellation and + first-frame recovery, and no longer redraws an idle scene while the pointer hovers. +- **Automatic display resolution.** Auto starts at High and steps down under sustained frame + delay, with hysteresis, a cooldown and a growing wait after an upgrade the device cannot + hold. Slow frames in the first three seconds of drawing are treated as loading and cannot + lower resolution. A paused scene recovers from short drags separated by idle gaps. Low, + Balanced and High remain available as fixed choices. +- **Reference textures are verified before decode** (PNG and JPEG source grids), decoded + asynchronously and uploaded within fixed memory budgets. +- **Sky.** Stars, constellation lines and star hit targets fade together with daylight; + constellation figures use the engine's star reduction for the selected epoch; a failed + provider is not restarted implicitly by a redraw. +- **Future dates state their assumptions.** Beyond observed Earth-orientation data, nominal UTC + holds the last leap-second offset as a stated assumption and UT1 follows a modeled Delta T + with unknown uncertainty. The server refuses unsupported future dates before doing cache or + upstream work. +- **Touch targets** for planets, moons and small bodies have a 22 px minimum on touch input. +- **WASM build receipts.** A receipt naming Cargo's plain `release` profile is readable only + for the root manifest that predates the browser profile, and `write_receipt` refuses any + profile other than the one `build_wasm.py` requested. + ### Added +- **Independent accuracy evidence is published with the app.** The accuracy page and its JSON + registry record 160 comparisons of native geometric positions with retained JPL Horizons + DE441 vectors (16 epochs for each of ten target and origin pairs), including the failures: + 141 pass the 10 arcsec budget and 19 fail, all at years 1, 5000, 7000 and 9999. All 60 + samples from 1900 to 2100 pass. The records do not certify dates between the samples. +- **WASM source and binary receipts** bind both engine binaries to the exact workspace sources + that produced them, and the release builder refuses binaries without a matching receipt. +- **Corresponding source for the ephemeris component** (license texts, coefficient source + inventory and rebuild instructions) is distributed with the web app. + - **Moons cast their real shadows.** When a catalogued moon transits its planet's sunlit face, the umbra/penumbra cross the disc — computed in the planet's body frame from PHYSICAL planetocentric positions (not the inflated display offsets), in fractions of the equatorial @@ -101,6 +175,12 @@ crate follows [SemVer](https://semver.org/). ### Fixed +- **Speed readouts** derive their unit conversion from the AU and Julian-year constants. +- **Solar differential rotation** is attributed to the original Doppler-feature fit; the + coefficients are unchanged. +- **Reference imagery in JPEG form loads again** after the verified loader initially accepted + PNG only. + - **Earth's Moon now discloses when the clock outruns it.** The 21 catalogued moons are hidden with a notice past the Nyquist rate; Earth's Moon rides the ELP engine on a different path and kept moving silently — at five simulated years per second a frame covers more than a diff --git a/docs/structural-remediation.md b/docs/structural-remediation.md index c0b8e7fb..8a389d6c 100644 --- a/docs/structural-remediation.md +++ b/docs/structural-remediation.md @@ -1,6 +1,6 @@ # Structural remediation status — November 11, 2026 -Implementation on `fix/structural-label-policy`, based on `02aaec8eebfd714fc9000e32fdd4e5d15ec60b91`. This report records local validation; source publication does not grant merge or deployment qualification. The original review and extracted attachment are retained in `/workspace/sol-review` in this workspace. The [ordered implementation plan](superpowers/plans/2026-11-10-structural-completion.md) records the integration sequence. +Implementation on `fix/structural-label-policy`, based on `02aaec8eebfd714fc9000e32fdd4e5d15ec60b91`. This report records local validation; source publication does not grant merge or deployment qualification. The original review and extracted attachment were kept in `/workspace/sol-review` on the authoring workstation; that directory is not part of this repository (see [evidence retention](#evidence-retention)). The [ordered implementation plan](superpowers/plans/2026-11-10-structural-completion.md) records the integration sequence. ## Recommendation matrix @@ -41,7 +41,7 @@ Final source-to-staged static closure measurements with tree shaking disabled to | Sky | 28 | 24 | 223,055 | 210,235 | | Research | 40 | 35 | 326,962 | 321,825 | -These are static closure measurements, not network timing or GPU benchmarks. The 16-byte startup difference comes from release stamping. Full catalogues remain outside ordinary System startup. Evidence: `/workspace/sol-review/final-bundle-measurement.json`. +These are static closure measurements, not network timing or GPU benchmarks. The 16-byte startup difference comes from release stamping. Full catalogues remain outside ordinary System startup. Evidence: `final-bundle-measurement.json` in the authoring workstation's `/workspace/sol-review`, not retained in this repository. ## Integrated verification @@ -58,7 +58,19 @@ Final application artifact: `build/site-structural-final10`, manifest SHA-256 `1 - **Static checks:** 151 application files typecheck clean; static web, UX/accessibility structure and governance checks pass. All 286 Markdown files pass reference/style validation. `git diff --check` is clean. - **Review:** independent review accepted the coordinate/display policies, frame and presenter ownership, loading/build changes, science policies, lifecycle fixes, build profiles and exact phase reuse. No material finding remains in that reviewed scope. -Primary logs and reports are retained in `/workspace/sol-review`, with browser evidence under `build/experience-structural-final10`, `build/structural-acceptance-final10`, `build/sky-structural-final10` and `build/cache-structural-final10`. +Primary logs and reports were written to `/workspace/sol-review`, with browser evidence under `build/experience-structural-final10`, `build/structural-acceptance-final10`, `build/sky-structural-final10` and `build/cache-structural-final10`. All of these are local to the authoring workstation and are not retained in this repository. + +## Evidence retention + +The paths above under `/workspace/sol-review` and `build/` name files on the workstation where this remediation was written. `build/` is ignored by Git and `/workspace/sol-review` lies outside the checkout, so none of those logs, traces or measurement files can be inspected from this repository or from a CI artifact. Treat every figure in this report that cites only such a path as the author's recorded local result, not as retained evidence. + +What can be checked from the repository and from CI: + +- **Tests and gates:** the Rust, JavaScript and Python suites, the governance, documentation and static web validators, and the coverage gates run in CI on every push and pull request. The run for the merge of this remediation is CI run 43061040875 on `precision/verified-readiness-20261109` at `2d26c8e`; its artifacts (staged site, release evidence, coverage and browser visuals) are kept for 90 days. +- **Independent accuracy:** the 160 comparison records, with reference and native vectors, are committed in `apps/web/data/independent-vector-evidence.json`, and the original Horizons responses are under `tests/fixtures/horizons-vectors-20261104`. +- **Position timing:** the 16 ms raw-position p95 assertion is in `tools/experience_validation.mjs`. No CI workflow runs that tool, so the gate and the 45.3 ms and 8.8 ms figures are local results only. +- **Old and new WASM parity, bundle sizes, responsive layouts and the interaction diagnostics below:** local measurements only. Reproduce them before relying on them. + ## Interaction qualification remains open diff --git a/docs/superpowers/plans/2026-11-10-structural-completion.md b/docs/superpowers/plans/2026-11-10-structural-completion.md index ce3aa555..65092461 100644 --- a/docs/superpowers/plans/2026-11-10-structural-completion.md +++ b/docs/superpowers/plans/2026-11-10-structural-completion.md @@ -8,7 +8,7 @@ **Tech Stack:** Rust/WASM, JavaScript browser modules, Python release tooling, Node tests, Chromium acceptance. -**Spec:** [Structural remediation status](../../structural-remediation.md); original review in `/workspace/sol-review/SOL-structural-review.md`. +**Spec:** [Structural remediation status](../../structural-remediation.md); original review in `/workspace/sol-review/SOL-structural-review.md` on the authoring workstation (not retained in this repository; see the status report's evidence retention section). ## Global Constraints @@ -85,11 +85,11 @@ Ruling: the user's explicit instruction to complete the remaining work supersede Pre-flight: Task 1 camera policy and Task 2 scheduler both touch `orrery.js`; execute them sequentially. Task 1 Sky engine metadata and Task 3 broker both touch engine loading; execute them sequentially. Task 3 module canonicalization must follow new module additions from Task 2, and final graph generation must follow Task 4 additions. -Task 1: camera integration passed 50 focused tests; Sky frame/contract/renderer checks passed 70 focused tests, plus native frame parity at three epochs. Evidence under `/workspace/sol-review/stage1-*.md`. +Task 1: camera integration passed 50 focused tests; Sky frame/contract/renderer checks passed 70 focused tests, plus native frame parity at three epochs. Evidence under `/workspace/sol-review/stage1-*.md` (authoring workstation only). Task 2: scattering driver polling removed from normal steady-state, allocation/error diagnostics retained; 33 tests passed after observed red regression (7 polls versus 0 required). Frame/presenter extraction in progress. -Task 2: complete in focused validation: 82 integration tests and 23 scheduler/label/presenter unit tests passed, plus root 33 scattering lifecycle/diagnostic tests. Typecheck green at this boundary. Evidence `/workspace/sol-review/stage2-frames.md`. Full integrated suite remains Task 6. +Task 2: complete in focused validation: 82 integration tests and 23 scheduler/label/presenter unit tests passed, plus root 33 scattering lifecycle/diagnostic tests. Typecheck green at this boundary. Evidence `/workspace/sol-review/stage2-frames.md` (authoring workstation only). Full integrated suite remains Task 6. Task 3: implementing three independent areas: module/build/coverage tooling, compiled WASM broker, and catalogue/source-texture demand. Binary catalogue conversion rejected on measured compressed size: moon Float64 payload alone is 23.4% larger than whole JS gzip; star payload plus metadata also grows. Preserve generated full precision JS. diff --git a/services/ephemeris-server/README.md b/services/ephemeris-server/README.md index 0681ed0a..d4c2a5f5 100644 --- a/services/ephemeris-server/README.md +++ b/services/ephemeris-server/README.md @@ -53,6 +53,22 @@ There is no bulk cache deletion. Rollback to an earlier server revision restores that revision's cache namespace and its older admission behavior; it does not change observed-source data or browser-selected snapshots. +## Upgrading from a v3 server + +The web app and this server must be updated together. A web app built from this tree +requests `/v4/sky` and accepts only `ephemeris-snapshot.v4`. This server answers the three +earlier routes with HTTP 409, so: + +- a new web app pointed at an older server gets no remote sky data (the older server has no + `/v4/sky` route); +- an older web app pointed at this server gets HTTP 409 on `/v3/sky`. + +In both cases the app reports the provider as unavailable and on-device computation keeps +working. Deploy the server first, then the web app, and expect remote sky data to be +unavailable to already-open pages until they reload. A deployment that does not set +`SOL_EPHEMERIS_SERVER` is unaffected. Cached entries from the earlier contract are rebuilt +on demand; there is nothing to migrate. + ## Contract notes - Bodies and field names match the WASM engine's snapshot; `provider`/`accuracy` blocks mark From ba1ef17cd7a7a9c87ac2324d312e209ed20f4009 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 03:31:38 +0000 Subject: [PATCH 4/8] Let Retry recover a view or catalogue whose download failed A browser keeps a failed module fetch for the life of its document, so "Retry this view" and "Retry catalogue downloads" re-imported the same URL and failed again without touching the network. Only a manual page reload recovered, even after the connection returned. A retry still re-imports first, which is all a timed-out import needs. If that explicit retry is rejected a second time, the loader asks whether the module is reachable now (a no-store fetch of the same URLs). When it is, the page reloads; the saved surface brings the visitor back to the same view. When it is not, the page and the visible failure stay exactly as they were, so an offline visitor is never reloaded into a blank page. Only the Retry buttons opt in. Selecting a view again, returning to the tab and demand-driven catalogue loads never replace the document. Confirmed in Chromium against a staged /sol/ build: a first-time visitor with the Solar System code failing, and a service-worker-controlled visitor with the moon catalogue failing. In both, Retry keeps the error while the file is unavailable and recovers once it is reachable. The startup descriptor is regenerated for the three changed startup modules. Two app fixtures gain a stub recovery factory. --- apps/web/app.js | 10 ++++ apps/web/js/catalogueLoader.js | 38 +++++++++++-- apps/web/js/orrery.js | 19 ++++--- apps/web/js/viewLoader.js | 14 +++-- apps/web/startup-modules.v1.json | 6 +- tests/web/appViewInitialization.test.mjs | 2 + tests/web/catalogueLoader.test.mjs | 70 +++++++++++++++++++++++- tests/web/researchEntryRender.test.mjs | 2 + tests/web/viewLoader.test.mjs | 15 +++++ 9 files changed, 154 insertions(+), 22 deletions(-) diff --git a/apps/web/app.js b/apps/web/app.js index 135799b7..dcb07b3e 100644 --- a/apps/web/app.js +++ b/apps/web/app.js @@ -10,6 +10,7 @@ import { createViewEvidence } from "./js/viewEvidence.js"; import { workspace, renderWorkspace, openInspector, revealWorkspaceControl } from "./js/workspace.js"; import { explorer, initExplorer } from "./js/explorer.js"; import {createViewLoader} from './js/viewLoader.js'; +import {createDocumentRecovery} from './js/catalogueLoader.js'; import {registerDestinationRenderer} from './js/viewRegistry.js'; import {initObservationMedia} from './js/observationMedia.js'; import {afterObservationPaint} from './js/offlineBoot.js'; @@ -22,12 +23,21 @@ export const offlineStartup=new Promise(resolve=>{markOfflineStartup=resolve;}); const loadedViews={research:null,sky:null,orrery:null}; const viewNames={research:'Solar research',sky:'My Sky',orrery:'Solar System'}; let activeView='observe',retryFocus=false; +// "Retry this view" re-imports first. If the browser still holds the earlier failure and +// the view's code is reachable again, the page reloads into the saved view. This module +// and the page that loads it share a directory, so the page's base resolves the same URLs. +const reloadWhenReachable=(...paths)=>createDocumentRecovery({urls:()=>paths.map(path=>new URL(path,document.baseURI).href)}); const viewCode=createViewLoader({ loaders:{ research:()=>import('./js/research.js'), sky:async()=>{const [view,overview]=await Promise.all([import('./js/sky.js'),import('./js/destinationOverview.js')]);return {...view,overview};}, orrery:async()=>{const [view,overview]=await Promise.all([import('./js/orrery.js'),import('./js/destinationOverview.js')]);return {...view,overview};}, }, + recoveries:{ + research:reloadWhenReachable('./js/research.js'), + sky:reloadWhenReachable('./js/sky.js','./js/destinationOverview.js'), + orrery:reloadWhenReachable('./js/orrery.js','./js/destinationOverview.js'), + }, onState(state){ document.body.setAttribute('data-view-code',state.status); document.body.setAttribute('data-view-code-name',state.name); diff --git a/apps/web/js/catalogueLoader.js b/apps/web/js/catalogueLoader.js index 2317efa8..893731fa 100644 --- a/apps/web/js/catalogueLoader.js +++ b/apps/web/js/catalogueLoader.js @@ -2,16 +2,36 @@ // its physical fetch; cancellation and retry do not promise a new transfer. export const CATALOGUE_DEADLINE_MS = 30000; -export function createCatalogueLoader({load,timeoutMs=CATALOGUE_DEADLINE_MS, +// A browser keeps a failed module fetch for the life of its document, so importing the +// same URL again fails without touching the network. The only way to fetch it again is a +// new document. When every listed module is reachable now, replace the document and +// report true. When one is not, report false and leave the page, and any offline state, +// exactly as it is: reloading an unreachable page would trade an error for a blank one. +export function createDocumentRecovery({urls,fetchModule=(url,init)=>fetch(url,init),reload=()=>location.reload()}) { + if(typeof urls!=='function'||typeof fetchModule!=='function'||typeof reload!=='function')throw new TypeError('Document recovery needs urls, fetchModule and reload functions'); + return async()=>{ + for(const url of urls()){ + const response=await fetchModule(url,{cache:'no-store'}); + if(!response||response.ok!==true)return false; + } + reload();return true; + }; +} + +export function createCatalogueLoader({load,recover=null,timeoutMs=CATALOGUE_DEADLINE_MS, now=()=>performance.now(),setTimer=(callback,delay)=>setTimeout(callback,delay),clearTimer=timer=>clearTimeout(timer)}) { if(typeof load!=='function')throw new TypeError('Catalogue load must be a function'); + if(recover!==null&&typeof recover!=='function')throw new TypeError('Catalogue recovery must be a function'); if(!Number.isSafeInteger(timeoutMs)||timeoutMs<=0)throw new RangeError('Catalogue deadline must be a positive integer'); - let status='idle',value=null,error=null,pending=null; + let status='idle',value=null,error=null,pending=null,loadRejected=false; return Object.freeze({ get status(){return status;},get value(){return value;},get error(){return error;}, - request(){ + // recover:true marks an explicit retry by the person using the page. Only such a retry + // may replace the document, and only after the import has been rejected twice. + request({recover:explicitRetry=false}={}){ if(pending)return pending.promise; if(status==='ready')return Promise.resolve(value); + const rejectedBefore=loadRejected; const start=now(); if(!Number.isFinite(start))throw new TypeError('Catalogue clock must be finite'); let resolve,reject; @@ -39,7 +59,17 @@ export function createCatalogueLoader({load,timeoutMs=CATALOGUE_DEADLINE_MS, if(pending!==attempt)return; if(now()>=attempt.deadline){finish(false,timeout());return;} return load(); - }).then(result=>finish(true,result),failure=>finish(false,failure)); + }).then(result=>finish(true,result),async failure=>{ + // Recorded even for a superseded attempt: the browser's failure outlives this request. + loadRejected=true; + if(explicitRetry&&recover&&rejectedBefore&&pending===attempt){ + let reloading=false; + try{reloading=await recover()===true;}catch(_){ /* the import failure below is the report */ } + // The document is being replaced. The deadline still bounds this attempt. + if(reloading)return; + } + finish(false,failure); + }); return promise; }, cancel(){ diff --git a/apps/web/js/orrery.js b/apps/web/js/orrery.js index 55182bb3..a2863c02 100644 --- a/apps/web/js/orrery.js +++ b/apps/web/js/orrery.js @@ -85,7 +85,7 @@ import { buildEarthMapSliced, buildFeatureMap } from "./surfacemap.js"; import { resolveDisplayRadii, moonGuideVisible } from "./displayGeometry.js"; import { textureEligible, missingDetailColor } from "./visualAssets.js"; import { catalogueDemand } from "./catalogueDemand.js"; -import { createCatalogueLoader } from "./catalogueLoader.js"; +import { createCatalogueLoader, createDocumentRecovery } from "./catalogueLoader.js"; import { moonOffsetAU, moonOrbitPath, systemScale, satelliteSystemExtent, withinMoonValidity, aliasedByClock, synchronousMoonRotation } from "./moonorbits.js"; import { MAX_MOON_SHADOWS, moonShadowsOnPlanet, packMoonShadows, sunlightOnMoon } from "./moonshadows.js"; import * as moonCatalogue from "./moons.js"; @@ -282,12 +282,15 @@ let starCataloguePromise = null; const catalogueRetryOwners=new Set(); let catalogueRetryGeneration=0,catalogueRecoveryNotice=false; let catalogueFocusIntent=null; -const moonLoader=createCatalogueLoader({load:async()=>{ +// "Retry catalogue downloads" re-imports first. If the browser still holds the earlier +// failure and the catalogue is reachable again, the page reloads into Solar System. +const reloadWhenReachable=path=>createDocumentRecovery({urls:()=>[new URL(path,import.meta.url).href]}); +const moonLoader=createCatalogueLoader({recover:reloadWhenReachable("./moonelements.js"),load:async()=>{ const module=await import("./moonelements.js"); if(!moonSet.MOONS.every(m=>Array.isArray(module.MOON_ELEMENTS?.[m.n]?.el)&&module.MOON_ELEMENTS[m.n].el.length>0))throw new Error('Moon orbital catalogue is incomplete'); return module; }}); -const starLoader=createCatalogueLoader({load:async()=>{ +const starLoader=createCatalogueLoader({recover:reloadWhenReachable("./starcatalog.js"),load:async()=>{ const module=await import("./starcatalog.js"); if(!Array.isArray(module.NAMED_STARS)||!module.NAMED_STARS.length||!Number.isSafeInteger(module.STAR_COUNT)||module.STAR_COUNT<=0 ||!Number.isSafeInteger(module.STAR_STRIDE)||module.STAR_STRIDE<3||module.STARS_PACKED?.length!==module.STAR_COUNT*module.STAR_STRIDE)throw new Error('Named-star catalogue is incomplete'); @@ -344,7 +347,7 @@ function retryCatalogues(){ const generation=catalogueRetryGeneration,button=document.getElementById('orreryCatalogueRetry'); catalogueFocusIntent=button&&document.activeElement===button?{generation}:null; for(const load of jobs){ - const pending=load();catalogueRetryOwners.add(pending); + const pending=load(true);catalogueRetryOwners.add(pending); void pending.finally(()=>{ if(generation!==catalogueRetryGeneration||!state.active)return; catalogueRetryOwners.delete(pending);updateCatalogueStatus(); @@ -1036,12 +1039,12 @@ async function buildGeneratedMaps() { * the knots are deferred, and they are ~99% of the bytes, so the first-paint cost of widening the * validated window is a few KB rather than a megabyte. */ -function loadMoonCatalogue() { +function loadMoonCatalogue(explicitRetry=false) { if(moonElementsReady)return Promise.resolve(moonSet); if (moonElementsPromise) return moonElementsPromise; // Retry retains the immutable release URL. The loader bounds logical ownership; // the browser may share an existing physical import with a later attempt. - const request=moonLoader.request(); + const request=moonLoader.request({recover:explicitRetry}); const pending = request .then((mod) => { if(moonElementsPromise!==pending)return moonSet; @@ -1060,10 +1063,10 @@ function loadMoonCatalogue() { return moonElementsPromise; } -function loadStarCatalogue(){ +function loadStarCatalogue(explicitRetry=false){ if(starCat)return Promise.resolve(starCat); if(starCataloguePromise)return starCataloguePromise; - const request=starLoader.request(); + const request=starLoader.request({recover:explicitRetry}); const pending=request.then(catalogue=>{ if(starCataloguePromise!==pending)return null; starCat=catalogue;updateOrreryPositions(); diff --git a/apps/web/js/viewLoader.js b/apps/web/js/viewLoader.js index 6bc1bd45..e60b8aef 100644 --- a/apps/web/js/viewLoader.js +++ b/apps/web/js/viewLoader.js @@ -6,16 +6,16 @@ import {createModuleLoader} from './catalogueLoader.js'; * Own a selected view's code activation. Cancellation resolves null; failures * reject. onState is synchronous; async onReady must honor isCurrent/signal * before publishing after an await. Existing viewers own their compute work. - * @param {{loaders:Recordany>,onState?:(state:ViewCodeState)=>void, + * @param {{loaders:Recordany>,recoveries?:RecordPromise>,onState?:(state:ViewCodeState)=>void, * onReady?:(name:string,module:any,owner:{signal:AbortSignal,isCurrent:()=>boolean})=>any, * timeoutMs?:number,now?:()=>number,setTimer?:(callback:()=>void,delay:number)=>any, * clearTimer?:(timer:any)=>void}} options */ -export function createViewLoader({loaders,onState=()=>{},onReady=()=>{},...timing}) { +export function createViewLoader({loaders,recoveries={},onState=()=>{},onReady=()=>{},...timing}) { const imports=new Map(); for(const [name,load]of Object.entries(loaders)){ if(name==='observe'||typeof load!=='function')throw new TypeError('View loaders must be named functions'); - imports.set(name,createModuleLoader({load,...timing})); + imports.set(name,createModuleLoader({load,recover:recoveries[name]??null,...timing})); } // Namespace caching does not establish successful view entry. const enteredViews=new Set(); @@ -28,7 +28,9 @@ export function createViewLoader({loaders,onState=()=>{},onReady=()=>{},...timin if(!pending)return; const attempt=pending;pending=null;attempt.controller.abort();imports.get(attempt.name).cancel();if(settle)attempt.resolve(null); }; - const start=()=>{ + // explicitRetry is true only for retry(): selecting or returning to a view never replaces + // the document on its own. + const start=(explicitRetry=false)=>{ if(selected==='observe'){publish('idle');return Promise.resolve(null);} if(paused){publish('paused');return Promise.resolve(null);} let resolve,reject; @@ -49,7 +51,7 @@ export function createViewLoader({loaders,onState=()=>{},onReady=()=>{},...timin try{ publish('loading'); if(!isCurrent())return promise; - imports.get(selected).request().then(async module=>{ + imports.get(selected).request({recover:explicitRetry}).then(async module=>{ if(!isCurrent())return; publish('activating'); if(!isCurrent())return; @@ -71,7 +73,7 @@ export function createViewLoader({loaders,onState=()=>{},onReady=()=>{},...timin if(name===selected&&state.status==='ready')return Promise.resolve(imports.get(name).value); cancel();selected=name;return start(); }, - retry(){if(pending)return pending.promise;return start();}, + retry(){if(pending)return pending.promise;return start(true);}, pauseLoading(){ paused=true; if(pending){ diff --git a/apps/web/startup-modules.v1.json b/apps/web/startup-modules.v1.json index c6b4d17c..09f7191a 100644 --- a/apps/web/startup-modules.v1.json +++ b/apps/web/startup-modules.v1.json @@ -8,12 +8,12 @@ { "url": "app.js", "path": "app.js", - "sha256": "ceaf6d064a296305e0a830d7aecdef397fc9cfa0cf6b82117e72a83a6ee7574a" + "sha256": "f9133130cdedcc05494a11bc6c552b46a02d5dce2b51a49de1fcb5185ac42cb6" }, { "url": "js/catalogueLoader.js", "path": "js/catalogueLoader.js", - "sha256": "743bad2a968abae7aae9c9cee83382ceba48f8b49a068f784e629678c60134b6" + "sha256": "83df0ec4c7415d4820dd3f6d11454204701c00947c0c2314d5986a0164324df3" }, { "url": "js/config.js", @@ -93,7 +93,7 @@ { "url": "js/viewLoader.js", "path": "js/viewLoader.js", - "sha256": "600640ff72a90f6ecdf3216ff170b486552aeb1af94bf3ff505e989ed7c832dc" + "sha256": "8ce1fc9d33e975f35c38d23e55c132b1cb739255f604b61181035e4274bda9e0" }, { "url": "js/viewRegistry.js", diff --git a/tests/web/appViewInitialization.test.mjs b/tests/web/appViewInitialization.test.mjs index 39a7479e..a047899e 100644 --- a/tests/web/appViewInitialization.test.mjs +++ b/tests/web/appViewInitialization.test.mjs @@ -16,6 +16,8 @@ function fixture(t,{enterResearch=null,enterSky=()=>{},enterOrrery=async()=>{}}= // The production Research entry renders itself, including its initial model selection. const module={enterResearch:enterResearch??(()=>context.renderAll()),enterSky,enterOrrery,leaveResearch(){},leaveSky(){},leaveOrrery(){}}; const context=vm.createContext({document:doc,store:{activeMode:'today'},explorer:{mode:'research'},updateModeButtons(){},registerDestinationRenderer(){},updateTaskHeader(){},renderAll(){renderedFlags.push(attrs.get('data-view-initialized'));if(renderFailure)throw Error('render failed');}, + // The fixture replaces every loader, so document recovery has nothing to probe or reload. + createDocumentRecovery:()=>async()=>false, createViewLoader(options){return createViewLoader({...options,loaders:Object.fromEntries(['research','sky','orrery'].map(name=>[name,async()=>{imports.push(name);return module;} ])), now:()=>0,setTimer(fn){timers.set(++serial,fn);return serial;},clearTimer(id){timers.delete(id);}});}, }); diff --git a/tests/web/catalogueLoader.test.mjs b/tests/web/catalogueLoader.test.mjs index 3216fffa..ab70110a 100644 --- a/tests/web/catalogueLoader.test.mjs +++ b/tests/web/catalogueLoader.test.mjs @@ -1,6 +1,6 @@ import test from 'node:test'; import assert from 'node:assert/strict'; -import {createCatalogueLoader} from '../../apps/web/js/catalogueLoader.js'; +import {createCatalogueLoader,createDocumentRecovery} from '../../apps/web/js/catalogueLoader.js'; function deferred(){let resolve,reject;const promise=new Promise((yes,no)=>{resolve=yes;reject=no;});return{promise,resolve,reject};} function clock(){let time=0,id=0;const timers=new Map();return{now:()=>time,setTimer:(fn,delay)=>{timers.set(++id,{fn,at:time+delay});return id;},clearTimer:key=>timers.delete(key),get pending(){return timers.size;},advance(ms,run=true){time+=ms;if(run)for(const[key,item]of [...timers])if(item.at<=time){timers.delete(key);item.fn();}}};} @@ -58,3 +58,71 @@ test('invalid loader configuration fails explicitly',()=>{ assert.throws(()=>createCatalogueLoader({load:null}),TypeError); for(const timeoutMs of [0,-1,Infinity,NaN,0.5])assert.throws(()=>createCatalogueLoader({load:()=>{},timeoutMs}),RangeError); }); + +// A browser keeps a failed module fetch for the life of the document, so these loaders reject +// every time, exactly as a repeated import() of the same URL does. +test('an explicit retry that fails again reloads the document once the module is reachable',async()=>{ + const time=clock(),error=Error('transfer failed'),recoveries=[];let calls=0; + const loader=createCatalogueLoader({load:()=>{calls++;return Promise.reject(error);},recover:async()=>{recoveries.push(calls);return true;},...time}); + await assert.rejects(loader.request({recover:true}),error); + assert.deepEqual(recoveries,[],'a first failure is reported, never answered with a reload'); + const retry=loader.request({recover:true});let settled=false;retry.then(()=>{settled=true;},()=>{settled=true;}); + await flush();await flush(); + assert.deepEqual(recoveries,[2]);assert.equal(settled,false);assert.equal(loader.status,'loading','the page is being replaced'); + // If the reload never happens, the ordinary deadline still ends the attempt. + time.advance(30000);await assert.rejects(retry,/deadline/);assert.equal(loader.status,'failed');assert.equal(time.pending,0); +}); + +test('an unreachable module leaves the page in place and reports the import failure',async()=>{ + for(const recover of [async()=>false,async()=>{throw Error('probe failed');},async()=>'yes']){ + const time=clock(),error=Error('transfer failed'); + const loader=createCatalogueLoader({load:()=>Promise.reject(error),recover,...time}); + await assert.rejects(loader.request({recover:true}),error); + await assert.rejects(loader.request({recover:true}),error); + assert.equal(loader.status,'failed');assert.equal(loader.error,error);assert.equal(time.pending,0); + } +}); + +test('only an explicit retry may reload: automatic requests and loaders without recovery never do',async()=>{ + const time=clock(),error=Error('transfer failed');let recoveries=0; + const loader=createCatalogueLoader({load:()=>Promise.reject(error),recover:async()=>{recoveries++;return true;},...time}); + for(let i=0;i<3;i++)await assert.rejects(loader.request(),error); + assert.equal(recoveries,0); + const plain=createCatalogueLoader({load:()=>Promise.reject(error),...time}); + for(let i=0;i<2;i++)await assert.rejects(plain.request({recover:true}),error); + assert.throws(()=>createCatalogueLoader({load(){},recover:'reload'}),TypeError); +}); + +test('a retry that succeeds, or a deadline with the import still in flight, never reloads',async()=>{ + const time=clock();let calls=0,recoveries=0; + const loader=createCatalogueLoader({load:()=>++calls===1?Promise.reject(Error('transfer failed')):{recovered:true},recover:async()=>{recoveries++;return true;},...time}); + await assert.rejects(loader.request({recover:true}),/transfer failed/); + assert.deepEqual(await loader.request({recover:true}),{recovered:true});assert.equal(recoveries,0); + const slow=deferred(),late=createCatalogueLoader({load:()=>slow.promise,recover:async()=>{recoveries++;return true;},...time}); + const first=late.request({recover:true});await flush();time.advance(30000);await assert.rejects(first,/deadline/); + const second=late.request({recover:true});await flush();slow.resolve({arrived:true});assert.deepEqual(await second,{arrived:true}); + assert.equal(recoveries,0,'a timeout is not a rejected import'); +}); + +test('a rejection that arrives after cancellation still counts toward the next explicit retry',async()=>{ + const time=clock(),first=deferred(),error=Error('transfer failed');let calls=0,recoveries=0; + const loader=createCatalogueLoader({load:()=>++calls===1?first.promise:Promise.reject(error),recover:async()=>{recoveries++;return true;},...time}); + const cancelled=assert.rejects(loader.request(),{name:'AbortError'});await flush();loader.cancel();await cancelled; + first.reject(error);await flush(); + void loader.request({recover:true}).catch(()=>{});await flush();await flush(); + assert.equal(recoveries,1); +}); + +test('document recovery probes every module without the HTTP cache and reloads only when all respond',async()=>{ + const seen=[];let reloads=0; + const recovery=responses=>createDocumentRecovery({urls:()=>['https://example.test/sol/js/a.js','https://example.test/sol/js/b.js'], + fetchModule:async(url,init)=>{seen.push([url,init.cache]);const next=responses.shift();if(next instanceof Error)throw next;return next;},reload:()=>{reloads++;}}); + assert.equal(await recovery([{ok:true},{ok:true}])(),true);assert.equal(reloads,1); + assert.deepEqual(seen,[['https://example.test/sol/js/a.js','no-store'],['https://example.test/sol/js/b.js','no-store']]); + // HTTP 409 is what the service worker answers offline; 404 is a release that has been replaced. + for(const responses of [[{ok:false,status:409}],[{ok:true},{ok:false,status:404}],[null],[{ok:'true'}]]){ + assert.equal(await recovery(responses)(),false);assert.equal(reloads,1); + } + await assert.rejects(recovery([new TypeError('Failed to fetch')])(),/Failed to fetch/);assert.equal(reloads,1); + assert.throws(()=>createDocumentRecovery({urls:['a.js']}),TypeError); +}); diff --git a/tests/web/researchEntryRender.test.mjs b/tests/web/researchEntryRender.test.mjs index cb5dc0ed..79b6d341 100644 --- a/tests/web/researchEntryRender.test.mjs +++ b/tests/web/researchEntryRender.test.mjs @@ -35,6 +35,8 @@ async function fixture(t){ if(name==='workspace.js')return {openInspector:noop}; if(name==='researchView.js')return {}; }}); + // The fixture replaces every loader, so document recovery has nothing to probe or reload. + context.createDocumentRecovery=()=>async()=>false; context.createViewLoader=options=>createViewLoader({...options,loaders:{research:async()=>research,sky:async()=>({}),orrery:async()=>({})}, now:()=>0,setTimer(fn){timers.set(++timer,fn);return timer;},clearTimer(id){timers.delete(id);}}); const app=fs.readFileSync(new URL('../../apps/web/app.js',import.meta.url),'utf8'); diff --git a/tests/web/viewLoader.test.mjs b/tests/web/viewLoader.test.mjs index 02c20ac6..ccf5012e 100644 --- a/tests/web/viewLoader.test.mjs +++ b/tests/web/viewLoader.test.mjs @@ -32,6 +32,21 @@ test('failure is visible and retry starts a fresh owned attempt',async()=>{ assert.equal(h.loader.state.status,'failed');const b=h.loader.retry();await tick();h.requests[1].resolve({name:'sky'});await b; assert.equal(h.loader.state.status,'ready');assert.equal(h.loader.state.error,null); }); +test('Retry may reload a view whose import fails twice; selecting or returning to it never does',async()=>{ + const recoveries=[];let visible=false; + const h=harness({loaders:{sky:()=>Promise.reject(new Error('unavailable')),orrery:async()=>({name:'orrery'})}, + recoveries:{sky:async()=>{recoveries.push('sky');return visible;}}}); + await assert.rejects(h.loader.activate('sky'),/unavailable/); + // Leaving and returning is navigation, not consent to replace the page. + await h.loader.activate('orrery');await assert.rejects(h.loader.activate('sky'),/unavailable/); + h.loader.pauseLoading();await h.loader.resumeLoading(); + assert.deepEqual(recoveries,[]); + // The module is still unreachable: the failure stays visible and the page stays. + await assert.rejects(h.loader.retry(),/unavailable/);assert.deepEqual(recoveries,['sky']);assert.equal(h.loader.state.status,'failed'); + // Reachable again: the retry stays pending while the document is replaced. + visible=true;const retry=h.loader.retry();let settled=false;retry.then(()=>{settled=true;},()=>{settled=true;});await tick(); + assert.deepEqual(recoveries,['sky','sky']);assert.equal(settled,false);assert.equal(h.loader.state.status,'loading'); +}); test('logical deadline rejects and a late physical success cannot enter',async()=>{ const h=harness(),a=h.loader.activate('sky');await tick();h.advance(30);await assert.rejects(a,/deadline/); h.requests[0].resolve({});await tick();assert.deepEqual(h.entered,[]);assert.equal(h.loader.state.status,'failed');assert.equal(h.timers.size,0); From 6ea9f36bd36bdc4a0cbc61bb12528282b41b1be6 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 03:49:25 +0000 Subject: [PATCH 5/8] Reject component releases that omit their receipt or source distribution validate_release_manifest.py checked the WASM build receipt, the source manifest and the source archive only when the artifact happened to list them. A build that stopped staging one of them still passed both deploy validations, and the archive was never compared with the size and hash its own source manifest publishes. An artifact that carries the ephemeris component portal, or that speaks an ephemeris contract newer than v3, must now list the portal page, the receipt, the source manifest and the archive. The archive's size and SHA-256 must match the source manifest. A portal-less v2 or v3 shell is still valid, but may not stage half a source distribution. Confirmed against a real staged site: removing the receipt, removing the source manifest, and replacing the archive with junk (outer manifest rehashed each time) all fail now and all passed before. The live release (v3, no portal) still validates. The release fixture now stages a stand-in distribution with the real shape instead of none, so the existing portal tests exercise the rule. --- CHANGELOG.md | 7 +++ docs/WASM_SOURCE_BINDING_20261108.md | 9 ++- tests/python/test_release_artifact.py | 90 ++++++++++++++++++++++++--- tools/validate_release_manifest.py | 31 ++++++++- 4 files changed, 124 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5e588c6..0287feff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,13 @@ crate follows [SemVer](https://semver.org/). - **WASM build receipts.** A receipt naming Cargo's plain `release` profile is readable only for the root manifest that predates the browser profile, and `write_receipt` refuses any profile other than the one `build_wasm.py` requested. +- **The release manifest validator no longer passes a component release with missing parts.** + An artifact that carries the ephemeris component portal, or speaks an ephemeris contract + newer than v3, must include the WASM build receipt, the source manifest and the source + archive, and the archive must match the size and SHA-256 its source manifest publishes. +- **Retry recovers from a failed download.** "Retry this view" and "Retry catalogue downloads" + reload the page when the browser still holds an earlier failed download and the file is + reachable again. While it is not reachable, the page and its error stay as they were. ### Added diff --git a/docs/WASM_SOURCE_BINDING_20261108.md b/docs/WASM_SOURCE_BINDING_20261108.md index 2200f7ea..7ee4aaa1 100644 --- a/docs/WASM_SOURCE_BINDING_20261108.md +++ b/docs/WASM_SOURCE_BINDING_20261108.md @@ -27,8 +27,13 @@ Current web builds carrying the ephemeris source portal require a matching receipt before creating a staging directory. The builder rechecks the copied binaries and source bindings, retains the receipt as a critical asset, and checks again before publishing the local artifact directory. The immutable -manifest validator checks receipt-to-binary identity and, when corresponding -source metadata is present, requires every declared source hash to match it. +manifest validator requires the receipt, the source manifest and the source +archive whenever the artifact carries the component portal or speaks an +ephemeris contract newer than v3; a release that omits any of them is rejected, +not treated as a historical shell. It checks receipt-to-binary identity, +requires every source hash in the receipt to match the source manifest, and +requires the archive's size and SHA-256 to match the values that manifest +publishes. Changing an outer asset hash alone cannot clear those semantic checks. The receipt names the Cargo profile that `tools/build_wasm.py` requested, and diff --git a/tests/python/test_release_artifact.py b/tests/python/test_release_artifact.py index 7b64fb66..0a3164c0 100644 --- a/tests/python/test_release_artifact.py +++ b/tests/python/test_release_artifact.py @@ -1,7 +1,9 @@ from __future__ import annotations import copy +import hashlib import json +import re import sys import tempfile import unittest @@ -51,12 +53,12 @@ def setUp(self) -> None: for name in ("solar_wasm.wasm", "solar_ephemeris.wasm"): (self.wasm / name).write_bytes(b"\0asm\1\0\0\0") - def build(self, name="ci-abc-123-1", previous=None): + def build(self, name="ci-abc-123-1", previous=None, schemas=None): out = self.root / name build_web.build_site(self.source, self.wasm, out, release_id=name, source_sha="a" * 40, repository="owner/repo", run_id=123, run_attempt=1, base_path="/sol/", previous_root=previous, - schemas=["solar-state-snapshot.v2", "ephemeris-snapshot.v2"]) + schemas=schemas or ["solar-state-snapshot.v2", "ephemeris-snapshot.v2"]) return out def test_final_bytes_and_namespace_manifest_validate_without_source_mutation(self): @@ -548,14 +550,29 @@ def compiler(command, *, cwd, check, stdout, text, encoding): build_wasm.main() - def source_bound_build(self, name='source-bound'): + def source_bound_build(self, name='source-bound', schemas=None): portal = self.source / 'licenses/solar-ephemeris/index.html' portal.parent.mkdir(parents=True, exist_ok=True) portal.write_text('Explicit source-portal I/O fixture', encoding='utf-8') # Source-archive construction is a separate tested I/O boundary. Keep - # real source-receipt, binary copying and staged manifest admission. - with patch.object(build_web, 'ROOT', self.root), patch.object(build_web, 'stage_distribution', return_value=None): - return self.build(name) + # real source-receipt, binary copying and staged manifest admission, and stage a + # stand-in distribution with the same shape: an archive and the manifest that binds it. + def staged_distribution(project, web, staged, **_): + destination = Path(staged) / 'licenses/solar-ephemeris' + archive = b'stand-in source archive' + (destination / 'sol-source.tar.gz').write_bytes(archive) + result = {'archive': 'sol-source.tar.gz', 'archive_bytes': len(archive), + 'archive_sha256': hashlib.sha256(archive).hexdigest(), + 'files': {name: {'sha256': digest} for name, digest in wasm_provenance.capture_source_inputs(self.root).items()}} + (destination / 'SOURCE-MANIFEST.json').write_text(json.dumps(result), encoding='utf-8') + return result + with patch.object(build_web, 'ROOT', self.root), patch.object(build_web, 'stage_distribution', staged_distribution): + return self.build(name, schemas=schemas) + + def drop_test_asset(self, out, manifest, relative): + (out / relative).unlink() + manifest['assets'] = [row for row in manifest['assets'] if row['path'] != relative] + self.restamp_test_manifest(out, manifest) @staticmethod def restamp_test_manifest(out, manifest): @@ -640,16 +657,73 @@ def test_staged_source_manifest_must_match_receipt_even_after_rehash(self): manifest = validator.validate_manifest(out / 'web-release-manifest.json') relative = manifest['namespace'] + 'licenses/solar-ephemeris/SOURCE-MANIFEST.json' p = out / relative + staged = json.loads(p.read_bytes()) files = {name: {'sha256': digest} for name, digest in doc['source_inputs'].items()} - p.write_text(json.dumps({'files': files}), encoding='utf-8') + p.write_text(json.dumps({**staged, 'files': files}), encoding='utf-8') self.refresh_test_asset(out, manifest, relative) validator.validate_manifest(out / 'web-release-manifest.json') files['Cargo.lock']['sha256'] = '0' * 64 - p.write_text(json.dumps({'files': files}), encoding='utf-8') + p.write_text(json.dumps({**staged, 'files': files}), encoding='utf-8') self.refresh_test_asset(out, manifest, relative) with self.assertRaisesRegex(ValueError, 'archived source'): validator.validate_manifest(out / 'web-release-manifest.json') + def test_component_release_cannot_drop_its_receipt_source_manifest_or_archive(self): + # Each file is removed from disk and from the outer manifest, as a build that simply + # stopped staging it would do. The outer inventory stays self-consistent every time. + wasm_provenance.write_receipt(self.root, self.wasm) + for index, name in enumerate(['pkg/' + wasm_provenance.RECEIPT_NAME, 'licenses/solar-ephemeris/SOURCE-MANIFEST.json', + 'licenses/solar-ephemeris/sol-source.tar.gz']): + out = self.source_bound_build('dropped-%d' % index) + manifest = validator.validate_manifest(out / 'web-release-manifest.json') + self.drop_test_asset(out, manifest, manifest['namespace'] + name) + with self.subTest(name=name), self.assertRaisesRegex(ValueError, 'component release is missing ' + re.escape(name)): + validator.validate_manifest(out / 'web-release-manifest.json') + + def test_source_archive_is_bound_to_its_published_manifest_not_only_the_outer_hash(self): + wasm_provenance.write_receipt(self.root, self.wasm) + out = self.source_bound_build() + manifest = validator.validate_manifest(out / 'web-release-manifest.json') + portal = manifest['namespace'] + 'licenses/solar-ephemeris/' + archive, source_manifest = out / (portal + 'sol-source.tar.gz'), out / (portal + 'SOURCE-MANIFEST.json') + original, staged = archive.read_bytes(), json.loads(source_manifest.read_bytes()) + # Replaced bytes, with the outer manifest rehashed to match them. + for replacement in [b'13 junk bytes', original + b'!', original[:-1]]: + archive.write_bytes(replacement) + self.refresh_test_asset(out, manifest, portal + 'sol-source.tar.gz') + with self.subTest(size=len(replacement)), self.assertRaisesRegex(ValueError, 'source archive differs'): + validator.validate_manifest(out / 'web-release-manifest.json') + archive.write_bytes(original) + self.refresh_test_asset(out, manifest, portal + 'sol-source.tar.gz') + validator.validate_manifest(out / 'web-release-manifest.json') + # A source manifest that stops naming, sizing or hashing its archive is not a binding. + for edit in [{'archive_sha256': None}, {'archive_sha256': '0' * 64}, {'archive_bytes': str(len(original))}, + {'archive_bytes': len(original) + 1}, {'archive': 'other.tar.gz'}]: + source_manifest.write_text(json.dumps({**staged, **edit}), encoding='utf-8') + self.refresh_test_asset(out, manifest, portal + 'SOURCE-MANIFEST.json') + with self.subTest(edit=edit), self.assertRaisesRegex(ValueError, 'source archive differs'): + validator.validate_manifest(out / 'web-release-manifest.json') + + def test_current_ephemeris_contract_requires_the_component_portal(self): + # v2 and v3 shells predate the portal and stay valid without it. + validator.validate_manifest(self.build('historical-shell') / 'web-release-manifest.json') + with self.assertRaisesRegex(ValueError, 'component release is missing licenses/solar-ephemeris/index.html'): + self.build('current-shell', schemas=['solar-state-snapshot.v2', 'ephemeris-snapshot.v4']) + # With the portal, receipt and distribution staged, the same contract validates. + wasm_provenance.write_receipt(self.root, self.wasm) + out = self.source_bound_build('current-component', schemas=['solar-state-snapshot.v2', 'ephemeris-snapshot.v4']) + self.assertIn('ephemeris-snapshot.v4', validator.validate_manifest(out / 'web-release-manifest.json')['schemas']) + + def test_a_historical_shell_cannot_stage_half_a_source_distribution(self): + out = self.build('half-distribution') + manifest = validator.validate_manifest(out / 'web-release-manifest.json') + relative = manifest['namespace'] + 'licenses/solar-ephemeris/sol-source.tar.gz' + (out / relative).parent.mkdir(parents=True) + (out / relative).write_bytes(b'archive without a manifest') + self.refresh_test_asset(out, manifest, relative) + with self.assertRaisesRegex(ValueError, 'staged together'): + validator.validate_manifest(out / 'web-release-manifest.json') + def test_failed_or_source_drifted_compiler_cannot_leave_a_success_receipt(self): for cause in ['failure', 'source-drift']: out = self.root / ('compiler-' + cause) diff --git a/tools/validate_release_manifest.py b/tools/validate_release_manifest.py index e4a82da8..26784be2 100644 --- a/tools/validate_release_manifest.py +++ b/tools/validate_release_manifest.py @@ -10,6 +10,8 @@ VERSION = "web-release-manifest.v1" SHA256 = re.compile(r"[0-9a-f]{64}\Z") +# Releases on these contracts could be built without the ephemeris component portal. +HISTORICAL_EPHEMERIS_SCHEMAS = frozenset({"ephemeris-snapshot.v2", "ephemeris-snapshot.v3"}) RELEASE_ID = re.compile(r"[A-Za-z0-9][A-Za-z0-9._-]{0,127}\Z") @@ -114,15 +116,38 @@ def validate_data(data: dict, root: Path) -> dict: if not (root / asset["path"]).read_bytes().startswith(b"\0asm\1\0\0\0"): raise ValueError("invalid WASM header") receipt_path = namespace + "pkg/wasm-build.v1.json" + portal = namespace + 'licenses/solar-ephemeris/' + source_manifest_path, archive_path = portal + 'SOURCE-MANIFEST.json', portal + 'sol-source.tar.gz' + # The builder stages the ephemeris component portal, its build receipt and its + # corresponding-source distribution together. An artifact that offers the portal, or that + # speaks an ephemeris contract newer than the last portal-less release, must carry all of + # them: absence is a build regression, not a historical shell. + component_release = (portal + 'index.html' in listed or any( + version.startswith('ephemeris-snapshot.') and version not in HISTORICAL_EPHEMERIS_SCHEMAS + for version in data['schemas'])) + if component_release: + for required in (portal + 'index.html', receipt_path, source_manifest_path, archive_path): + if required not in listed: + raise ValueError('component release is missing ' + required.removeprefix(namespace)) + elif (source_manifest_path in listed) != (archive_path in listed): + raise ValueError('source manifest and source archive must be staged together') if receipt_path in listed: from wasm_provenance import read_receipt, validate_archived_sources receipt_asset = next(asset for asset in assets if asset['path'] == receipt_path) if receipt_asset['role'] != 'critical': raise ValueError('WASM build receipt must be critical') receipt, _ = read_receipt(root / namespace / 'pkg') - source_manifest = root / namespace / 'licenses/solar-ephemeris/SOURCE-MANIFEST.json' - if source_manifest.is_file(): - validate_archived_sources(receipt, load_json(source_manifest).get('files', {})) + if source_manifest_path in listed: + validate_archived_sources(receipt, load_json(root / source_manifest_path).get('files', {})) + if source_manifest_path in listed: + # The outer asset hash only says the archive is the file that was staged. This binds it + # to the inventory the portal publishes for it. + source = load_json(root / source_manifest_path) + archive = root / archive_path + if (source.get('archive') != 'sol-source.tar.gz' or not SHA256.fullmatch(str(source.get('archive_sha256', ''))) + or type(source.get('archive_bytes')) is not int or archive.stat().st_size != source['archive_bytes'] + or digest(archive) != source['archive_sha256']): + raise ValueError('source archive differs from its published source manifest') if "solar-state-snapshot.v3" in data["schemas"]: from data_bundles import resolve_derived_manifest descriptor = data.get("data_bundle") From f527e82893e6c6f880a6d9489bc44057cdeb080e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 03:49:25 +0000 Subject: [PATCH 6/8] Guard UT1 = UTC + DUT1 with a high-DUT1 Horizons reference Every captured Horizons pointing fixture was from 2026, where DUT1 is below 0.08 s and moves the sky by about one arcsecond, inside the 10 and 12 arcsecond budgets. Dropping DUT1 from UT1 left the whole Rust suite green while giving about 11 arcseconds of altitude/azimuth error for 1973 dates. Add 12 retained JPL Horizons replies for the Sun, Moon and Jupiter at two sites on 1973-01-15 (DUT1 +0.763 s) and 2015-06-20 (DUT1 -0.669 s), in the existing reference-pack format with request URLs, hashes and the acquisition helper. An integration test drives the public sky_snapshot_json and holds altitude/azimuth and RA/Dec to 2 arcseconds and DUT1 to 3 ms. The worst measured residual is 0.45 arcseconds. Three mutations now fail the suite: UT1 without DUT1, UT1 with DUT1 reversed, and a correct reported UT1 with the rotation angle taken from UTC (10.99 arcseconds against the 2 arcsecond budget). A second test asserts that the cohort keeps large DUT1 of both signs and that the budget stays below a quarter of the displacement a dropped DUT1 causes. The test lives under tests/ and uses only the public API, so no source file bound by the independent accuracy evidence changes. --- .../data/horizons-observer-dut1-20261112.csv | 13 ++ .../solar-ephemeris/tests/dut1_reference.rs | 204 ++++++++++++++++++ .../horizons-observer-dut1-20261112/README.md | 54 +++++ .../boston1973-jupiter.txt | 153 +++++++++++++ .../boston1973-moon.txt | 153 +++++++++++++ .../boston1973-sun.txt | 153 +++++++++++++ .../boston2015-jupiter.txt | 153 +++++++++++++ .../boston2015-moon.txt | 153 +++++++++++++ .../boston2015-sun.txt | 153 +++++++++++++ .../manifest.json | 135 ++++++++++++ .../observer-matrix.csv | 13 ++ .../query-helper.txt | 109 ++++++++++ .../sydney1973-jupiter.txt | 153 +++++++++++++ .../sydney1973-moon.txt | 153 +++++++++++++ .../sydney1973-sun.txt | 153 +++++++++++++ .../sydney2015-jupiter.txt | 153 +++++++++++++ .../sydney2015-moon.txt | 153 +++++++++++++ .../sydney2015-sun.txt | 153 +++++++++++++ tests/python/test_horizons_dut1_reference.py | 81 +++++++ 19 files changed, 2445 insertions(+) create mode 100644 crates/solar-ephemeris/data/horizons-observer-dut1-20261112.csv create mode 100644 crates/solar-ephemeris/tests/dut1_reference.rs create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/README.md create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/boston1973-jupiter.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/boston1973-moon.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/boston1973-sun.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/boston2015-jupiter.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/boston2015-moon.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/boston2015-sun.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/manifest.json create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/observer-matrix.csv create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/query-helper.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/sydney1973-jupiter.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/sydney1973-moon.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/sydney1973-sun.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/sydney2015-jupiter.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/sydney2015-moon.txt create mode 100644 tests/fixtures/horizons-observer-dut1-20261112/sydney2015-sun.txt create mode 100644 tests/python/test_horizons_dut1_reference.py diff --git a/crates/solar-ephemeris/data/horizons-observer-dut1-20261112.csv b/crates/solar-ephemeris/data/horizons-observer-dut1-20261112.csv new file mode 100644 index 00000000..690d0f41 --- /dev/null +++ b/crates/solar-ephemeris/data/horizons-observer-dut1-20261112.csv @@ -0,0 +1,13 @@ +case,body,jd_utc,latitude_deg,longitude_deg_east,elevation_m,ra_deg,dec_deg,az_deg,alt_deg,dut1_seconds,raw_sha256 +Boston1973,Sun,2441697.6396875,42.36,-71.06,10.0,296.782400602,-21.163101405,310.364964434,-61.287241442,0.76363,940e9337ed108871806c6b857e45ef88ed18ceffbee2d5306336394ccf4edabb +Boston1973,Moon,2441697.6396875,42.36,-71.06,10.0,60.215320657,24.055427038,247.150608244,56.887836047,0.76363,eb6176577e492cfc0a510053ae58faf16b636880c78f6fc22c06a891f2c7af74 +Boston1973,Jupiter,2441697.6396875,42.36,-71.06,10.0,292.863062598,-21.977617052,315.806954845,-64.066905952,0.76363,bd33022155465179d41f3b14dbf8a7c6053277e51140480e5b6ce2ef78279d93 +Sydney1973,Sun,2441697.9080208335,-33.87,151.21,20.0,297.069388271,-21.111340746,238.014136869,-7.793818083,0.76284,9acf8ffb6195a1c24b59056ca9824ef2f2a14a21c4fe2f3b07bc41b48646c0e7 +Sydney1973,Moon,2441697.9080208335,-33.87,151.21,20.0,65.155764809,25.717595892,12.762041425,29.268906248,0.76284,b46f2d0253a8f98115ae06b2a796e2be5a10a92acaa6a866542c6fb17b0a405b +Sydney1973,Jupiter,2441697.9080208335,-33.87,151.21,20.0,292.929750562,-21.967947001,234.762295388,-10.083253776,0.76284,7228fb0e02ccf6d351d2c1c46cdd0adbcb1c1d0207473c95b229d7f06fefb472 +Boston2015,Sun,2457194.1704513887,42.36,-71.06,10.0,88.936592117,23.430145785,152.96311288,69.299202337,-0.66926,40b2c550ad7274559f79505589d8aaf344850d0a27136574ad874a0563400454 +Boston2015,Moon,2457194.1704513887,42.36,-71.06,10.0,139.316035158,11.469417782,101.828672448,29.403695998,-0.66926,9adfd88a66f03168a3d3f0e9f503fd50fc8f62fd3efb62879c13dac5472d4b1d +Boston2015,Jupiter,2457194.1704513887,42.36,-71.06,10.0,142.408084565,15.723930429,95.866751456,29.955709173,-0.66926,5c8da018fbec859149f33db1e85949e570dc555f419afa2526ecd51c572eb3f9 +Sydney2015,Sun,2457194.4436458335,-33.87,151.21,20.0,89.222119565,23.434325371,46.477471362,15.860859128,-0.6694,b0f7e70e3f59ea88965df22a5e6833b96e624e0ab57adc8febfdafb424fec189 +Sydney2015,Moon,2457194.4436458335,-33.87,151.21,20.0,142.760401053,11.637431414,87.329555673,-17.195804772,-0.6694,5f6744d8e5356e4df47f4202042ae103c00458a74c0ae330adef524c4004b555 +Sydney2015,Jupiter,2457194.4436458335,-33.87,151.21,20.0,142.454545803,15.70931064,83.5155162,-19.075437088,-0.6694,2e203b2648fef8bd5a0cb515d9209e4ba1673f452a5223a684bdd22dcbb20554 diff --git a/crates/solar-ephemeris/tests/dut1_reference.rs b/crates/solar-ephemeris/tests/dut1_reference.rs new file mode 100644 index 00000000..e69f7570 --- /dev/null +++ b/crates/solar-ephemeris/tests/dut1_reference.rs @@ -0,0 +1,204 @@ +//! UT1 = UTC + DUT1 sets the Earth's rotation angle. Every other captured Horizons pointing +//! fixture is from 2026, where |DUT1| is below 0.08 s and moves the sky by about one +//! arcsecond: well inside those fixtures' 10 and 12 arcsecond budgets, so they stay green if +//! DUT1 is dropped. These rows are from two days where |DUT1| is 0.67 to 0.76 s, with both +//! signs, and are held to a budget that a dropped or reversed DUT1 cannot meet. +//! +//! The reference is `tests/fixtures/horizons-observer-dut1-20261112` at the repository root: +//! unmodified NASA/JPL Horizons replies, their request URLs and hashes. The CSV here is the +//! byte-identical derived matrix, admitted by `tests/python/test_horizons_dut1_reference.py`. + +use solar_ephemeris::sky_snapshot_json; + +const MATRIX: &str = include_str!("../data/horizons-observer-dut1-20261112.csv"); +/// About four times the worst measured residual (0.45 arcsec) and a fifth of the smallest +/// displacement a dropped DUT1 causes in this cohort (9.2 arcsec). +const POINTING_BUDGET_ARCSEC: f64 = 2.0; +/// The limit every other Horizons observer fixture applies to the tabulated DUT1. +const DUT1_BUDGET_SECONDS: f64 = 0.003; +/// Earth rotation in arcseconds of hour angle per UT1 second: 15 times the ratio of the +/// sidereal to the solar day. +const ROTATION_ARCSEC_PER_UT1_SECOND: f64 = 15.0 * 1.002_737_811_911_354_5; + +struct Row<'a> { + case: &'a str, + body: &'a str, + jd_utc: f64, + latitude: f64, + longitude: f64, + elevation: f64, + ra: f64, + dec: f64, + az: f64, + alt: f64, + dut1: f64, +} + +fn rows() -> Vec> { + let mut lines = MATRIX.lines(); + assert_eq!( + lines.next(), + Some("case,body,jd_utc,latitude_deg,longitude_deg_east,elevation_m,ra_deg,dec_deg,az_deg,alt_deg,dut1_seconds,raw_sha256") + ); + let rows: Vec<_> = lines + .map(|line| { + let cells: Vec<_> = line.split(',').collect(); + assert_eq!(cells.len(), 12, "{line}"); + let number = |index: usize| -> f64 { + let value: f64 = cells[index].parse().expect("numeric reference cell"); + assert!(value.is_finite()); + value + }; + Row { + case: cells[0], + body: cells[1], + jd_utc: number(2), + latitude: number(3), + longitude: number(4), + elevation: number(5), + ra: number(6), + dec: number(7), + az: number(8), + alt: number(9), + dut1: number(10), + } + }) + .collect(); + assert_eq!(rows.len(), 12, "two days, two sites, three bodies"); + rows +} + +/// Great-circle separation of two directions given as (latitude-like, longitude-like) degrees. +fn separation_arcsec(lat1: f64, lon1: f64, lat2: f64, lon2: f64) -> f64 { + let (a, b, delta) = ( + lat1.to_radians(), + lat2.to_radians(), + (lon1 - lon2).to_radians(), + ); + (a.sin() * b.sin() + a.cos() * b.cos() * delta.cos()) + .clamp(-1.0, 1.0) + .acos() + .to_degrees() + * 3600.0 +} + +/// The number that follows `"key":` in whitespace-free JSON text. +fn number_after(json: &str, key: &str) -> f64 { + let marker = format!("\"{key}\":"); + let start = json + .find(&marker) + .unwrap_or_else(|| panic!("{key} missing")) + + marker.len(); + let rest = &json[start..]; + let end = rest + .find(|c: char| !(c.is_ascii_digit() || matches!(c, '-' | '+' | '.' | 'e' | 'E'))) + .unwrap_or(rest.len()); + let value: f64 = rest[..end] + .parse() + .unwrap_or_else(|_| panic!("{key} is not a number")); + assert!(value.is_finite(), "{key}"); + value +} + +/// One body's object from the snapshot's `bodies` array. +fn body<'a>(json: &'a str, name: &str) -> &'a str { + let marker = format!("{{\"name\":\"{name}\","); + let start = json + .find(&marker) + .unwrap_or_else(|| panic!("{name} missing")); + let rest = &json[start..]; + let end = rest[1..] + .find("{\"name\":\"") + .map_or(rest.len(), |index| index + 1); + &rest[..end] +} + +#[test] +fn pointing_and_dut1_match_horizons_where_dut1_is_large() { + let mut snapshots: Vec<(&str, String)> = Vec::new(); + for row in rows() { + if !snapshots.iter().any(|(case, _)| *case == row.case) { + let json = sky_snapshot_json(row.jd_utc, row.latitude, row.longitude, row.elevation); + snapshots.push((row.case, json.split_whitespace().collect())); + } + let json = &snapshots + .iter() + .find(|(case, _)| *case == row.case) + .unwrap() + .1; + assert!(json.contains("\"schema_version\":\"ephemeris-snapshot.v4\"")); + assert!( + (number_after(json, "jd_utc") - row.jd_utc).abs() < 1e-9, + "{} snapshot is for another instant", + row.case + ); + + let dut1 = number_after(json, "dut1_seconds"); + assert!( + (dut1 - row.dut1).abs() <= DUT1_BUDGET_SECONDS, + "{} DUT1 {dut1} s differs from Horizons {} s", + row.case, + row.dut1 + ); + // The engine must also report the UT1 it used, not only the DUT1 it looked up. + let applied = (number_after(json, "jd_ut1") - number_after(json, "jd_utc")) * 86_400.0; + assert!( + (applied - row.dut1).abs() <= DUT1_BUDGET_SECONDS + 2e-4, + "{} applies UT1 - UTC = {applied} s, Horizons DUT1 is {} s", + row.case, + row.dut1 + ); + + let object = body(json, row.body); + let horizontal = separation_arcsec( + number_after(object, "alt_deg"), + number_after(object, "az_deg"), + row.alt, + row.az, + ); + assert!( + horizontal <= POINTING_BUDGET_ARCSEC, + "{}/{} altitude/azimuth is {horizontal} arcsec from Horizons", + row.case, + row.body + ); + let equatorial = separation_arcsec( + number_after(object, "topocentric_apparent_dec_deg"), + number_after(object, "topocentric_apparent_ra_deg"), + row.dec, + row.ra, + ); + assert!( + equatorial <= POINTING_BUDGET_ARCSEC, + "{}/{} RA/Dec is {equatorial} arcsec from Horizons", + row.case, + row.body + ); + } + assert_eq!(snapshots.len(), 4); +} + +#[test] +fn the_cohort_and_budget_can_detect_a_dropped_or_reversed_dut1() { + let rows = rows(); + assert!( + rows.iter().any(|row| row.dut1 >= 0.6), + "a large positive DUT1 is required" + ); + assert!( + rows.iter().any(|row| row.dut1 <= -0.6), + "a large negative DUT1 is required" + ); + for row in &rows { + // Ignoring DUT1 turns the Earth by this hour angle; a body at declination dec then + // moves by that angle times cos(dec). A reversed sign moves it twice as far. + let displacement = + ROTATION_ARCSEC_PER_UT1_SECOND * row.dut1.abs() * row.dec.to_radians().cos(); + assert!( + displacement >= 4.0 * POINTING_BUDGET_ARCSEC, + "{}/{} would move only {displacement} arcsec without DUT1", + row.case, + row.body + ); + } +} diff --git a/tests/fixtures/horizons-observer-dut1-20261112/README.md b/tests/fixtures/horizons-observer-dut1-20261112/README.md new file mode 100644 index 00000000..570deafc --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/README.md @@ -0,0 +1,54 @@ +# Captured Horizons observer reference for large DUT1: 2026-11-12 + +This pack retains 12 unmodified UTF-8 text responses from NASA/JPL Horizons API +1.2: the Sun, the Moon and Jupiter at two public city fixture sites on +**1973-01-15** and **2015-06-20**. The sites are test inputs, not the user's +location. Acquisition ran from 2026-11-12 03:37:12 to 03:37:20 UTC. + +The two days were chosen for their DUT1, which Horizons reports as +0.763 s and +-0.669 s. Every other observer pack in this repository is from 2026, where +DUT1 stays below 0.08 s and moves the sky by about one arcsecond, so those +packs cannot tell whether UT1 = UTC + DUT1 is applied at all. Here, ignoring +DUT1 moves each target by 9.2 to 10.7 arcseconds and reversing its sign moves +it twice as far. + +The exact request URLs, acquisition times, byte counts and response SHA-256 values +are in `manifest.json`. `query-helper.txt` preserves the acquisition helper at +base revision `ba1ef17cd7a7a9c87ac2324d312e209ed20f4009`; it is provenance, +not the executable helper for replay. Manifest SHA-256: +`f759cef7915ea2d1dc2a4a1febbeab1f5365f3a0c33c875de72d689797dca413`. + +Requests have the same shape as the [2026-07-01 pack](../horizons-observer-20261103/README.md): +observer quantities 2 (apparent RA/Dec), 4 (azimuth/elevation) and 49 (DUT1), +Earth geodetic sites, airless coordinates, numeric JD/UT, Gregorian calendar, +fractional seconds and angles in degrees. Request elevation is in kilometres; +the derived CSV stores metres. + +`observer-matrix.csv` is derived solely from those requests and responses. The +identical [crate copy](../../../crates/solar-ephemeris/data/horizons-observer-dut1-20261112.csv) +lets the native Rust regression run without network or Python. The Python +fixture test compares every CSV value and raw-response identity, and the strict +offline loader checks completeness, exact request association, byte hashes, +target, center, site and airless/API headers. It has no network fallback. +Hashes detect changes relative to the reviewed manifest; they do not authenticate +an arbitrary replacement manifest without review. + +From the repository root, with the installed locked toolchain: + +```text +cargo test --locked --offline -p solar-ephemeris --test dut1_reference +python -m unittest discover -s tests/python -p test_horizons_dut1_reference.py +``` + +The Rust test holds altitude/azimuth and RA/Dec to 2 arcseconds and DUT1 to +3 milliseconds. At capture the worst altitude/azimuth residual was 0.45 +arcseconds and the worst DUT1 difference 1.7 milliseconds. Passing these 12 +samples establishes no continuous accuracy span, heliocentric vector, range, +event, catalogue-star or visibility qualification. This pack is not an accepted +UI accuracy registry. + +An intentional update requires newly retained raw responses and acquisition +provenance, both derived CSV copies and the pinned-manifest fixture test. Do +not regenerate references from Sol's own output or widen the budget to +accommodate a regression: the budget must stay well below the displacement a +dropped DUT1 causes, which the Rust test also asserts. diff --git a/tests/fixtures/horizons-observer-dut1-20261112/boston1973-jupiter.txt b/tests/fixtures/horizons-observer-dut1-20261112/boston1973-jupiter.txt new file mode 100644 index 00000000..4e7bc12a --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/boston1973-jupiter.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:14 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Jupiter (599) {source: jup365_merged} +Center body name: Earth (399) {source: jup365_merged} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 1973-Jan-15 03:21:09.0000 UT +Stop time : A.D. 1973-Jan-15 03:21:09.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : IAU_JUPITER {West-longitude positive} +Target radii : 71492.0, 71492.0, 66854.0 km {Equator_a, b, pole_c} +Center geodetic : 288.94, 42.36, .010 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 288.94, 4720.15622, 4275.24293 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: jup365_merged} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2441697.639687500, ,m, 292.863062598, -21.977617052, 315.806954845, -64.066905952, 0.76363, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/boston1973-moon.txt b/tests/fixtures/horizons-observer-dut1-20261112/boston1973-moon.txt new file mode 100644 index 00000000..b54899d7 --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/boston1973-moon.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:13 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Moon (301) {source: DE441} +Center body name: Earth (399) {source: DE441} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 1973-Jan-15 03:21:09.0000 UT +Stop time : A.D. 1973-Jan-15 03:21:09.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : MOON_ME {East-longitude positive} +Target radii : 1737.4, 1737.4, 1737.4 km {Equator_a, b, pole_c} +Center geodetic : 288.94, 42.36, .010 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 288.94, 4720.15622, 4275.24293 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Earth +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: DE441} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2441697.639687500, ,m, 60.215320657, 24.055427038, 247.150608244, 56.887836047, 0.76363, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/boston1973-sun.txt b/tests/fixtures/horizons-observer-dut1-20261112/boston1973-sun.txt new file mode 100644 index 00000000..2c4a0a47 --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/boston1973-sun.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:13 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Sun (10) {source: DE441} +Center body name: Earth (399) {source: DE441} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 1973-Jan-15 03:21:09.0000 UT +Stop time : A.D. 1973-Jan-15 03:21:09.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : IAU_SUN {East-longitude positive} +Target radii : 695700.0, 695700.0, 695700.0 km {Equator_a, b, pole_c} +Center geodetic : 288.94, 42.36, .010 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 288.94, 4720.15622, 4275.24293 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: DE441} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2441697.639687500, ,m, 296.782400602, -21.163101405, 310.364964434, -61.287241442, 0.76363, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/boston2015-jupiter.txt b/tests/fixtures/horizons-observer-dut1-20261112/boston2015-jupiter.txt new file mode 100644 index 00000000..271f6e7b --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/boston2015-jupiter.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:18 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Jupiter (599) {source: jup365_merged} +Center body name: Earth (399) {source: jup365_merged} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 2015-Jun-20 16:05:27.0000 UT +Stop time : A.D. 2015-Jun-20 16:05:27.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : IAU_JUPITER {West-longitude positive} +Target radii : 71492.0, 71492.0, 66854.0 km {Equator_a, b, pole_c} +Center geodetic : 288.94, 42.36, .010 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 288.94, 4720.15622, 4275.24293 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: jup365_merged} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2457194.170451389,*,m, 142.408084565, 15.723930429, 95.866751456, 29.955709173, -0.66926, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/boston2015-moon.txt b/tests/fixtures/horizons-observer-dut1-20261112/boston2015-moon.txt new file mode 100644 index 00000000..21c3d61b --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/boston2015-moon.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:17 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Moon (301) {source: DE441} +Center body name: Earth (399) {source: DE441} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 2015-Jun-20 16:05:27.0000 UT +Stop time : A.D. 2015-Jun-20 16:05:27.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : MOON_ME {East-longitude positive} +Target radii : 1737.4, 1737.4, 1737.4 km {Equator_a, b, pole_c} +Center geodetic : 288.94, 42.36, .010 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 288.94, 4720.15622, 4275.24293 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Earth +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: DE441} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2457194.170451389,*,m, 139.316035158, 11.469417782, 101.828672448, 29.403695998, -0.66926, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/boston2015-sun.txt b/tests/fixtures/horizons-observer-dut1-20261112/boston2015-sun.txt new file mode 100644 index 00000000..0c66658f --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/boston2015-sun.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:16 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Sun (10) {source: DE441} +Center body name: Earth (399) {source: DE441} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 2015-Jun-20 16:05:27.0000 UT +Stop time : A.D. 2015-Jun-20 16:05:27.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : IAU_SUN {East-longitude positive} +Target radii : 695700.0, 695700.0, 695700.0 km {Equator_a, b, pole_c} +Center geodetic : 288.94, 42.36, .010 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 288.94, 4720.15622, 4275.24293 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: DE441} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2457194.170451389,*,m, 88.936592117, 23.430145785, 152.963112880, 69.299202337, -0.66926, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/manifest.json b/tests/fixtures/horizons-observer-dut1-20261112/manifest.json new file mode 100644 index 00000000..3d9950a3 --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/manifest.json @@ -0,0 +1,135 @@ +{ + "schema_version": "horizons-observer-reference.v1", + "source": "NASA/JPL Horizons API", + "api_version": "1.2", + "endpoint": "https://ssd.jpl.nasa.gov/api/horizons.api", + "quantities": [ + 2, + 4, + 49 + ], + "scope": "airless topocentric apparent coordinates and DUT1 at the recorded sites/instants only", + "limitations": "Two days (1973-01-15 and 2015-06-20), two sites, three targets; chosen for large DUT1 of both signs. No continuous span, range, event, catalogue-star or heliocentric orbit qualification. Not accepted UI accuracy registry evidence.", + "acquisition_started_utc": "2026-11-12T03:37:12.552861+00:00", + "acquisition_finished_utc": "2026-11-12T03:37:20.443461+00:00", + "query_helper": { + "path": "query-helper.txt", + "sha256": "d607bdb11b9ded5c9c18010d80362fe6c1c480c748fb5de72f2ce65dc5d99456", + "base_git_revision": "ba1ef17cd7a7a9c87ac2324d312e209ed20f4009" + }, + "derived_matrix": { + "path": "observer-matrix.csv", + "bytes": 2279, + "sha256": "0b9a2f5b684490b1bb66224228c8ccfe354f9d9b60a3ce10aea82ee0bf77ed7a" + }, + "records": [ + { + "case": "Boston1973", + "body": "Sun", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%2710%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27288.94%2C42.36%2C0.01%27&TLIST=%272441697.639687499963%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "boston1973-sun.txt", + "bytes": 7925, + "sha256": "940e9337ed108871806c6b857e45ef88ed18ceffbee2d5306336394ccf4edabb", + "acquired_at_utc": "2026-11-12T03:37:13.383370+00:00" + }, + { + "case": "Boston1973", + "body": "Moon", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27301%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27288.94%2C42.36%2C0.01%27&TLIST=%272441697.639687499963%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "boston1973-moon.txt", + "bytes": 7927, + "sha256": "eb6176577e492cfc0a510053ae58faf16b636880c78f6fc22c06a891f2c7af74", + "acquired_at_utc": "2026-11-12T03:37:14.005754+00:00" + }, + { + "case": "Boston1973", + "body": "Jupiter", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27599%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27288.94%2C42.36%2C0.01%27&TLIST=%272441697.639687499963%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "boston1973-jupiter.txt", + "bytes": 7949, + "sha256": "bd33022155465179d41f3b14dbf8a7c6053277e51140480e5b6ce2ef78279d93", + "acquired_at_utc": "2026-11-12T03:37:14.686507+00:00" + }, + { + "case": "Sydney1973", + "body": "Sun", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%2710%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27151.21%2C-33.87%2C0.02%27&TLIST=%272441697.908020833507%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "sydney1973-sun.txt", + "bytes": 7925, + "sha256": "9acf8ffb6195a1c24b59056ca9824ef2f2a14a21c4fe2f3b07bc41b48646c0e7", + "acquired_at_utc": "2026-11-12T03:37:15.313521+00:00" + }, + { + "case": "Sydney1973", + "body": "Moon", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27301%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27151.21%2C-33.87%2C0.02%27&TLIST=%272441697.908020833507%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "sydney1973-moon.txt", + "bytes": 7927, + "sha256": "b46f2d0253a8f98115ae06b2a796e2be5a10a92acaa6a866542c6fb17b0a405b", + "acquired_at_utc": "2026-11-12T03:37:15.975302+00:00" + }, + { + "case": "Sydney1973", + "body": "Jupiter", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27599%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27151.21%2C-33.87%2C0.02%27&TLIST=%272441697.908020833507%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "sydney1973-jupiter.txt", + "bytes": 7949, + "sha256": "7228fb0e02ccf6d351d2c1c46cdd0adbcb1c1d0207473c95b229d7f06fefb472", + "acquired_at_utc": "2026-11-12T03:37:16.612821+00:00" + }, + { + "case": "Boston2015", + "body": "Sun", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%2710%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27288.94%2C42.36%2C0.01%27&TLIST=%272457194.170451388694%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "boston2015-sun.txt", + "bytes": 7925, + "sha256": "40b2c550ad7274559f79505589d8aaf344850d0a27136574ad874a0563400454", + "acquired_at_utc": "2026-11-12T03:37:17.269621+00:00" + }, + { + "case": "Boston2015", + "body": "Moon", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27301%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27288.94%2C42.36%2C0.01%27&TLIST=%272457194.170451388694%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "boston2015-moon.txt", + "bytes": 7927, + "sha256": "9adfd88a66f03168a3d3f0e9f503fd50fc8f62fd3efb62879c13dac5472d4b1d", + "acquired_at_utc": "2026-11-12T03:37:17.903305+00:00" + }, + { + "case": "Boston2015", + "body": "Jupiter", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27599%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27288.94%2C42.36%2C0.01%27&TLIST=%272457194.170451388694%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "boston2015-jupiter.txt", + "bytes": 7949, + "sha256": "5c8da018fbec859149f33db1e85949e570dc555f419afa2526ecd51c572eb3f9", + "acquired_at_utc": "2026-11-12T03:37:18.546272+00:00" + }, + { + "case": "Sydney2015", + "body": "Sun", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%2710%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27151.21%2C-33.87%2C0.02%27&TLIST=%272457194.443645833526%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "sydney2015-sun.txt", + "bytes": 7925, + "sha256": "b0f7e70e3f59ea88965df22a5e6833b96e624e0ab57adc8febfdafb424fec189", + "acquired_at_utc": "2026-11-12T03:37:19.169616+00:00" + }, + { + "case": "Sydney2015", + "body": "Moon", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27301%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27151.21%2C-33.87%2C0.02%27&TLIST=%272457194.443645833526%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "sydney2015-moon.txt", + "bytes": 7927, + "sha256": "5f6744d8e5356e4df47f4202042ae103c00458a74c0ae330adef524c4004b555", + "acquired_at_utc": "2026-11-12T03:37:19.797505+00:00" + }, + { + "case": "Sydney2015", + "body": "Jupiter", + "request_url": "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27599%27&OBJ_DATA=%27NO%27&MAKE_EPHEM=%27YES%27&EPHEM_TYPE=%27OBSERVER%27&CENTER=%27coord%40399%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%27151.21%2C-33.87%2C0.02%27&TLIST=%272457194.443645833526%27&TLIST_TYPE=%27JD%27&TIME_TYPE=%27UT%27&CAL_FORMAT=%27JD%27&CAL_TYPE=%27GREGORIAN%27&TIME_DIGITS=%27FRACSEC%27&QUANTITIES=%272%2C4%2C49%27&ANG_FORMAT=%27DEG%27&APPARENT=%27AIRLESS%27&EXTRA_PREC=%27YES%27&CSV_FORMAT=%27YES%27&ELEV_CUT=%27-90%27", + "path": "sydney2015-jupiter.txt", + "bytes": 7949, + "sha256": "2e203b2648fef8bd5a0cb515d9209e4ba1673f452a5223a684bdd22dcbb20554", + "acquired_at_utc": "2026-11-12T03:37:20.442728+00:00" + } + ] +} diff --git a/tests/fixtures/horizons-observer-dut1-20261112/observer-matrix.csv b/tests/fixtures/horizons-observer-dut1-20261112/observer-matrix.csv new file mode 100644 index 00000000..690d0f41 --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/observer-matrix.csv @@ -0,0 +1,13 @@ +case,body,jd_utc,latitude_deg,longitude_deg_east,elevation_m,ra_deg,dec_deg,az_deg,alt_deg,dut1_seconds,raw_sha256 +Boston1973,Sun,2441697.6396875,42.36,-71.06,10.0,296.782400602,-21.163101405,310.364964434,-61.287241442,0.76363,940e9337ed108871806c6b857e45ef88ed18ceffbee2d5306336394ccf4edabb +Boston1973,Moon,2441697.6396875,42.36,-71.06,10.0,60.215320657,24.055427038,247.150608244,56.887836047,0.76363,eb6176577e492cfc0a510053ae58faf16b636880c78f6fc22c06a891f2c7af74 +Boston1973,Jupiter,2441697.6396875,42.36,-71.06,10.0,292.863062598,-21.977617052,315.806954845,-64.066905952,0.76363,bd33022155465179d41f3b14dbf8a7c6053277e51140480e5b6ce2ef78279d93 +Sydney1973,Sun,2441697.9080208335,-33.87,151.21,20.0,297.069388271,-21.111340746,238.014136869,-7.793818083,0.76284,9acf8ffb6195a1c24b59056ca9824ef2f2a14a21c4fe2f3b07bc41b48646c0e7 +Sydney1973,Moon,2441697.9080208335,-33.87,151.21,20.0,65.155764809,25.717595892,12.762041425,29.268906248,0.76284,b46f2d0253a8f98115ae06b2a796e2be5a10a92acaa6a866542c6fb17b0a405b +Sydney1973,Jupiter,2441697.9080208335,-33.87,151.21,20.0,292.929750562,-21.967947001,234.762295388,-10.083253776,0.76284,7228fb0e02ccf6d351d2c1c46cdd0adbcb1c1d0207473c95b229d7f06fefb472 +Boston2015,Sun,2457194.1704513887,42.36,-71.06,10.0,88.936592117,23.430145785,152.96311288,69.299202337,-0.66926,40b2c550ad7274559f79505589d8aaf344850d0a27136574ad874a0563400454 +Boston2015,Moon,2457194.1704513887,42.36,-71.06,10.0,139.316035158,11.469417782,101.828672448,29.403695998,-0.66926,9adfd88a66f03168a3d3f0e9f503fd50fc8f62fd3efb62879c13dac5472d4b1d +Boston2015,Jupiter,2457194.1704513887,42.36,-71.06,10.0,142.408084565,15.723930429,95.866751456,29.955709173,-0.66926,5c8da018fbec859149f33db1e85949e570dc555f419afa2526ecd51c572eb3f9 +Sydney2015,Sun,2457194.4436458335,-33.87,151.21,20.0,89.222119565,23.434325371,46.477471362,15.860859128,-0.6694,b0f7e70e3f59ea88965df22a5e6833b96e624e0ab57adc8febfdafb424fec189 +Sydney2015,Moon,2457194.4436458335,-33.87,151.21,20.0,142.760401053,11.637431414,87.329555673,-17.195804772,-0.6694,5f6744d8e5356e4df47f4202042ae103c00458a74c0ae330adef524c4004b555 +Sydney2015,Jupiter,2457194.4436458335,-33.87,151.21,20.0,142.454545803,15.70931064,83.5155162,-19.075437088,-0.6694,2e203b2648fef8bd5a0cb515d9209e4ba1673f452a5223a684bdd22dcbb20554 diff --git a/tests/fixtures/horizons-observer-dut1-20261112/query-helper.txt b/tests/fixtures/horizons-observer-dut1-20261112/query-helper.txt new file mode 100644 index 00000000..c5f03c21 --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/query-helper.txt @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +"""Acquire the high-DUT1 Horizons observer reference pack. + +Run once from the repository root with network access: + + python query-helper.py OUTPUT_DIRECTORY + +It reuses the request builder and row parser of tools/validate_ephemeris.py, so +the request shape, quantities (2, 4, 49), airless apparent coordinates and +geodetic sites are exactly those of the 2026-07-01 pack. Only the instants +differ: they are chosen where |DUT1| is large and of both signs, so a pointing +comparison detects UT1 = UTC + DUT1 being dropped or applied with the wrong sign. + +This file is retained as acquisition provenance. Replay never runs it. +""" +from __future__ import annotations + +import csv +import datetime as dt +import hashlib +import io +import json +from pathlib import Path +import subprocess +import sys + +ROOT = Path.cwd() +sys.path.insert(0, str(ROOT / 'tools')) +import validate_ephemeris as helper # noqa: E402 + +UTC = dt.timezone.utc +# (label, UTC, lat_deg, lon_deg_east, elev_m). Two weeks after the 1973-01-01 leap second +# DUT1 is near +0.8 s; ten days before the 2015-07-01 leap second it is near -0.7 s. +CASES = [ + ('Boston1973', dt.datetime(1973, 1, 15, 3, 21, 9, tzinfo=UTC), 42.36, -71.06, 10.0), + ('Sydney1973', dt.datetime(1973, 1, 15, 9, 47, 33, tzinfo=UTC), -33.87, 151.21, 20.0), + ('Boston2015', dt.datetime(2015, 6, 20, 16, 5, 27, tzinfo=UTC), 42.36, -71.06, 10.0), + ('Sydney2015', dt.datetime(2015, 6, 20, 22, 38, 51, tzinfo=UTC), -33.87, 151.21, 20.0), +] +BODIES = {'Sun': '10', 'Moon': '301', 'Jupiter': '599'} +FIELDS = ['case', 'body', 'jd_utc', 'latitude_deg', 'longitude_deg_east', 'elevation_m', + 'ra_deg', 'dec_deg', 'az_deg', 'alt_deg', 'dut1_seconds', 'raw_sha256'] + + +def now() -> str: + return dt.datetime.now(UTC).isoformat() + + +def main() -> int: + out = Path(sys.argv[1]).resolve() + out.mkdir(parents=True, exist_ok=False) + started, records, rows, api_versions = now(), [], [], set() + for label, when, lat, lon, elev in CASES: + for body, command in BODIES.items(): + url = helper.horizons_request_url(command, when, lat, lon, elev) + text = helper.fetch_with_retry(url) + acquired = now() + raw = text.encode('utf-8') + api_versions.add(text.split('\n', 1)[0].removeprefix('API VERSION: ')) + reference = helper.horizons_observation(command, when, lat, lon, elev, fetch=lambda _url, reply=text: reply) + name = f'{label.lower()}-{body.lower()}.txt' + (out / name).write_bytes(raw) + digest = hashlib.sha256(raw).hexdigest() + records.append({'case': label, 'body': body, 'request_url': url, 'path': name, + 'bytes': len(raw), 'sha256': digest, 'acquired_at_utc': acquired}) + rows.append({'case': label, 'body': body, 'jd_utc': repr(when.timestamp() / 86400 + 2440587.5), + 'latitude_deg': repr(lat), 'longitude_deg_east': repr(lon), 'elevation_m': repr(elev), + 'ra_deg': repr(reference['ra_deg']), 'dec_deg': repr(reference['dec_deg']), + 'az_deg': repr(reference['az_deg']), 'alt_deg': repr(reference['el_deg']), + 'dut1_seconds': repr(reference['dut1_seconds']), 'raw_sha256': digest}) + finished = now() + if len(api_versions) != 1: + raise SystemExit('responses disagree on the API version') + buffer = io.StringIO() + writer = csv.DictWriter(buffer, FIELDS, lineterminator='\n') + writer.writeheader() + writer.writerows(rows) + matrix = buffer.getvalue().encode('utf-8') + (out / 'observer-matrix.csv').write_bytes(matrix) + helper_raw = Path(__file__).read_bytes() + (out / 'query-helper.txt').write_bytes(helper_raw) + revision = subprocess.run(['git', 'rev-parse', 'HEAD'], check=True, capture_output=True, text=True).stdout.strip() + manifest = { + 'schema_version': 'horizons-observer-reference.v1', 'source': 'NASA/JPL Horizons API', + 'api_version': api_versions.pop(), 'endpoint': helper_endpoint(), 'quantities': [2, 4, 49], + 'scope': 'airless topocentric apparent coordinates and DUT1 at the recorded sites/instants only', + 'limitations': 'Two days (1973-01-15 and 2015-06-20), two sites, three targets; chosen for large DUT1 of ' + 'both signs. No continuous span, range, event, catalogue-star or heliocentric orbit ' + 'qualification. Not accepted UI accuracy registry evidence.', + 'acquisition_started_utc': started, 'acquisition_finished_utc': finished, + 'query_helper': {'path': 'query-helper.txt', 'sha256': hashlib.sha256(helper_raw).hexdigest(), + 'base_git_revision': revision}, + 'derived_matrix': {'path': 'observer-matrix.csv', 'bytes': len(matrix), + 'sha256': hashlib.sha256(matrix).hexdigest()}, + 'records': records, + } + (out / 'manifest.json').write_text(json.dumps(manifest, indent=2) + '\n', encoding='utf-8') + for row in rows: + print(row['case'], row['body'], row['dut1_seconds'], row['alt_deg'], row['az_deg']) + return 0 + + +def helper_endpoint() -> str: + from horizons_reference import ENDPOINT + return ENDPOINT + + +if __name__ == '__main__': + raise SystemExit(main()) diff --git a/tests/fixtures/horizons-observer-dut1-20261112/sydney1973-jupiter.txt b/tests/fixtures/horizons-observer-dut1-20261112/sydney1973-jupiter.txt new file mode 100644 index 00000000..9188e419 --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/sydney1973-jupiter.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:16 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Jupiter (599) {source: jup365_merged} +Center body name: Earth (399) {source: jup365_merged} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 1973-Jan-15 09:47:33.0000 UT +Stop time : A.D. 1973-Jan-15 09:47:33.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : IAU_JUPITER {West-longitude positive} +Target radii : 71492.0, 71492.0, 66854.0 km {Equator_a, b, pole_c} +Center geodetic : 151.21, -33.87, .020 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 151.21, 5301.3248, -3534.49405 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: jup365_merged} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2441697.908020834,N,m, 292.929750562, -21.967947001, 234.762295388, -10.083253776, 0.76284, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/sydney1973-moon.txt b/tests/fixtures/horizons-observer-dut1-20261112/sydney1973-moon.txt new file mode 100644 index 00000000..0a0468b3 --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/sydney1973-moon.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:15 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Moon (301) {source: DE441} +Center body name: Earth (399) {source: DE441} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 1973-Jan-15 09:47:33.0000 UT +Stop time : A.D. 1973-Jan-15 09:47:33.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : MOON_ME {East-longitude positive} +Target radii : 1737.4, 1737.4, 1737.4 km {Equator_a, b, pole_c} +Center geodetic : 151.21, -33.87, .020 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 151.21, 5301.3248, -3534.49405 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Earth +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: DE441} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2441697.908020834,N,m, 65.155764809, 25.717595892, 12.762041425, 29.268906248, 0.76284, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/sydney1973-sun.txt b/tests/fixtures/horizons-observer-dut1-20261112/sydney1973-sun.txt new file mode 100644 index 00000000..0ecb95c2 --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/sydney1973-sun.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:14 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Sun (10) {source: DE441} +Center body name: Earth (399) {source: DE441} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 1973-Jan-15 09:47:33.0000 UT +Stop time : A.D. 1973-Jan-15 09:47:33.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : IAU_SUN {East-longitude positive} +Target radii : 695700.0, 695700.0, 695700.0 km {Equator_a, b, pole_c} +Center geodetic : 151.21, -33.87, .020 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 151.21, 5301.3248, -3534.49405 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: DE441} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2441697.908020834,N,m, 297.069388271, -21.111340746, 238.014136869, -7.793818083, 0.76284, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/sydney2015-jupiter.txt b/tests/fixtures/horizons-observer-dut1-20261112/sydney2015-jupiter.txt new file mode 100644 index 00000000..f4ab37eb --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/sydney2015-jupiter.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:20 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Jupiter (599) {source: jup365_merged} +Center body name: Earth (399) {source: jup365_merged} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 2015-Jun-20 22:38:51.0000 UT +Stop time : A.D. 2015-Jun-20 22:38:51.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : IAU_JUPITER {West-longitude positive} +Target radii : 71492.0, 71492.0, 66854.0 km {Equator_a, b, pole_c} +Center geodetic : 151.21, -33.87, .020 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 151.21, 5301.3248, -3534.49405 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: jup365_merged} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2457194.443645834,*, , 142.454545803, 15.709310640, 83.515516200, -19.075437088, -0.66940, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/sydney2015-moon.txt b/tests/fixtures/horizons-observer-dut1-20261112/sydney2015-moon.txt new file mode 100644 index 00000000..799a8941 --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/sydney2015-moon.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:19 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Moon (301) {source: DE441} +Center body name: Earth (399) {source: DE441} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 2015-Jun-20 22:38:51.0000 UT +Stop time : A.D. 2015-Jun-20 22:38:51.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : MOON_ME {East-longitude positive} +Target radii : 1737.4, 1737.4, 1737.4 km {Equator_a, b, pole_c} +Center geodetic : 151.21, -33.87, .020 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 151.21, 5301.3248, -3534.49405 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Earth +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: DE441} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2457194.443645834,*, , 142.760401053, 11.637431414, 87.329555673, -17.195804772, -0.66940, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/fixtures/horizons-observer-dut1-20261112/sydney2015-sun.txt b/tests/fixtures/horizons-observer-dut1-20261112/sydney2015-sun.txt new file mode 100644 index 00000000..ea6ec0df --- /dev/null +++ b/tests/fixtures/horizons-observer-dut1-20261112/sydney2015-sun.txt @@ -0,0 +1,153 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + + + +******************************************************************************* +Ephemeris / API_USER Wed Nov 11 19:37:18 2026 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Sun (10) {source: DE441} +Center body name: Earth (399) {source: DE441} +Center-site name: (user defined site below) +******************************************************************************* +Start time : A.D. 2015-Jun-20 22:38:51.0000 UT +Stop time : A.D. 2015-Jun-20 22:38:51.0000 UT +Step-size : DISCRETE TIME-LIST +******************************************************************************* +Target pole/equ : IAU_SUN {East-longitude positive} +Target radii : 695700.0, 695700.0, 695700.0 km {Equator_a, b, pole_c} +Center geodetic : 151.21, -33.87, .020 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 151.21, 5301.3248, -3534.49405 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: DE441} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : JD +Calendar mode : Gregorian +EOP file : eop.261111.p270207 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2026-NOV-11. PREDICTS-> 2027-FEB-06 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +*************************************************************************************************** +Date_________JDUT, , , R.A.__(a-app), DEC___(a-app), Azimuth_(a-app), Elevation_(a-app), UT1-UTC, +*************************************************************************************************** +$$SOE +2457194.443645834,*, , 89.222119565, 23.434325371, 46.477471362, 15.860859128, -0.66940, +$$EOE +*************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Calendar dates are given in the modern Gregorian system, extended prior to +its 1582-Oct-15 adoption. The Gregorian calendar more closely corresponds to +physical Earth seasons and orbital motion, but can differ by up to 10 days with +historical records made under the prior Julian calendar, more if the Julian +calendar was extended prior to its 45-Jan-1 BC adoption to label the historical +event. Select "mixed" calendar mode if correlation with historical dates prior +to A.D. 1582 is important. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +SOLAR PRESENCE (OBSERVING SITE) + Time tag is followed by a blank, then a solar-presence symbol: + + '*' Daylight (refracted solar upper-limb on or above apparent horizon) + 'C' Civil twilight/dawn + 'N' Nautical twilight/dawn + 'A' Astronomical twilight/dawn + ' ' Night OR geocentric ephemeris + +LUNAR PRESENCE (OBSERVING SITE) + The solar-presence symbol is immediately followed by a lunar-presence symbol: + + 'm' Refracted upper-limb of Moon on or above apparent horizon + ' ' Refracted upper-limb of Moon below apparent horizon OR geocentric + ephemeris + + 'R.A.__(a-app), DEC___(a-app),' = + Airless apparent right ascension and declination of the target center +with respect to an instantaneous reference frame defined by the Earth equator +of-date (z-axis) and meridian containing the Earth equinox of-date (x-axis, +EOP-corrected IAU76/80). Compensated for down-leg light-time delay, +gravitational deflection of light, stellar aberration, precession & nutation. +Note: equinox (RA origin) is offset -53 mas from the of-date frame defined by +the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'Azimuth_(a-app), Elevation_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'UT1-UTC,' = + Difference between the UT1 and UTC timescales ("DUT1"). UT1 is the +Earth-rotation dependent mean solar time on the Greenwich meridian sometimes +referred to as GMT. UTC is a discontinuous timescale derived from the atomic +TAI timescale, adjusted by leap seconds to provide a civil timescale +maintained within 0.9 seconds of UT1. Therefore, the difference UT1-UTC will +have discontinuities where leap-seconds are inserted in UTC. UTC is not +well-defined prior to 1962, so "n.a." will be returned for earlier dates. +The UT1 here is a JPL fit to measurements of the Earth rotation which can +change rapidly and unpredictably at the 10^-4 second level due to tides and +other factors affecting Earth rotation. Values for the 14 days prior to the +present date are considered provisional and may change at up to the 0.002 +second level as data accumulates, corresponding to about 1-meter (3-sigma) +for an Earth equatorial site. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Inquiries : Jon.D.Giorgini@jpl.nasa.gov + +*************************************************************************************************** diff --git a/tests/python/test_horizons_dut1_reference.py b/tests/python/test_horizons_dut1_reference.py new file mode 100644 index 00000000..cff505b6 --- /dev/null +++ b/tests/python/test_horizons_dut1_reference.py @@ -0,0 +1,81 @@ +"""Admission of the captured high-DUT1 Horizons observer pack and its derived matrix.""" +from __future__ import annotations +import csv +import datetime as dt +import hashlib +from pathlib import Path +import sys +import unittest + +ROOT=Path(__file__).resolve().parents[2] +sys.path.insert(0,str(ROOT/'tools')) +import validate_ephemeris as helper +from horizons_reference import load_reference_pack + +PACK=ROOT/'tests/fixtures/horizons-observer-dut1-20261112' +CRATE_COPY=ROOT/'crates/solar-ephemeris/data/horizons-observer-dut1-20261112.csv' +MANIFEST_SHA='f759cef7915ea2d1dc2a4a1febbeab1f5365f3a0c33c875de72d689797dca413' +UTC=dt.timezone.utc +# Two weeks after the 1973-01-01 leap second and ten days before the 2015-07-01 one. +CASES=[ + ('Boston1973',dt.datetime(1973,1,15,3,21,9,tzinfo=UTC),42.36,-71.06,10.0), + ('Sydney1973',dt.datetime(1973,1,15,9,47,33,tzinfo=UTC),-33.87,151.21,20.0), + ('Boston2015',dt.datetime(2015,6,20,16,5,27,tzinfo=UTC),42.36,-71.06,10.0), + ('Sydney2015',dt.datetime(2015,6,20,22,38,51,tzinfo=UTC),-33.87,151.21,20.0), +] +BODIES={'Sun':'10','Moon':'301','Jupiter':'599'} + +def requests(): + return {(label,body):helper.horizons_request_url(command,when,lat,lon,elev) + for label,when,lat,lon,elev in CASES for body,command in BODIES.items()} + + +class HorizonsDut1ReferenceTests(unittest.TestCase): + def test_accepted_acquisition_has_pinned_identity_and_exact_requests(self): + pack=load_reference_pack(PACK,requests()) + self.assertEqual(pack.manifest_sha256,MANIFEST_SHA) + self.assertEqual(len(pack.responses),12) + first=next(iter(requests().values())) + self.assertEqual(pack.fetch(first),(PACK/'boston1973-sun.txt').read_text(encoding='utf-8')) + with self.assertRaises(ValueError):pack.fetch(first+'&unexpected=1') + + def test_a_different_instant_site_or_target_is_not_this_pack(self): + for edit in (lambda cases,bodies:(cases[:-1],bodies),lambda cases,bodies:(cases,{**bodies,'Jupiter':'699'}), + lambda cases,bodies:([(cases[0][0],cases[0][1]+dt.timedelta(seconds=1),*cases[0][2:]),*cases[1:]],bodies), + lambda cases,bodies:([(*cases[0][:2],42.37,*cases[0][3:]),*cases[1:]],bodies)): + cases,bodies=edit(list(CASES),dict(BODIES)) + expected={(label,body):helper.horizons_request_url(command,when,lat,lon,elev) + for label,when,lat,lon,elev in cases for body,command in bodies.items()} + with self.assertRaises(ValueError):load_reference_pack(PACK,expected) + + def test_derived_crate_matrix_is_exactly_bound_to_raw_responses(self): + pack=load_reference_pack(PACK,requests()) + matrix=(PACK/'observer-matrix.csv').read_bytes() + self.assertEqual(matrix,CRATE_COPY.read_bytes()) + rows=list(csv.DictReader(matrix.decode().splitlines()));self.assertEqual(len(rows),12) + for row,(label,body) in zip(rows,requests()): + _,when,lat,lon,elev=next(case for case in CASES if case[0]==label) + ref=helper.horizons_observation(BODIES[body],when,lat,lon,elev,fetch=pack.fetch) + self.assertEqual((row['case'],row['body']),(label,body)) + for key,value in [('jd_utc',when.timestamp()/86400+2440587.5),('latitude_deg',lat), + ('longitude_deg_east',lon),('elevation_m',elev),('ra_deg',ref['ra_deg']),('dec_deg',ref['dec_deg']), + ('az_deg',ref['az_deg']),('alt_deg',ref['el_deg']),('dut1_seconds',ref['dut1_seconds'])]: + self.assertEqual(float(row[key]),value,(label,body,key)) + self.assertEqual(row['raw_sha256'],hashlib.sha256(pack.fetch(requests()[(label,body)]).encode()).hexdigest()) + + def test_the_cohort_keeps_the_property_it_was_captured_for(self): + # The pack exists to exercise UT1 = UTC + DUT1. Low-DUT1 replacements would defeat it. + values={row['case']:float(row['dut1_seconds']) for row in csv.DictReader(CRATE_COPY.read_text().splitlines())} + self.assertEqual(set(values),{case[0] for case in CASES}) + self.assertTrue(all(value>=0.6 for case,value in values.items() if case.endswith('1973')),values) + self.assertTrue(all(value<=-0.6 for case,value in values.items() if case.endswith('2015')),values) + + def test_the_retained_helper_requested_these_cases(self): + helper_text=(PACK/'query-helper.txt').read_text(encoding='utf-8') + for label,when,lat,lon,elev in CASES: + line=f"('{label}', dt.datetime({when.year}, {when.month}, {when.day}, {when.hour}, {when.minute}, {when.second}, tzinfo=UTC), {lat}, {lon}, {elev})," + self.assertIn(line,helper_text) + self.assertIn("BODIES = {'Sun': '10', 'Moon': '301', 'Jupiter': '599'}",helper_text) + + +if __name__=='__main__':unittest.main() From 7861f6cb40ce543ca832eb1321de542341d82113 Mon Sep 17 00:00:00 2001 From: Min Kang Date: Thu, 12 Nov 2026 06:14:47 +0000 Subject: [PATCH 7/8] Fix high-DPI timeline picking and bound module recovery to complete dependencies --- apps/web/app.js | 2 +- apps/web/js/butterflyGeometry.js | 5 + apps/web/js/catalogueLoader.js | 53 +- apps/web/js/orrery.js | 2 +- apps/web/js/render.js | 6 +- apps/web/js/research.js | 6 +- apps/web/module-dependencies.v1.json | 531 ++++++++++++++++++ apps/web/startup-modules.v1.json | 4 +- .../plans/2026-11-12-review-fixes.md | 39 ++ tests/web/butterflyPicking.test.mjs | 19 + tests/web/catalogueLoader.test.mjs | 53 +- tests/web/moduleGraph.test.mjs | 6 + tests/web/researchLifecycle.test.mjs | 1 + tests/web/webBundle.test.mjs | 11 + tools/bundle_web.mjs | 5 +- tools/module_graph.mjs | 12 + tools/validate_module_graph.mjs | 7 +- 17 files changed, 741 insertions(+), 21 deletions(-) create mode 100644 apps/web/js/butterflyGeometry.js create mode 100644 apps/web/module-dependencies.v1.json create mode 100644 docs/superpowers/plans/2026-11-12-review-fixes.md create mode 100644 tests/web/butterflyPicking.test.mjs diff --git a/apps/web/app.js b/apps/web/app.js index dcb07b3e..ea3f1633 100644 --- a/apps/web/app.js +++ b/apps/web/app.js @@ -26,7 +26,7 @@ let activeView='observe',retryFocus=false; // "Retry this view" re-imports first. If the browser still holds the earlier failure and // the view's code is reachable again, the page reloads into the saved view. This module // and the page that loads it share a directory, so the page's base resolves the same URLs. -const reloadWhenReachable=(...paths)=>createDocumentRecovery({urls:()=>paths.map(path=>new URL(path,document.baseURI).href)}); +const reloadWhenReachable=(...paths)=>createDocumentRecovery({urls:()=>paths.map(path=>new URL(path,document.baseURI).href),graphUrl:()=>new URL('./module-dependencies.v1.json',document.baseURI).href}); const viewCode=createViewLoader({ loaders:{ research:()=>import('./js/research.js'), diff --git a/apps/web/js/butterflyGeometry.js b/apps/web/js/butterflyGeometry.js new file mode 100644 index 00000000..d54256e2 --- /dev/null +++ b/apps/web/js/butterflyGeometry.js @@ -0,0 +1,5 @@ +// Backing-store coordinates shared by painting and pointer hit testing. +export function butterflyPlot(width,textScale){ + const left=38*textScale,right=14*textScale; + return {left,width:width-left-right}; +} diff --git a/apps/web/js/catalogueLoader.js b/apps/web/js/catalogueLoader.js index 893731fa..d5ae8105 100644 --- a/apps/web/js/catalogueLoader.js +++ b/apps/web/js/catalogueLoader.js @@ -7,13 +7,48 @@ export const CATALOGUE_DEADLINE_MS = 30000; // new document. When every listed module is reachable now, replace the document and // report true. When one is not, report false and leave the page, and any offline state, // exactly as it is: reloading an unreachable page would trade an error for a blank one. -export function createDocumentRecovery({urls,fetchModule=(url,init)=>fetch(url,init),reload=()=>location.reload()}) { +export function createDocumentRecovery({urls,graphUrl=null,fetchModule=(url,init)=>fetch(url,init),reload=()=>location.reload()}) { if(typeof urls!=='function'||typeof fetchModule!=='function'||typeof reload!=='function')throw new TypeError('Document recovery needs urls, fetchModule and reload functions'); - return async()=>{ - for(const url of urls()){ - const response=await fetchModule(url,{cache:'no-store'}); - if(!response||response.ok!==true)return false; + return async({signal=undefined,isCurrent=()=>true}={})=>{ + const current=()=>!signal?.aborted&&isCurrent(); + if(!current())return false; + let targets=urls(); + if(graphUrl){ + const graphLocation=typeof graphUrl==='function'?graphUrl():graphUrl; + const response=await fetchModule(graphLocation,{cache:'no-store',signal}); + if(!current()||!response?.ok)return false; + const graph=await response.json(); + if(!current())return false; + if(graph?.schema_version!=='module-dependencies.v1'||!graph.modules||typeof graph.modules!=='object' + ||Array.isArray(graph.modules)||Object.keys(graph.modules).length>4096)return false; + const root=new URL('./',graphLocation),queue=[...targets],seen=new Set(); + const local=/^(?:js\/)?[A-Za-z0-9_.-]+\.js$/; + for(let i=0;i4096)return false; + for(const dependency of dependencies){ + if(typeof dependency!=='string'||!local.test(dependency))return false; + const next=new URL(dependency,root).href; + if(!seen.has(next))queue.push(next); + } + if(queue.length>16384)return false; + } + targets=[...seen]; + } + for(const url of targets){ + const response=await fetchModule(url,{cache:'no-store',signal}); + if(!current())return false; + if(!response||response.ok!==true){void response?.body?.cancel().catch(()=>{});return false;} + await response.arrayBuffer(); + if(!current())return false; } + if(!current())return false; reload();return true; }; } @@ -36,13 +71,13 @@ export function createCatalogueLoader({load,recover=null,timeoutMs=CATALOGUE_DEA if(!Number.isFinite(start))throw new TypeError('Catalogue clock must be finite'); let resolve,reject; const promise=new Promise((yes,no)=>{resolve=yes;reject=no;}); - const attempt={promise,resolve,reject,timer:null,deadline:start+timeoutMs}; + const attempt={promise,resolve,reject,timer:null,deadline:start+timeoutMs,controller:new AbortController()}; pending=attempt;status='loading';error=null; const timeout=()=>new Error('Catalogue request exceeded its deadline'); const finish=(ok,result)=>{ if(pending!==attempt)return; if(now()>=attempt.deadline){ok=false;result=timeout();} - clearTimer(attempt.timer);pending=null; + clearTimer(attempt.timer);pending=null;attempt.controller.abort(); if(ok){value=result;status='ready';error=null;resolve(value);} else {status='failed';error=result instanceof Error?result:new Error(String(result));reject(error);} }; @@ -64,7 +99,7 @@ export function createCatalogueLoader({load,recover=null,timeoutMs=CATALOGUE_DEA loadRejected=true; if(explicitRetry&&recover&&rejectedBefore&&pending===attempt){ let reloading=false; - try{reloading=await recover()===true;}catch(_){ /* the import failure below is the report */ } + try{reloading=await recover({signal:attempt.controller.signal,isCurrent:()=>pending===attempt&&now()createDocumentRecovery({urls:()=>[new URL(path,import.meta.url).href]}); +const reloadWhenReachable=path=>createDocumentRecovery({urls:()=>[new URL(path,import.meta.url).href],graphUrl:()=>new URL("../module-dependencies.v1.json",import.meta.url).href}); const moonLoader=createCatalogueLoader({recover:reloadWhenReachable("./moonelements.js"),load:async()=>{ const module=await import("./moonelements.js"); if(!moonSet.MOONS.every(m=>Array.isArray(module.MOON_ELEMENTS?.[m.n]?.el)&&module.MOON_ELEMENTS[m.n].el.length>0))throw new Error('Moon orbital catalogue is incomplete'); diff --git a/apps/web/js/render.js b/apps/web/js/render.js index b90d1686..54293341 100644 --- a/apps/web/js/render.js +++ b/apps/web/js/render.js @@ -1,3 +1,4 @@ +import {butterflyPlot} from './butterflyGeometry.js'; // All canvas rendering: the solar disk, its overlays, and the butterfly diagram. import { store } from "./store.js"; @@ -339,8 +340,9 @@ export function drawButterfly() { // A real butterfly diagram: sunspot latitude (y) against cycle time (x). function drawButterflySeries(ctx, width, height, textScale) { - const padLeft = 38 * textScale; - const padRight = 14 * textScale; + const plot = butterflyPlot(width,textScale); + const padLeft = plot.left; + const padRight = width-plot.left-plot.width; const top = 14 * textScale; const bottom = height - 24 * textScale; const plotH = bottom - top; diff --git a/apps/web/js/research.js b/apps/web/js/research.js index 9899aefa..cba7c7d4 100644 --- a/apps/web/js/research.js +++ b/apps/web/js/research.js @@ -1,3 +1,4 @@ +import {butterflyPlot} from './butterflyGeometry.js'; // Research bindings load only after deliberate Research intent. import { store } from "./store.js"; import { TOUR_STEPS } from "./config.js"; @@ -66,8 +67,9 @@ document.getElementById("butterflyCanvas")?.addEventListener("click", (event) => const rect = canvas.getBoundingClientRect(); const x = (event.clientX - rect.left) * (canvas.width / rect.width); if (store.seriesFrames.length) { - const usable = canvas.width - 38 - 14; - const frac = clamp((x - 38) / usable, 0, 1); + const textScale = Math.max(canvas.width/rect.width,canvas.height/rect.height); + const plot = butterflyPlot(canvas.width,textScale); + const frac = clamp((x - plot.left) / plot.width, 0, 1); stopPlay(); const index = nearestSeriesFrame(store.seriesRecords, frac); if (index !== null) setTimelineFrame(index); diff --git a/apps/web/module-dependencies.v1.json b/apps/web/module-dependencies.v1.json new file mode 100644 index 00000000..2f6284a6 --- /dev/null +++ b/apps/web/module-dependencies.v1.json @@ -0,0 +1,531 @@ +{ + "schema_version": "module-dependencies.v1", + "modules": { + "app.js": [ + "js/catalogueLoader.js", + "js/explorer.js", + "js/observationMedia.js", + "js/offlineBoot.js", + "js/releaseClient.js", + "js/store.js", + "js/surfaceNavigation.js", + "js/tooltip.js", + "js/view.js", + "js/viewEvidence.js", + "js/viewLoader.js", + "js/viewRegistry.js", + "js/workspace.js" + ], + "engine.js": [ + "js/engineLimits.js", + "js/solarContract.js", + "js/wasmBroker.js", + "js/workerClient.js" + ], + "js/accuracy.js": [ + "js/independentEvidenceBinding.js" + ], + "js/atmosphereColumnField.js": [ + "js/atmosphereColumnManifest.js", + "js/atmosphereIncident.js", + "js/atmosphereOptics.js", + "js/atmosphereShaders.js" + ], + "js/atmosphereColumnManifest.js": [], + "js/atmosphereIncident.js": [ + "js/atmosphereColumnField.js", + "js/atmosphereIncidentManifest.js", + "js/atmosphereOptics.js" + ], + "js/atmosphereIncidentManifest.js": [], + "js/atmosphereOptics.js": [], + "js/atmosphereScattering.js": [ + "js/atmosphereColumnField.js", + "js/atmosphereOptics.js" + ], + "js/atmosphereShaders.js": [], + "js/aurora.js": [], + "js/bodyData.js": [ + "js/sunFacts.js" + ], + "js/butterflyGeometry.js": [], + "js/catalogueDemand.js": [], + "js/catalogueLoader.js": [], + "js/celestial.js": [ + "js/bodyData.js", + "js/constellations.js", + "js/starphysics.js" + ], + "js/config.js": [], + "js/constellations.js": [], + "js/data.js": [ + "js/config.js", + "js/dataBundle.js", + "js/store.js", + "js/timeline.js", + "js/tour.js", + "js/view.js", + "js/visualAssets.js" + ], + "js/dataBundle.js": [ + "js/seriesModel.js", + "js/solarContract.js", + "js/sourceAttribution.js" + ], + "js/destinationCards.js": [ + "js/bodyData.js", + "js/moonorbits.js", + "js/moons.js", + "js/planetAppearance.js", + "js/sunLook.js", + "js/sunPhotometry.js", + "js/systemDisplayPolicy.js", + "js/visualAssets.js" + ], + "js/destinationOverview.js": [ + "js/bodyData.js", + "js/destinationCards.js", + "js/moons.js", + "js/orreryTime.js", + "js/planetAppearance.js", + "js/systemDisplayPolicy.js" + ], + "js/displayGeometry.js": [], + "js/dom.js": [ + "js/domWrites.js" + ], + "js/domWrites.js": [], + "js/earthLook.js": [ + "js/earthOceanMask.js", + "js/orreryTime.js" + ], + "js/earthLookClouds.js": [], + "js/earthLookShaders.js": [ + "js/earthLookClouds.js", + "js/materialColor.js" + ], + "js/earthOceanMask.js": [], + "js/engineLimits.js": [ + "js/workerClient.js" + ], + "js/ephemerisContract.js": [ + "js/ephemerisSchema.js", + "js/solarContract.js" + ], + "js/ephemerisSchema.js": [], + "js/explorer.js": [ + "js/domWrites.js", + "js/observationMedia.js", + "js/solarObservation.js", + "js/sunFacts.js" + ], + "js/format.js": [], + "js/frameScheduler.js": [], + "js/galacticobjects.js": [], + "js/geography.js": [], + "js/hdrPresentation.js": [ + "js/hdrPresentationShaders.js" + ], + "js/hdrPresentationShaders.js": [], + "js/illustrativeAppearance.js": [ + "js/illustrativeAssetManifest.js", + "js/orreryMath.js" + ], + "js/illustrativeAssetManifest.js": [], + "js/illustrativeHaze.js": [], + "js/independentEvidenceBinding.js": [], + "js/labelLayout.js": [], + "js/labelOcclusion.js": [], + "js/labelPresenter.js": [ + "js/domWrites.js", + "js/labelLayout.js", + "js/labelOcclusion.js" + ], + "js/materialColor.js": [], + "js/moonAppearance.js": [], + "js/moonelements.js": [], + "js/moonorbits.js": [ + "js/smallbodies.js" + ], + "js/moons.js": [], + "js/moonshadows.js": [], + "js/objectBrowser.js": [], + "js/observationBoot.js": [ + "js/observationMedia.js" + ], + "js/observationMedia.js": [], + "js/offlineBoot.js": [], + "js/orbitCamera.js": [], + "js/orbitLines.js": [], + "js/orrery.js": [ + "js/accuracy.js", + "js/atmosphereColumnField.js", + "js/atmosphereColumnManifest.js", + "js/atmosphereIncident.js", + "js/atmosphereOptics.js", + "js/atmosphereScattering.js", + "js/atmosphereShaders.js", + "js/bodyData.js", + "js/catalogueDemand.js", + "js/catalogueLoader.js", + "js/celestial.js", + "js/displayGeometry.js", + "js/domWrites.js", + "js/earthLook.js", + "js/earthLookShaders.js", + "js/frameScheduler.js", + "js/hdrPresentation.js", + "js/illustrativeAppearance.js", + "js/illustrativeHaze.js", + "js/labelOcclusion.js", + "js/labelPresenter.js", + "js/materialColor.js", + "js/moonAppearance.js", + "js/moonorbits.js", + "js/moons.js", + "js/moonshadows.js", + "js/objectBrowser.js", + "js/orbitCamera.js", + "js/orbitLines.js", + "js/orreryDetail.js", + "js/orreryGalaxy.js", + "js/orreryMath.js", + "js/orreryShaders.js", + "js/orreryTime.js", + "js/physicalPresenter.js", + "js/physicalProgramSources.js", + "js/physicalRendering.js", + "js/planetAppearance.js", + "js/presentationState.js", + "js/profiledScatteringTargets.js", + "js/referenceDemand.js", + "js/referenceImageLoader.js", + "js/renderQuality.js", + "js/scatteringTargets.js", + "js/shaderPrograms.js", + "js/skyEngine.js", + "js/smallbodies.js", + "js/solarAppearance.js", + "js/solarAssetLoader.js", + "js/solarVolumeShaders.js", + "js/sphereMeshPolicy.js", + "js/sphereMeshPool.js", + "js/starDetail.js", + "js/store.js", + "js/sunLook.js", + "js/sunLookRenderer.js", + "js/surfaceMapping.js", + "js/surfacemap.js", + "js/systemContract.js", + "js/systemDisplayPolicy.js", + "js/systemWorkerClient.js", + "js/terrainAssets.js", + "js/terrainResources.js", + "js/terrainWorkerClient.js", + "js/textureDisplayBudget.js", + "js/visualAssets.js" + ], + "js/orreryDetail.js": [ + "js/bodyData.js", + "js/domWrites.js", + "js/earthLook.js", + "js/illustrativeAppearance.js", + "js/moonAppearance.js", + "js/moonorbits.js", + "js/planetAppearance.js", + "js/sunPhotometry.js", + "js/visualAssets.js" + ], + "js/orreryGalaxy.js": [ + "js/galacticobjects.js", + "js/starphysics.js" + ], + "js/orreryMath.js": [ + "js/bodyData.js" + ], + "js/orreryShaders.js": [ + "js/atmosphereColumnField.js", + "js/atmosphereIncident.js", + "js/atmosphereScattering.js", + "js/illustrativeAppearance.js", + "js/materialColor.js", + "js/ringTransportShaders.js", + "js/terrainShadowShaders.js" + ], + "js/orreryTime.js": [], + "js/panels.js": [ + "js/aurora.js", + "js/config.js", + "js/dom.js", + "js/format.js", + "js/objectBrowser.js", + "js/presentationState.js", + "js/selectors.js", + "js/store.js", + "js/surfaceNavigation.js" + ], + "js/physicalPresenter.js": [ + "js/atmosphereOptics.js", + "js/domWrites.js", + "js/earthLook.js", + "js/illustrativeAppearance.js", + "js/planetPhenomena.js", + "js/solarAppearance.js", + "js/sunLook.js", + "js/terrainAssets.js" + ], + "js/physicalProgramSources.js": [ + "js/atmosphereOptics.js", + "js/atmosphereScattering.js", + "js/atmosphereShaders.js", + "js/orreryShaders.js" + ], + "js/physicalRendering.js": [], + "js/planetAppearance.js": [ + "js/earthLook.js", + "js/illustrativeAppearance.js", + "js/visualAssetManifest.js" + ], + "js/planetPhenomena.js": [ + "js/planetPhenomenaManifest.js" + ], + "js/planetPhenomenaManifest.js": [], + "js/presentationState.js": [ + "js/solarProjection.js" + ], + "js/profiledScatteringTargets.js": [], + "js/referenceDemand.js": [ + "js/planetAppearance.js" + ], + "js/referenceImageLoader.js": [], + "js/releaseClient.js": [], + "js/releaseContext.js": [], + "js/render.js": [ + "js/butterflyGeometry.js", + "js/data.js", + "js/dom.js", + "js/format.js", + "js/selectors.js", + "js/seriesModel.js", + "js/solarProjection.js", + "js/store.js", + "js/wavelength.js" + ], + "js/renderQuality.js": [], + "js/research.js": [ + "js/butterflyGeometry.js", + "js/config.js", + "js/data.js", + "js/dom.js", + "js/format.js", + "js/researchView.js", + "js/seriesModel.js", + "js/store.js", + "js/sunlayers.js", + "js/surfaceNavigation.js", + "js/timeline.js", + "js/tour.js", + "js/view.js", + "js/wavelength.js", + "js/workspace.js" + ], + "js/researchView.js": [ + "js/data.js", + "js/panels.js", + "js/presentationState.js", + "js/render.js", + "js/store.js", + "js/viewRegistry.js" + ], + "js/ringTransportShaders.js": [], + "js/scatteringTargets.js": [ + "js/atmosphereOptics.js" + ], + "js/selectors.js": [ + "js/config.js", + "js/dom.js", + "js/format.js", + "js/presentationState.js", + "js/solarRegionFacts.js", + "js/store.js" + ], + "js/seriesModel.js": [], + "js/shaderPrograms.js": [], + "js/sky.js": [ + "js/accuracy.js", + "js/celestial.js", + "js/ephemerisContract.js", + "js/labelLayout.js", + "js/objectBrowser.js", + "js/presentationState.js", + "js/releaseContext.js", + "js/skyEngine.js", + "js/skyFrame.js", + "js/skyLimits.js", + "js/skyPresentation.js", + "js/skyPrivacy.js", + "js/skyWorkerClient.js", + "js/store.js" + ], + "js/skyEngine.js": [ + "js/ephemerisContract.js", + "js/skyLimits.js", + "js/skyPrivacy.js", + "js/wasmBroker.js", + "js/workerClient.js" + ], + "js/skyFrame.js": [], + "js/skyLimits.js": [ + "js/workerClient.js" + ], + "js/skyPresentation.js": [ + "js/skyLimits.js" + ], + "js/skyPrivacy.js": [ + "js/skyLimits.js" + ], + "js/skyWorker.js": [ + "js/skyEngine.js", + "js/skyLimits.js" + ], + "js/skyWorkerClient.js": [ + "js/ephemerisContract.js", + "js/skyLimits.js", + "js/wasmBroker.js", + "js/workerClient.js" + ], + "js/smallbodies.js": [], + "js/solarAppearance.js": [ + "js/solarAppearanceManifest.js" + ], + "js/solarAppearanceManifest.js": [], + "js/solarAssetLoader.js": [ + "js/solarAppearance.js" + ], + "js/solarContract.js": [ + "js/solarSchema.js", + "js/sourceAttribution.js" + ], + "js/solarObservation.js": [ + "js/sourceRecords.js" + ], + "js/solarProjection.js": [], + "js/solarRegionFacts.js": [], + "js/solarSchema.js": [], + "js/solarVolumeShaders.js": [ + "js/materialColor.js" + ], + "js/solarWorker.js": [ + "engine.js", + "js/engineLimits.js", + "js/solarContract.js" + ], + "js/solarWorkerClient.js": [ + "js/engineLimits.js", + "js/solarContract.js", + "js/wasmBroker.js", + "js/workerClient.js" + ], + "js/sourceAttribution.js": [], + "js/sourceRecords.js": [], + "js/sphereMeshPolicy.js": [], + "js/sphereMeshPool.js": [ + "js/sphereMeshPolicy.js" + ], + "js/starDetail.js": [ + "js/starphysics.js" + ], + "js/starcatalog.js": [], + "js/starphysics.js": [], + "js/store.js": [ + "js/config.js" + ], + "js/sunFacts.js": [], + "js/sunLook.js": [], + "js/sunLookRecipe.js": [], + "js/sunLookRenderer.js": [ + "js/shaderPrograms.js", + "js/sunLook.js", + "js/sunLookShaders.js" + ], + "js/sunLookShaders.js": [ + "js/materialColor.js", + "js/sunLookRecipe.js" + ], + "js/sunPhotometry.js": [], + "js/sunlayers.js": [], + "js/surfaceMapping.js": [], + "js/surfaceNavigation.js": [ + "js/store.js" + ], + "js/surfacemap.js": [], + "js/systemContract.js": [], + "js/systemDisplayPolicy.js": [], + "js/systemWorker.js": [ + "js/skyEngine.js", + "js/systemContract.js" + ], + "js/systemWorkerClient.js": [ + "js/systemContract.js", + "js/wasmBroker.js", + "js/workerClient.js" + ], + "js/terrain.worker.js": [ + "js/terrainAssets.js", + "js/terrainGeometry.js" + ], + "js/terrainAssets.js": [], + "js/terrainGeometry.js": [], + "js/terrainResources.js": [], + "js/terrainShadowShaders.js": [], + "js/terrainWorkerClient.js": [ + "js/terrainAssets.js" + ], + "js/textureDisplayBudget.js": [], + "js/timeline.js": [ + "js/seriesModel.js", + "js/solarContract.js", + "js/solarWorkerClient.js", + "js/store.js", + "js/view.js" + ], + "js/tooltip.js": [ + "js/config.js", + "js/store.js" + ], + "js/tour.js": [ + "js/config.js", + "js/dom.js", + "js/panels.js", + "js/store.js", + "js/view.js" + ], + "js/view.js": [ + "js/domWrites.js", + "js/explorer.js", + "js/store.js", + "js/viewRegistry.js", + "js/workspace.js" + ], + "js/viewEvidence.js": [], + "js/viewLoader.js": [ + "js/catalogueLoader.js" + ], + "js/viewRegistry.js": [], + "js/visualAssetManifest.js": [], + "js/visualAssets.js": [ + "js/visualAssetManifest.js" + ], + "js/wasmBroker.js": [], + "js/wavelength.js": [ + "js/config.js", + "js/data.js", + "js/store.js", + "js/view.js" + ], + "js/workerClient.js": [], + "js/workspace.js": [ + "js/domWrites.js" + ] + } +} diff --git a/apps/web/startup-modules.v1.json b/apps/web/startup-modules.v1.json index 09f7191a..bb312a33 100644 --- a/apps/web/startup-modules.v1.json +++ b/apps/web/startup-modules.v1.json @@ -8,12 +8,12 @@ { "url": "app.js", "path": "app.js", - "sha256": "f9133130cdedcc05494a11bc6c552b46a02d5dce2b51a49de1fcb5185ac42cb6" + "sha256": "1df02b4f05740e1b8c06c66c77e1cb5f7603b0d302dd700674d1dd57a55bda55" }, { "url": "js/catalogueLoader.js", "path": "js/catalogueLoader.js", - "sha256": "83df0ec4c7415d4820dd3f6d11454204701c00947c0c2314d5986a0164324df3" + "sha256": "62677775907b57b61e45e34a4a252dc5664712b69e3987bdecb9bce7f789b55b" }, { "url": "js/config.js", diff --git a/docs/superpowers/plans/2026-11-12-review-fixes.md b/docs/superpowers/plans/2026-11-12-review-fixes.md new file mode 100644 index 00000000..b013b03b --- /dev/null +++ b/docs/superpowers/plans/2026-11-12-review-fixes.md @@ -0,0 +1,39 @@ +# PR 137/138 review fixes implementation plan + +> **For agentic workers:** Use superpowers:executing-plans to implement task by task. + +**Goal:** Resolve the three reproduced P2 findings before release. +**Architecture:** Share butterfly plot geometry; keep recovery under loader cancellation/deadline ownership; generate static module dependencies for source and bundled releases and probe the requested closure before reload. +**Tech Stack:** Existing JavaScript, TypeScript parser, Node tests, Chromium. +**Spec:** The three review findings and user's instruction to resolve them and review again. + +## Global constraints + +Keep canonical module identities, no dependency additions, no merge or deployment. +Changes target the six-fix head of PR 138 so they also cover PR 137 when integrated. + +## Review focus + +- DPR 1/2 and backing-store width caps: click the plotted frame. +- Navigation, hidden page, timeout before timer delivery: stale recovery never reloads. +- Broken body transfer: headers alone do not prove reachability. +- Cyclic/reexported dependencies: probe once, exclude deferred catalogues. +- Missing or invalid inventory: retain current document, do not guess. + +## Tasks + +- [x] Chart: add renderer/click integration regression, observe failure, share plot geometry, verify. +- [x] Recovery ownership: add cancellation and deadline regressions, observe failure, pass AbortSignal and current-attempt predicate to recovery, verify. +- [x] Dependencies: add transitive-failure and graph-generation regressions, observe failure, emit source/bundle inventory and probe full static closure/body, verify. +- [x] Run full JS suite, relevant Python build tests, typecheck, graph/docs checks and Chromium recovery regression. +- [x] Fresh whole-change review; resolve important findings with regression tests; record limitations and deliver branch. + +## Verification record + +- Regression failures observed before implementation: DPR 2 click selected frame 2 instead of 0; recovery reloaded after cancellation and both timeout paths; missing shared chunk and failed response body still reloaded. +- Final JavaScript suite: 2,297 passed, zero failed. +- Python: 48 release-artifact, 6 web-bundling, 13 startup-contract tests passed. +- Typecheck: 152 files; source graphs, SDLC, docs, UX and static checks passed. +- Chromium compiled-bundle check: shared chunk HTTP 503 retains document; restoring chunk permits view import; fresh document import succeeds. +- Fresh independent review: no actionable findings; additional all-frame click checks covered DPR, capped widths, and fractional sizes. +- Limits: no physical-device/native-GPU checks, no local Rust toolchain, no full WASM release rebuild. The patch changes JavaScript and its bundle tooling only. diff --git a/tests/web/butterflyPicking.test.mjs b/tests/web/butterflyPicking.test.mjs new file mode 100644 index 00000000..e8d857f0 --- /dev/null +++ b/tests/web/butterflyPicking.test.mjs @@ -0,0 +1,19 @@ +import vm from 'node:vm'; +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {loadSourceModules} from './helpers/sourceModuleHarness.mjs'; +import {nearestSeriesFrame,seriesPosition} from '../../apps/web/js/seriesModel.js'; +async function check(dpr,cssWidth,index){ +const store={seriesFrames:Array.from({length:25},()=>({active_regions:[]})),seriesRecords:Array.from({length:25},(_,i)=>({months:i,index:i})),timelineIndex:index}; +let click,selected;const lines=[]; +const ctx=new Proxy({moveTo:(x,y)=>lines.push([x,y])},{get:(t,k)=>t[k]??(()=>{})}); +const canvas={width:0,height:0,getBoundingClientRect:()=>({left:0,top:0,width:cssWidth,height:150}),getContext:()=>ctx,addEventListener:(name,fn)=>{if(name==='click')click=fn}}; +const bindings={store,TOUR_STEPS:[],controls:{},text(){},clamp:(x,l,h)=>Math.max(l,Math.min(h,x)),hash01(){},selectedRegion(){},currentBaseImage(){},projectSolarPoint(){},regionAnchor(){},confidenceEncoding(){},seriesPosition,updateWavelengthCaption(){},renderAll(){},updateModeButtons(){},loadState(){},setWavelength(){},setTimelineFrame:i=>{selected=i},goLive(){},togglePlay(){},runLiveEngine(){},stopPlay(){},cancelLiveEngine(){},stepTimeline(){},startTour(){},endTour(){},showTourStep(){},buildWavelengthBar(){},buildSunCutaway(){},nearestSeriesFrame,openInspector(){}}; + + const context=vm.createContext({document:{getElementById:id=>id==='butterflyCanvas'?canvas:null,addEventListener(){}},window:{devicePixelRatio:dpr,addEventListener(){}}}); + const [render]=await loadSourceModules(context,[new URL('../../apps/web/js/render.js',import.meta.url),new URL('../../apps/web/js/research.js',import.meta.url)],{resolveImport:(_,url)=>url.pathname.endsWith('/butterflyGeometry.js')?undefined:bindings}); + lines.length=0;render.drawButterfly();const plottedX=lines[3][0]; + click({currentTarget:canvas,clientX:plottedX/(canvas.width/cssWidth),clientY:30}); + assert.equal(selected,index,'Clicking the plotted frame must select it'); +} +for(const [dpr,width] of [[1,320],[2,320],[2,1000]])for(const index of [0,12,24])test(`butterfly click selects frame ${index} at DPR ${dpr}, width ${width}`,()=>check(dpr,width,index)); diff --git a/tests/web/catalogueLoader.test.mjs b/tests/web/catalogueLoader.test.mjs index ab70110a..92853246 100644 --- a/tests/web/catalogueLoader.test.mjs +++ b/tests/web/catalogueLoader.test.mjs @@ -116,7 +116,7 @@ test('a rejection that arrives after cancellation still counts toward the next e test('document recovery probes every module without the HTTP cache and reloads only when all respond',async()=>{ const seen=[];let reloads=0; const recovery=responses=>createDocumentRecovery({urls:()=>['https://example.test/sol/js/a.js','https://example.test/sol/js/b.js'], - fetchModule:async(url,init)=>{seen.push([url,init.cache]);const next=responses.shift();if(next instanceof Error)throw next;return next;},reload:()=>{reloads++;}}); + fetchModule:async(url,init)=>{seen.push([url,init.cache]);const next=responses.shift();if(next instanceof Error)throw next;return next?.ok===true?new Response('export {};'):next;},reload:()=>{reloads++;}}); assert.equal(await recovery([{ok:true},{ok:true}])(),true);assert.equal(reloads,1); assert.deepEqual(seen,[['https://example.test/sol/js/a.js','no-store'],['https://example.test/sol/js/b.js','no-store']]); // HTTP 409 is what the service worker answers offline; 404 is a release that has been replaced. @@ -126,3 +126,54 @@ test('document recovery probes every module without the HTTP cache and reloads o await assert.rejects(recovery([new TypeError('Failed to fetch')])(),/Failed to fetch/);assert.equal(reloads,1); assert.throws(()=>createDocumentRecovery({urls:['a.js']}),TypeError); }); + +for(const end of ['cancel','deadline','delayed-timer'])test(`recovery cannot reload after ${end}`,async()=>{ + const time=clock(),probe=deferred();let reloads=0,signal; + const recover=createDocumentRecovery({urls:()=>['https://example.test/a.js'], + fetchModule:(_url,init)=>{signal=init.signal;return probe.promise;},reload:()=>{reloads++;}}); + const loader=createCatalogueLoader({load:()=>Promise.reject(Error('cached failure')),recover,...time}); + await assert.rejects(loader.request(),/cached/); + const retry=loader.request({recover:true}),failed=assert.rejects(retry,end==='cancel'?/cancelled/:/deadline/); + await flush(); + if(end==='cancel')loader.cancel();else time.advance(30000,end!=='delayed-timer'); + probe.resolve(new Response('export {};'));await flush();time.advance(0);await failed; + assert.equal(reloads,0);assert.equal(signal?.aborted,true); +}); + +test('recovery checks the static dependency closure and leaves the document while a shared chunk is unavailable',async()=>{ + const graphUrl='https://example.test/sol/module-dependencies.v1.json',seen=[];let reloads=0,available=false; + const graph={schema_version:'module-dependencies.v1',modules:{'js/view.js':['js/shared.js'],'js/shared.js':['js/view.js'],'js/optional.js':[]}}; + const recover=createDocumentRecovery({urls:()=>['https://example.test/sol/js/view.js'],graphUrl, + fetchModule:async url=>{seen.push(url);return url===graphUrl?Response.json(graph):new Response('export {};',{status:url.endsWith('/shared.js')&&!available?503:200});}, + reload:()=>{reloads++;}}); + assert.equal(await recover(),false);assert.equal(reloads,0); + assert.ok(seen.includes('https://example.test/sol/js/shared.js')); + assert.ok(!seen.some(url=>url.endsWith('/optional.js'))); + available=true;seen.length=0;assert.equal(await recover(),true);assert.equal(reloads,1); + assert.equal(seen.filter(url=>url.endsWith('/view.js')).length,1,'cycles are visited once'); +}); + +test('recovery waits for complete response bytes before reloading',async()=>{ + let reloads=0; + const recover=createDocumentRecovery({urls:()=>['https://example.test/a.js'], + fetchModule:async()=>new Response(new ReadableStream({start(controller){controller.error(Error('body disconnected'));}})),reload:()=>{reloads++;}}); + await assert.rejects(recover(),/disconnected/);assert.equal(reloads,0); +}); + +for(const graph of [null,{}, {schema_version:'module-dependencies.v1',modules:[]}, + {schema_version:'module-dependencies.v1',modules:{}}, + {schema_version:'module-dependencies.v1',modules:{'js/a.js':'bad'}}, + {schema_version:'module-dependencies.v1',modules:{'js/a.js':['../foreign.js']}}, + {schema_version:'module-dependencies.v1',modules:{'js/a.js':['js/missing.js']}}, +])test(`invalid or incomplete recovery inventory retains the document: ${JSON.stringify(graph)}`,async()=>{ + let reloads=0; + const recover=createDocumentRecovery({urls:()=>['https://sol.test/js/a.js'],graphUrl:'https://sol.test/module-dependencies.v1.json', + fetchModule:async()=>Response.json(graph),reload:()=>{reloads++;}}); + assert.equal(await recover(),false);assert.equal(reloads,0); +}); + +test('unavailable dependency inventory retains the document',async()=>{ + const recover=createDocumentRecovery({urls:()=>['https://sol.test/js/a.js'],graphUrl:'https://sol.test/module-dependencies.v1.json', + fetchModule:async()=>new Response('',{status:503}),reload:()=>assert.fail('must not reload')}); + assert.equal(await recover(),false); +}); diff --git a/tests/web/moduleGraph.test.mjs b/tests/web/moduleGraph.test.mjs index 86139f45..8a0a442e 100644 --- a/tests/web/moduleGraph.test.mjs +++ b/tests/web/moduleGraph.test.mjs @@ -54,3 +54,9 @@ test('complete graph refuses worker construction whose module URL cannot be admi const root=fixture(t,{'app.js':"const workerURL='./worker.js';new Worker(workerURL,{type:'module'});",'worker.js':'export {};'}); assert.throws(()=>analyzeModules(root,['app.js'],{includeDeferred:true}),/literal.*worker/i); }); + +test('recovery inventory follows static reexports and records deferred roots without making them eager',async t=>{ + const {moduleDependencies}=await import('../../tools/module_graph.mjs'); + const root=fixture(t,{'app.js':"import('./view.js');",'view.js':"export * from './shared.js';",'shared.js':"import './view.js';export const x=1;"}); + assert.deepEqual(moduleDependencies(root,['app.js']),{schema_version:'module-dependencies.v1',modules:{'app.js':[],'shared.js':['view.js'],'view.js':['shared.js']}}); +}); diff --git a/tests/web/researchLifecycle.test.mjs b/tests/web/researchLifecycle.test.mjs index 31ed8294..b7afdff5 100644 --- a/tests/web/researchLifecycle.test.mjs +++ b/tests/web/researchLifecycle.test.mjs @@ -13,6 +13,7 @@ test('first Research entry selects model; destination reentry preserves the chos const [research]=await loadSourceModules(context,[new URL('../../apps/web/js/research.js',import.meta.url)],{ resolveImport:(_,url)=>{ if(url.pathname.endsWith('/researchView.js'))return {}; + if(url.pathname.endsWith('/butterflyGeometry.js'))return undefined; return bindings; }, }); diff --git a/tests/web/webBundle.test.mjs b/tests/web/webBundle.test.mjs index 532e390b..bb73f4a8 100644 --- a/tests/web/webBundle.test.mjs +++ b/tests/web/webBundle.test.mjs @@ -131,3 +131,14 @@ test('a QA facade loads only its owning chunk closure, not the rest of the diagn assert.equal(other.page(),page.node);assert.equal(globalThis.__pageSideEffects,1,'the page module still runs exactly once'); delete globalThis.__pageSideEffects; }); + +test('bundled recovery graph names emitted shared dependencies, not inlined originals',async t=>{ + const {bundleWeb}=await import('../../tools/bundle_web.mjs');const f=fixture(t); + await bundleWeb({sourceRoot:f.source,stageRoot:f.stage,roots:['app.js'],qaEntries:['js/view.js']}); + const graph=JSON.parse(fs.readFileSync(path.join(f.stage,'module-dependencies.v1.json'),'utf8')); + const queue=['js/view.js'],seen=new Set(); + while(queue.length){const name=queue.pop();if(seen.has(name))continue;seen.add(name);queue.push(...graph.modules[name]);} + assert.ok([...seen].some(name=>name.startsWith('js/shared-'))); + assert.ok(!seen.has('js/private.js'));assert.ok(!seen.has('js/moonelements.js')); + assert.ok([...seen].every(name=>fs.existsSync(path.join(f.stage,name)))); +}); diff --git a/tools/bundle_web.mjs b/tools/bundle_web.mjs index e7222bf0..4f16fc61 100644 --- a/tools/bundle_web.mjs +++ b/tools/bundle_web.mjs @@ -6,7 +6,7 @@ import {fileURLToPath} from 'node:url'; import {createHash} from 'node:crypto'; import * as esbuild from 'esbuild'; import ts from 'typescript'; -import {analyzeModules,moduleEdges,resolveModule,compilerGeneratedModuleKind} from './module_graph.mjs'; +import {analyzeModules,moduleEdges,resolveModule,compilerGeneratedModuleKind,moduleDependencies} from './module_graph.mjs'; const ROOT=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..'); export const BUILD_DESCRIPTOR='web-build.v1.json'; @@ -175,7 +175,8 @@ export async function bundleWeb({sourceRoot,stageRoot,roots,qaEntries=QA_ENTRIES for(const name of Object.keys(result.metafile.inputs).filter(name=>name!=='sol-diagnostic:exports'))fs.rmSync(path.join(stageRoot,name),{force:true}); for(const [name,bytes]of outputBytes){const file=path.join(stageRoot,name);fs.mkdirSync(path.dirname(file),{recursive:true});fs.writeFileSync(file,bytes);} for(const [name,text]of raw)if(fs.readFileSync(path.join(sourceRoot,name),'utf8')!==text)throw new Error('Compiler source changed during build'); - analyzeModules(stageRoot,sorted(new Set([...roots,...entries,...retained])),{includeDeferred:true}); + const recovery=moduleDependencies(stageRoot,sorted(new Set([...roots,...entries,...retained]))); + fs.writeFileSync(path.join(stageRoot,'module-dependencies.v1.json'),JSON.stringify(recovery,null,2)+'\n'); const stagedStartup=analyzeModules(stageRoot,roots); if(JSON.stringify(stagedStartup.modules.map(m=>m.path))!==JSON.stringify(startup.modules.map(m=>m.path)))throw new Error('Bundling changed initial static closure'); const descriptor={schema_version:'web-build.v1',compiler:{name:'esbuild',version:ESBUILD_VERSION, diff --git a/tools/module_graph.mjs b/tools/module_graph.mjs index a11e51ce..d7d463ad 100644 --- a/tools/module_graph.mjs +++ b/tools/module_graph.mjs @@ -104,3 +104,15 @@ export function compilerGeneratedModuleKind(text,name) { if(moduleLinkageOnly(text,name))return 'module-linkage'; return text.trim()===EXPORT_HELPER?'esbuild-namespace-exports':null; } + +// Recovery fetches a requested entry's static closure, never its deferred payloads. +// Generate from parsed imports/reexports for both source and compiled modules. +export function moduleDependencies(root,roots){ + const complete=analyzeModules(root,roots,{includeDeferred:true}); + const modules=Object.fromEntries(complete.modules.map(item=>{ + if(item.url!==item.path)throw new Error('Recovery requires query-free canonical module identities'); + const edges=moduleEdges(fs.readFileSync(sourceFile(root,item.path),'utf8'),item.path); + return [item.path,[...new Set(edges.static.map(specifier=>resolveModule(specifier,item.path).path))].sort()]; + })); + return {schema_version:'module-dependencies.v1',modules}; +} diff --git a/tools/validate_module_graph.mjs b/tools/validate_module_graph.mjs index f0cc1ebf..ea9e3515 100644 --- a/tools/validate_module_graph.mjs +++ b/tools/validate_module_graph.mjs @@ -2,7 +2,7 @@ import fs from 'node:fs'; import path from 'node:path'; import {fileURLToPath} from 'node:url'; import {isDeepStrictEqual} from 'node:util'; -import {analyzeModules} from './module_graph.mjs'; +import {analyzeModules,moduleDependencies} from './module_graph.mjs'; const args=process.argv.slice(2),rootFlag=args.indexOf('--root'),rootsFlag=args.indexOf('--roots'); const root=path.resolve(rootFlag>=0?args[rootFlag+1]:path.join(path.dirname(fileURLToPath(import.meta.url)),'../apps/web')); const file=path.join(root,'startup-modules.v1.json'); @@ -13,3 +13,8 @@ const complete=analyzeModules(root,roots,{includeDeferred:true}); if(args.includes('--write'))fs.writeFileSync(file,JSON.stringify(expected,null,2)+'\n'); else if(!isDeepStrictEqual(expected,current))throw new Error('Startup module graph drift; regenerate reviewed graph and hints'); console.log(`Startup graph ${args.includes('--write')?'written':'valid'}: ${expected.modules.length} startup module URL identities; ${complete.modules.length} complete graph identities`); + +const recoveryFile=path.join(root,'module-dependencies.v1.json'); +const recovery=moduleDependencies(root,roots); +if(args.includes('--write'))fs.writeFileSync(recoveryFile,JSON.stringify(recovery,null,2)+'\n'); +else if(!fs.existsSync(recoveryFile)||!isDeepStrictEqual(recovery,JSON.parse(fs.readFileSync(recoveryFile,'utf8'))))throw new Error('Recovery dependency graph drift; regenerate module graphs'); From 87cfd6d90d6effe0b8f3713721b2635fc7323fc0 Mon Sep 17 00:00:00 2001 From: Min Kang Date: Thu, 12 Nov 2026 06:22:55 +0000 Subject: [PATCH 8/8] Pin visual comparisons to full display resolution --- docs/superpowers/plans/2026-11-12-review-fixes.md | 1 + tools/browser_validation.mjs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/superpowers/plans/2026-11-12-review-fixes.md b/docs/superpowers/plans/2026-11-12-review-fixes.md index b013b03b..925e379d 100644 --- a/docs/superpowers/plans/2026-11-12-review-fixes.md +++ b/docs/superpowers/plans/2026-11-12-review-fixes.md @@ -36,4 +36,5 @@ Changes target the six-fix head of PR 138 so they also cover PR 137 when integra - Typecheck: 152 files; source graphs, SDLC, docs, UX and static checks passed. - Chromium compiled-bundle check: shared chunk HTTP 503 retains document; restoring chunk permits view import; fresh document import succeeds. - Fresh independent review: no actionable findings; additional all-frame click checks covered DPR, capped widths, and fractional sizes. +- CI follow-up: fixed the visual driver's resolution selection. Auto legitimately reduced backing resolution under coverage overhead, violating the driver's full-resolution screenshot contract. Visual comparisons now select High explicitly; all 33 canvas-capture and render-quality unit/integration tests passed, including Auto adaptation and deterministic manual mode. The parallel CI browser run also passed the original visual gate, confirming the timing-dependent trigger. - Limits: no physical-device/native-GPU checks, no local Rust toolchain, no full WASM release rebuild. The patch changes JavaScript and its bundle tooling only. diff --git a/tools/browser_validation.mjs b/tools/browser_validation.mjs index 94b5ca6b..48d2af34 100644 --- a/tools/browser_validation.mjs +++ b/tools/browser_validation.mjs @@ -1243,6 +1243,10 @@ async function exerciseOrrery(page, visualDirectory, observeContext, sunResoluti // The existing source-image, terrain and moon-shadow baselines qualify the // Source-qualified option; select it explicitly after checking the product default. await page.select('#orreryPlanetLook','source-qualified'); + // Pixel comparisons and canvas alignment require a fixed backing resolution. + // Auto legitimately downshifts under software rendering or coverage overhead; + // its adaptation is exercised separately by the render-quality integration tests. + await page.select('#orreryQuality','high'); await setChecked(page, "#orreryAnimate", false); // Settle the current visible demand; distant and disabled maps remain deferred. const appearance = await waitForReferenceReadiness(page);