Skip to content

Commit 02aaec8

Browse files
committed
Verify deferred browser workflows against exact module and schema identities
1 parent 101d0b6 commit 02aaec8

9 files changed

Lines changed: 229 additions & 47 deletions

‎.github/workflows/coverage.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ jobs:
165165
--source=services/ephemeris-server,tools \
166166
-m unittest discover -s tests/python -p 'test_*.py' -v
167167
coverage report \
168-
--include='services/ephemeris-server/server.py,tools/build_wasm.py,tools/build_web.py,tools/collect_moon_evidence.py,tools/data_bundles.py,tools/delivery_lifecycle.py,tools/ephemeris_distribution.py,tools/fetch_earth_reference.py,tools/fetch_public_data.py,tools/generate_eop.py,tools/generate_fixture_snapshot.py,tools/generate_moons.py,tools/horizons_apparent.py,tools/horizons_events.py,tools/horizons_observer_seasonal.py,tools/horizons_ranges.py,tools/horizons_reference.py,tools/horizons_vectors.py,tools/jsonschema_min.py,tools/moon_model.py,tools/observation_provenance.py,tools/orrery_delivery.py,tools/orrery_earth.py,tools/orrery_refresh.py,tools/precision_window_reference.py,tools/rebuild_coefficients.py,tools/release_changes.py,tools/release_crate.py,tools/release_evidence.py,tools/release_policy.py,tools/run_daily_ingest.py,tools/snapshot_semantics.py,tools/startup_contract.py,tools/validate_accuracy_evidence.py,tools/validate_apparent.py,tools/validate_docs.py,tools/validate_ephemeris.py,tools/validate_ephemeris_snapshot.py,tools/validate_ephemeris_snapshot_v2.py,tools/validate_moons.py,tools/validate_operational_readiness.py,tools/validate_physical_assets.py,tools/validate_planet_phenomena.py,tools/validate_precision_window.py,tools/validate_ranges.py,tools/validate_release_manifest.py,tools/validate_sdlc.py,tools/validate_snapshot.py,tools/validate_ux_contract.py,tools/validate_vectors.py,tools/validate_visual_assets.py,tools/validate_web_static.py,tools/validation_output.py,tools/verify_served_release.py,tools/wasm_provenance.py' \
168+
--include='services/ephemeris-server/server.py,tools/browser_smoke.py,tools/build_wasm.py,tools/build_web.py,tools/collect_moon_evidence.py,tools/data_bundles.py,tools/delivery_lifecycle.py,tools/ephemeris_distribution.py,tools/fetch_earth_reference.py,tools/fetch_public_data.py,tools/generate_eop.py,tools/generate_fixture_snapshot.py,tools/generate_moons.py,tools/horizons_apparent.py,tools/horizons_events.py,tools/horizons_observer_seasonal.py,tools/horizons_ranges.py,tools/horizons_reference.py,tools/horizons_vectors.py,tools/jsonschema_min.py,tools/moon_model.py,tools/observation_provenance.py,tools/orrery_delivery.py,tools/orrery_earth.py,tools/orrery_refresh.py,tools/precision_window_reference.py,tools/rebuild_coefficients.py,tools/release_changes.py,tools/release_crate.py,tools/release_evidence.py,tools/release_policy.py,tools/run_daily_ingest.py,tools/snapshot_semantics.py,tools/startup_contract.py,tools/validate_accuracy_evidence.py,tools/validate_apparent.py,tools/validate_docs.py,tools/validate_ephemeris.py,tools/validate_ephemeris_snapshot.py,tools/validate_ephemeris_snapshot_v2.py,tools/validate_moons.py,tools/validate_operational_readiness.py,tools/validate_physical_assets.py,tools/validate_planet_phenomena.py,tools/validate_precision_window.py,tools/validate_ranges.py,tools/validate_release_manifest.py,tools/validate_sdlc.py,tools/validate_snapshot.py,tools/validate_ux_contract.py,tools/validate_vectors.py,tools/validate_visual_assets.py,tools/validate_web_static.py,tools/validation_output.py,tools/verify_served_release.py,tools/wasm_provenance.py' \
169169
--fail-under=90 --show-missing
170170
mkdir -p coverage
171171
coverage xml -o coverage/python.xml \
172-
--include='services/ephemeris-server/server.py,tools/build_wasm.py,tools/build_web.py,tools/collect_moon_evidence.py,tools/data_bundles.py,tools/delivery_lifecycle.py,tools/ephemeris_distribution.py,tools/fetch_earth_reference.py,tools/fetch_public_data.py,tools/generate_eop.py,tools/generate_fixture_snapshot.py,tools/generate_moons.py,tools/horizons_apparent.py,tools/horizons_events.py,tools/horizons_observer_seasonal.py,tools/horizons_ranges.py,tools/horizons_reference.py,tools/horizons_vectors.py,tools/jsonschema_min.py,tools/moon_model.py,tools/observation_provenance.py,tools/orrery_delivery.py,tools/orrery_earth.py,tools/orrery_refresh.py,tools/precision_window_reference.py,tools/rebuild_coefficients.py,tools/release_changes.py,tools/release_crate.py,tools/release_evidence.py,tools/release_policy.py,tools/run_daily_ingest.py,tools/snapshot_semantics.py,tools/startup_contract.py,tools/validate_accuracy_evidence.py,tools/validate_apparent.py,tools/validate_docs.py,tools/validate_ephemeris.py,tools/validate_ephemeris_snapshot.py,tools/validate_ephemeris_snapshot_v2.py,tools/validate_moons.py,tools/validate_operational_readiness.py,tools/validate_physical_assets.py,tools/validate_planet_phenomena.py,tools/validate_precision_window.py,tools/validate_ranges.py,tools/validate_release_manifest.py,tools/validate_sdlc.py,tools/validate_snapshot.py,tools/validate_ux_contract.py,tools/validate_vectors.py,tools/validate_visual_assets.py,tools/validate_web_static.py,tools/validation_output.py,tools/verify_served_release.py,tools/wasm_provenance.py'
172+
--include='services/ephemeris-server/server.py,tools/browser_smoke.py,tools/build_wasm.py,tools/build_web.py,tools/collect_moon_evidence.py,tools/data_bundles.py,tools/delivery_lifecycle.py,tools/ephemeris_distribution.py,tools/fetch_earth_reference.py,tools/fetch_public_data.py,tools/generate_eop.py,tools/generate_fixture_snapshot.py,tools/generate_moons.py,tools/horizons_apparent.py,tools/horizons_events.py,tools/horizons_observer_seasonal.py,tools/horizons_ranges.py,tools/horizons_reference.py,tools/horizons_vectors.py,tools/jsonschema_min.py,tools/moon_model.py,tools/observation_provenance.py,tools/orrery_delivery.py,tools/orrery_earth.py,tools/orrery_refresh.py,tools/precision_window_reference.py,tools/rebuild_coefficients.py,tools/release_changes.py,tools/release_crate.py,tools/release_evidence.py,tools/release_policy.py,tools/run_daily_ingest.py,tools/snapshot_semantics.py,tools/startup_contract.py,tools/validate_accuracy_evidence.py,tools/validate_apparent.py,tools/validate_docs.py,tools/validate_ephemeris.py,tools/validate_ephemeris_snapshot.py,tools/validate_ephemeris_snapshot_v2.py,tools/validate_moons.py,tools/validate_operational_readiness.py,tools/validate_physical_assets.py,tools/validate_planet_phenomena.py,tools/validate_precision_window.py,tools/validate_ranges.py,tools/validate_release_manifest.py,tools/validate_sdlc.py,tools/validate_snapshot.py,tools/validate_ux_contract.py,tools/validate_vectors.py,tools/validate_visual_assets.py,tools/validate_web_static.py,tools/validation_output.py,tools/verify_served_release.py,tools/wasm_provenance.py'
173173
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
174174
if: always()
175175
with:

