From dbe6477cf8a8548fdca203e3396ded3baf488633 Mon Sep 17 00:00:00 2001 From: JavaZeroo <71128095+JavaZeroo@users.noreply.github.com> Date: Fri, 30 Oct 2026 06:13:19 +0800 Subject: [PATCH] diag(ui): checkpoint Node start-up behind the ten second fixture limit refs #144 A preload writes a checkpoint before the fixture runs, so a timeout can say whether Node ever started without changing the limit or the pass criteria. --- research/ui/test_raster_style_reference.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/research/ui/test_raster_style_reference.py b/research/ui/test_raster_style_reference.py index eca59c35..89f34d42 100644 --- a/research/ui/test_raster_style_reference.py +++ b/research/ui/test_raster_style_reference.py @@ -3,6 +3,7 @@ import copy import hashlib import json +import os from pathlib import Path import shutil import subprocess @@ -81,7 +82,18 @@ def test_full_file_hash_detects_tail_change(self): @unittest.skipUnless(shutil.which("node"),"Node is required to exercise production JS native-boundary helpers") def test_production_js_native_contract(self): - result=subprocess.run(["node",str(ROOT/"research/ui/test_raster_native_contract.js")],capture_output=True,text=True,timeout=10) + # Bounded diagnostic for the observed ten second stall (#144): a preload + # checkpoint records whether Node ever started, without changing the limit. + with tempfile.TemporaryDirectory() as diagnostic: + checkpoint=Path(diagnostic)/"node-checkpoint.json" + preload=Path(diagnostic)/"checkpoint.js" + preload.write_text("const fs=require(\"fs\");fs.writeFileSync(process.env.TERMFORGE_NODE_CHECKPOINT,JSON.stringify({started:Date.now(),version:process.version}));",encoding="utf-8") + environment=dict(os.environ,TERMFORGE_NODE_CHECKPOINT=str(checkpoint)) + try: + result=subprocess.run(["node","--require",str(preload),str(ROOT/"research/ui/test_raster_native_contract.js")],capture_output=True,text=True,timeout=10,env=environment) + except subprocess.TimeoutExpired: + state=checkpoint.read_text(encoding="utf-8") if checkpoint.exists() else "preload checkpoint never written" + self.fail(f"node fixture exceeded its ten second limit; {state}") self.assertEqual(result.returncode,0,result.stderr) def test_pixel_analysis_rejects_empty_ambiguous_or_nonuint_samples(self):