‎docs/VERIFIED_FIXES_BRANCH_20261109.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,31 @@ exact-byte hash check. A regression copies the real startup sources as an LF
7070
checkout and validates the shipped descriptor. It reproduces the original
7171
failure and passes after correction. The first failed hosted run remains
7272
historical evidence, not a successful publication check.
73+
74+
## Smoke transport correction and resumed response investigation
75+
76+
The next hosted run passed web/WASM construction and all Rust, Python and
77+
cross-OS determinism checks. Its coverage smoke caught an early capture: the
78+
driver accepted the v1 fallback schema while the declared v3 bundle was still
79+
loading. The transport now waits for the exact declared schema, including an
80+
explicit legacy schema when requested. The original 45-second readiness and
81+
75-second overall driver deadlines remain unchanged.
82+
83+
A real browser run then exposed the System fixture's obsolete assumption that
84+
all System modules are startup preloads. Its native destination entry now joins
85+
the exact module URLs parsed from the owning application/System imports. It
86+
retains the product's own initialization and optional Moon-knot loading. Bare
87+
and versioned imports can share a pathname, so resource timing pathnames alone
88+
cannot identify the correct module instance. Parser regressions reject missing
89+
or ambiguous identities and ignore comments/string lookalikes. The corrected
90+
Sun, Sky and interactive System smoke passes against the staged app, with the
91+
enclosing owned job retired to zero active processes.
92+
93+
The resumed paint-attribution screen retains cold Inspector at 436/404 ms in
94+
two baseline brackets, 452 ms with the Solar canvas hidden, and 220 ms with
95+
Inspector child content hidden. All 48 action observations are conclusive and
96+
all four owned jobs retire cleanly. This points further work toward Inspector
97+
content painting; hidden-content controls are not product fixes, quality passes
98+
or p95 qualification. The 200 ms hold remains. The diagnostic source, raw
99+
receipts and analysis remain under
100+
`build/inspector-paint-attribution-20261109-03/`.

‎tests/python/test_browser_executable.py‎

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os
22
import json
3+
import re
34
import subprocess
45
import tempfile
56
import unittest
7+
import urllib.request
68
from pathlib import Path
79
from unittest.mock import patch
810

@@ -13,12 +15,50 @@
1315

1416

1517
class BrowserExecutableTests(unittest.TestCase):
18+
def test_actual_system_fixture_joins_modules_without_startup_preloads(self):
19+
with browser_smoke.serve(browser_smoke.WEB) as base:
20+
with urllib.request.urlopen(base + '/__smoke_orrery.html', timeout=5) as response:
21+
html = response.read().decode('utf-8')
22+
match = re.search(r'<script>(.*?)</script>', html, re.S)
23+
self.assertIsNotNone(match)
24+
with tempfile.TemporaryDirectory() as temp:
25+
fixture = Path(temp) / 'fixture.js'
26+
fixture.write_text(match.group(1), encoding='utf-8')
27+
script = r"""
28+
import fs from 'node:fs';import assert from 'node:assert/strict';
29+
const source=fs.readFileSync(process.argv[1],'utf8').replaceAll('import(', 'mockImport(');
30+
const callbacks=new Map(),calls=[],origin='http://127.0.0.1:8123';
31+
const app=origin+'/sol/releases/fixture/app.js?v=fixture';
32+
const moduleUrls=JSON.parse(source.match(/const smokeModuleUrls = (\[[^;]+\]);/)[1]);
33+
const entries=moduleUrls.map(url=>({name:new URL(url,origin+'/sol/releases/fixture/__smoke_orrery.html').href}));
34+
const body={dataset:{surface:'today',viewCode:'ready',viewCodeName:'observe'}};
35+
const tab={click(){calls.push('native-orrery-click');body.dataset.surface='orrery';body.dataset.viewCodeName='orrery';},getAttribute(){return body.dataset.surface==='orrery'?'true':'false';}};
36+
const document={body,querySelector(selector){
37+
if(selector.startsWith('link['))return null;
38+
if(selector.includes('script'))return {src:app};
39+
if(selector.includes('data-mode="orrery"'))return tab;
40+
return null;
41+
}};
42+
const modules={'store.js':{store:{orrery:{}}},'orreryTime.js':{},'orrery.js':{enterOrrery:async()=>{}},'moons.js':{MOONS:[{el:[[1]]}]}};
43+
const mockImport=async url=>{calls.push(url);assert.ok(entries.some(entry=>entry.name===url),'join the URL actually fetched by the app');return modules[new URL(url).pathname.split('/').at(-1)];};
44+
const run=new Function('document','location','performance','localStorage','addEventListener','setInterval','requestAnimationFrame','mockImport',source);
45+
run(document,{origin,href:origin+'/sol/releases/fixture/__smoke_orrery.html'},
46+
{now:()=>0,getEntriesByType:()=>entries},{setItem(){}},(type,fn)=>callbacks.set(type,fn),()=>{},()=>{},mockImport);
47+
await callbacks.get('load')();for(let i=0;i<20;i++)await Promise.resolve();
48+
assert.equal(calls[0],'native-orrery-click','deferred System must enter through its actual control');
49+
assert.deepEqual(calls.slice(1),entries.map(entry=>entry.name),'reuse all four actual loaded module identities');
50+
assert.equal(body.dataset.smokeMode,'yes');assert.equal(body.dataset.smokeErrs,undefined);
51+
"""
52+
result = subprocess.run(['node', '--input-type=module', '-e', script, str(fixture)],
53+
text=True, capture_output=True, timeout=10, check=False)
54+
self.assertEqual(result.returncode, 0, result.stderr)
55+
1656
def test_actual_driver_verifies_observe_before_native_research_entry(self):
1757
script = r"""
1858
import fs from 'node:fs'; import assert from 'node:assert/strict';
1959
const source=fs.readFileSync(process.argv[1],'utf8').replace('import puppeteer from "puppeteer-core";','');
2060
const AsyncFunction=Object.getPrototypeOf(async function(){}).constructor;
21-
for(const broken of ['', 'image', 'observation-hidden', 'capture-time', 'source', 'research-entry', 'model-base', 'canvas', 'regions', 'schema']) {
61+
for(const broken of ['', 'legacy-schema', 'image', 'observation-hidden', 'capture-time', 'source', 'research-entry', 'model-base', 'canvas', 'regions', 'schema', 'fallback-schema', 'older-schema', 'future-schema']) {
2262
const calls=[]; let output='';
2363
const node=(text='')=>({textContent:text,hidden:false,getClientRects(){return this.hidden?[]:[{}];},getAttribute(){return 'true';}});
2464
const elements={solarObservation:node(), observationImage:{...node(),complete:true,naturalWidth:1024},
@@ -33,6 +73,10 @@ def test_actual_driver_verifies_observe_before_native_research_entry(self):
3373
if(broken==='source')elements.observationSource.href='';
3474
if(broken==='canvas')elements.solarCanvas.hidden=true;
3575
if(broken==='schema')elements.schemaVersion.textContent='Loading snapshot.';
76+
if(broken==='fallback-schema')elements.schemaVersion.textContent='solar-state-snapshot.v1';
77+
if(broken==='older-schema')elements.schemaVersion.textContent='solar-state-snapshot.v2';
78+
if(broken==='future-schema')elements.schemaVersion.textContent='solar-state-snapshot.v4';
79+
if(broken==='legacy-schema')elements.schemaVersion.textContent='solar-state-snapshot.v2';
3680
const page={setViewport:async()=>{},setBypassServiceWorker:async()=>{},on(){},
3781
createCDPSession:async()=>({send:async()=>{}}),goto:async()=>{},
3882
async waitForFunction(predicate,options,...args){
@@ -50,11 +94,12 @@ def test_actual_driver_verifies_observe_before_native_research_entry(self):
5094
};
5195
const browser={newPage:async()=>page,close:async()=>{calls.push('close');},disconnect(){},process(){throw new Error('unexpected kill');}};
5296
const processMock={argv:['node','driver','fixture-browser','http://127.0.0.1/sol/releases/fixture/index.html'],stdout:{write(value){output+=value;}}};
97+
if(broken==='legacy-schema')processMock.argv.push('', 'solar-state-snapshot.v2');
5398
await new AsyncFunction('puppeteer','process','document','location','getComputedStyle',source)(
5499
{launch:async()=>browser},processMock,document,{pathname:'/sol/releases/fixture/index.html',hash:''},()=>({visibility:'visible'}));
55100
const result=JSON.parse(output);
56101
assert.ok(calls.includes('close'),'browser ownership and cleanup are retained');
57-
if(!broken){
102+
if(!broken||broken==='legacy-schema'){
58103
assert.equal(result.stderr,'');
59104
assert.match(result.observationDom,/data-experience="observe"/);
60105
assert.match(result.observationDom,/Base: loading/,'hidden model placeholder is allowed before native Research entry');
@@ -84,6 +129,20 @@ def test_sun_transport_requires_initial_observe_capture(self):
84129
with self.assertRaisesRegex(AssertionError, "initial Observe capture"):
85130
browser_smoke.dump_dom("browser", "http://127.0.0.1/sol/releases/fixture/index.html")
86131

132+
def test_declared_legacy_schema_reaches_the_driver_and_python_assertion(self):
133+
legacy = READY_SUN.replace('solar-state-snapshot.v3', 'solar-state-snapshot.v2')
134+
payload = {"dom": legacy, "stderr": "", "observationDom":
135+
'<body data-experience="observe"><img id="observationImage"></body>'}
136+
completed = subprocess.CompletedProcess([], 0, json.dumps(payload), "")
137+
with patch.object(browser_smoke.subprocess, "run", return_value=completed) as transport:
138+
self.assertEqual(browser_smoke.dump_dom("browser", "http://127.0.0.1/index.html",
139+
solar_schema="solar-state-snapshot.v2"), (legacy, ""))
140+
self.assertEqual(transport.call_args.args[0][-2:], ["", "solar-state-snapshot.v2"])
141+
with patch.object(browser_smoke, "dump_dom", side_effect=[(legacy, ""), RuntimeError("next surface")]) as dump:
142+
with self.assertRaisesRegex(RuntimeError, "next surface"):
143+
browser_smoke.run_smoke("http://127.0.0.1", "browser", "solar-state-snapshot.v2")
144+
self.assertEqual(dump.call_args_list[0].kwargs, {"solar_schema": "solar-state-snapshot.v2"})
145+
87146
def test_sun_transport_allows_hidden_model_placeholder_only_in_observe(self):
88147
payload = {"dom": READY_SUN, "stderr": "", "observationDom":
89148
'<body data-experience="observe"><img id="observationImage"><div>Base: loading</div><div>Loading snapshot.</div></body>'}

‎tests/python/test_python_coverage_scope.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def test_current_repository_declares_all_affected_modules_and_local_imports(self
4646
source=(ROOT/'.github/workflows/coverage.yml').read_text(encoding='utf-8')
4747
self.assertEqual(checker(ROOT,source),[])
4848
policy=json.loads((ROOT/'tools/python_coverage_scope.json').read_bytes())
49-
self.assertEqual(len(policy['modules']),55)
49+
self.assertEqual(len(policy['modules']),56)
50+
self.assertIn('tools/browser_smoke.py',policy['modules'])
5051
self.assertIn('tools/startup_contract.py',policy['modules'])
5152
self.assertIn('tools/validate_web_static.py',policy['modules'])
5253
self.assertTrue({'tools/horizons_events.py','tools/horizons_observer_seasonal.py',

‎tests/web/smokeModuleUrls.test.mjs‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import test from 'node:test';
2+
import assert from 'node:assert/strict';
3+
import fs from 'node:fs';
4+
import os from 'node:os';
5+
import path from 'node:path';
6+
import {smokeModuleUrls} from '../../tools/smoke_module_urls.mjs';
7+
8+
function fixture(t){
9+
const root=fs.mkdtempSync(path.join(os.tmpdir(),'sol-smoke-modules-'));
10+
t.after(()=>fs.rmSync(root,{recursive:true,force:true}));fs.mkdirSync(path.join(root,'js'));
11+
fs.writeFileSync(path.join(root,'app.js'),"import './js/store.js?v=core';const load=()=>import('./js/orrery.js?v=view');");
12+
fs.writeFileSync(path.join(root,'js/orrery.js'),"import './store.js?v=core';import './orreryTime.js?v=clock';import './moons.js?v=catalogue';");
13+
for(const name of ['store.js','orreryTime.js','moons.js'])fs.writeFileSync(path.join(root,'js',name),'export {};');
14+
return root;
15+
}
16+
test('smoke identities follow actual owning imports with distinct versions and no preloads',t=>{
17+
const root=fixture(t);
18+
assert.deepEqual(smokeModuleUrls(root),['js/store.js?v=core','js/orreryTime.js?v=clock','js/orrery.js?v=view','js/moons.js?v=catalogue']);
19+
});
20+
test('smoke parser ignores comments and string lookalikes',t=>{
21+
const root=fixture(t);fs.appendFileSync(path.join(root,'app.js'),`\n// import('./js/orrery.js?v=wrong');\nconst text="import('./js/orrery.js?v=also-wrong')";`);
22+
fs.appendFileSync(path.join(root,'js/orrery.js'),`\n// import './orreryTime.js?v=wrong';`);
23+
assert.equal(smokeModuleUrls(root)[1],'js/orreryTime.js?v=clock');
24+
});
25+
test('multiple System module identities cannot silently pick an instance',t=>{
26+
const root=fixture(t);fs.appendFileSync(path.join(root,'app.js'),"import('./js/orrery.js?v=other');");
27+
assert.throws(()=>smokeModuleUrls(root),/ambiguous/);
28+
});
29+
test('multiple clock module identities in the owner cannot silently pick an instance',t=>{
30+
const root=fixture(t);fs.appendFileSync(path.join(root,'js/orrery.js'),"import './orreryTime.js';");
31+
assert.throws(()=>smokeModuleUrls(root),/ambiguous/);
32+
});
33+
test('a missing required catalogue import is rejected',t=>{
34+
const root=fixture(t);const file=path.join(root,'js/orrery.js');fs.writeFileSync(file,fs.readFileSync(file,'utf8').replace("import './moons.js?v=catalogue';",''));
35+
assert.throws(()=>smokeModuleUrls(root),/Missing/);
36+
});
37+
test('external dynamic imports and malformed source fail admission',t=>{
38+
const root=fixture(t);const app=path.join(root,'app.js');const original=fs.readFileSync(app,'utf8');
39+
fs.writeFileSync(app,original+"import('https://example.invalid/orrery.js');");assert.throws(()=>smokeModuleUrls(root),/local relative/);
40+
fs.writeFileSync(app,'import {');assert.throws(()=>smokeModuleUrls(root),/syntax/);
41+
});

0 commit comments

Comments
 (0)