test(core): remove temporary Node.js skip guards per Plan #69
This commit is contained in:
1 parent
2e9292322c
commit
cb146c38e7
2 files changed
+93
-106
No files matched your search
+92
-105
@@ -974,39 +974,35 @@ def test_ipld_quant_and_mcp_server() -> None:
|
||||
assert "hs-guile-cartridge" not in (tmp_path / "eng_no_guile" / "index.html").read_text(encoding="utf-8")
|
||||
|
||||
import subprocess
|
||||
import shutil
|
||||
|
||||
if shutil.which("node"):
|
||||
node_guile_test = subprocess.run(
|
||||
[
|
||||
"node",
|
||||
"-e",
|
||||
f"const R = require({json.dumps(str(guile_js_p))});"
|
||||
"const s = R.createSession();"
|
||||
"if (s.evaluate('(aq-base36 \"LEMUR\")').formatted !== '114') process.exit(1);"
|
||||
"if (s.evaluate('(prime-factors 666)').formatted !== '(2 3 3 37)') process.exit(2);"
|
||||
"if (s.evaluate('(+ 1/5 9/50 9/50 4/25 7/50 7/50)').formatted !== '1') process.exit(3);"
|
||||
"if (s.evaluate('(variance-pop *cluster-292-gen0*)').formatted !== '4634/9') process.exit(4);"
|
||||
"if (s.evaluate('(variance-pop *cluster-292-gen1*)').formatted !== '0') process.exit(5);"
|
||||
"if (Math.abs(s.evaluate('((derivative (lambda (x) (* x x x)) 1e-5) 2.0)').floatValue - 12.0) > 1e-3) process.exit(6);"
|
||||
"if (Math.abs(s.evaluate('(adaptive-simpson (lambda (x) (* x x)) 0.0 3.0 1e-6)').floatValue - 9.0) > 1e-4) process.exit(7);"
|
||||
"if (s.evaluate(\"(bayes-update '(1/3 1/3 1/3) '(1/10 3/10 6/10))\").formatted !== '(1/10 3/10 3/5)') process.exit(8);"
|
||||
"if (s.evaluatePolyglot('aqBase36(\"LEMUR\")', 'ts').formatted !== '114') process.exit(9);"
|
||||
"if (s.evaluatePolyglot('aq_base36(\"LEMUR\")', 'rust').formatted !== '114') process.exit(10);"
|
||||
"if (s.evaluatePolyglot('primeFactors(666)', 'ts').formatted !== '[2,3,3,37]') process.exit(11);"
|
||||
"if (s.evaluatePolyglot('prime_factors(666_u64)', 'rust').formatted !== 'vec![2, 3, 3, 37]') process.exit(12);"
|
||||
"if (s.evaluatePolyglot('(aq-base36 \"LEMUR\")', 'rust').formatted !== '114') process.exit(13);"
|
||||
"if (s.evaluatePolyglot('let x: i64 = aq_base36(\"LEMUR\") + 23; x * 2', 'rust').formatted !== '274') process.exit(14);"
|
||||
"if (s.evaluatePolyglot('const x: number = aqBase36(\"LEMUR\") + 23; x * 2', 'ts').formatted !== '274') process.exit(15);"
|
||||
"if (s.evaluatePolyglot('(1..=5_i64).map(|x| x * x).sum::<i64>()', 'rust').formatted !== '55') process.exit(16);",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert node_guile_test.returncode == 0, f"Node Polyglot REPL check failed ({node_guile_test.returncode}): {node_guile_test.stderr}"
|
||||
else:
|
||||
print("[notice] 'node' executable not found in PATH; skipping Node.js polyglot REPL subtest.")
|
||||
node_guile_test = subprocess.run(
|
||||
[
|
||||
"node",
|
||||
"-e",
|
||||
f"const R = require({json.dumps(str(guile_js_p))});"
|
||||
"const s = R.createSession();"
|
||||
"if (s.evaluate('(aq-base36 \"LEMUR\")').formatted !== '114') process.exit(1);"
|
||||
"if (s.evaluate('(prime-factors 666)').formatted !== '(2 3 3 37)') process.exit(2);"
|
||||
"if (s.evaluate('(+ 1/5 9/50 9/50 4/25 7/50 7/50)').formatted !== '1') process.exit(3);"
|
||||
"if (s.evaluate('(variance-pop *cluster-292-gen0*)').formatted !== '4634/9') process.exit(4);"
|
||||
"if (s.evaluate('(variance-pop *cluster-292-gen1*)').formatted !== '0') process.exit(5);"
|
||||
"if (Math.abs(s.evaluate('((derivative (lambda (x) (* x x x)) 1e-5) 2.0)').floatValue - 12.0) > 1e-3) process.exit(6);"
|
||||
"if (Math.abs(s.evaluate('(adaptive-simpson (lambda (x) (* x x)) 0.0 3.0 1e-6)').floatValue - 9.0) > 1e-4) process.exit(7);"
|
||||
"if (s.evaluate(\"(bayes-update '(1/3 1/3 1/3) '(1/10 3/10 6/10))\").formatted !== '(1/10 3/10 3/5)') process.exit(8);"
|
||||
"if (s.evaluatePolyglot('aqBase36(\"LEMUR\")', 'ts').formatted !== '114') process.exit(9);"
|
||||
"if (s.evaluatePolyglot('aq_base36(\"LEMUR\")', 'rust').formatted !== '114') process.exit(10);"
|
||||
"if (s.evaluatePolyglot('primeFactors(666)', 'ts').formatted !== '[2,3,3,37]') process.exit(11);"
|
||||
"if (s.evaluatePolyglot('prime_factors(666_u64)', 'rust').formatted !== 'vec![2, 3, 3, 37]') process.exit(12);"
|
||||
"if (s.evaluatePolyglot('(aq-base36 \"LEMUR\")', 'rust').formatted !== '114') process.exit(13);"
|
||||
"if (s.evaluatePolyglot('let x: i64 = aq_base36(\"LEMUR\") + 23; x * 2', 'rust').formatted !== '274') process.exit(14);"
|
||||
"if (s.evaluatePolyglot('const x: number = aqBase36(\"LEMUR\") + 23; x * 2', 'ts').formatted !== '274') process.exit(15);"
|
||||
"if (s.evaluatePolyglot('(1..=5_i64).map(|x| x * x).sum::<i64>()', 'rust').formatted !== '55') process.exit(16);",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert node_guile_test.returncode == 0, f"Node Polyglot REPL check failed ({node_guile_test.returncode}): {node_guile_test.stderr}"
|
||||
|
||||
# Verify 4-Ring Sandbox Security & Resource Quota Guards (polyglot_sandbox.py)
|
||||
from hyperstitionstud_io.publishing.polyglot_sandbox import (
|
||||
@@ -1015,33 +1011,30 @@ def test_ipld_quant_and_mcp_server() -> None:
|
||||
evaluate_polyglot_sandbox,
|
||||
)
|
||||
|
||||
if shutil.which("node"):
|
||||
for bad_expr, bad_lang in (
|
||||
('({}).constructor.constructor("return process")()', "ts"),
|
||||
("globalThis.fetch('https://example.com')", "ts"),
|
||||
('(system "id")', "guile"),
|
||||
('std::process::Command::new("sh")', "rust"),
|
||||
):
|
||||
blocked = False
|
||||
try:
|
||||
evaluate_polyglot_sandbox(bad_expr, lang=bad_lang)
|
||||
except SandboxSecurityError:
|
||||
blocked = True
|
||||
assert blocked, f"Failed to block escape attempt {bad_expr!r} in {bad_lang}"
|
||||
for bad_expr, bad_lang in (
|
||||
('({}).constructor.constructor("return process")()', "ts"),
|
||||
("globalThis.fetch('https://example.com')", "ts"),
|
||||
('(system "id")', "guile"),
|
||||
('std::process::Command::new("sh")', "rust"),
|
||||
):
|
||||
blocked = False
|
||||
try:
|
||||
evaluate_polyglot_sandbox(bad_expr, lang=bad_lang)
|
||||
except SandboxSecurityError:
|
||||
blocked = True
|
||||
assert blocked, f"Failed to block escape attempt {bad_expr!r} in {bad_lang}"
|
||||
|
||||
for inf_expr, inf_lang in (
|
||||
("((Z (lambda (r) (lambda (x) (r (+ x 1))))) 0)", "guile"),
|
||||
("Array.from({length: 1000000}, (_, i): number => i + 1).reduce((a, b) => a + b, 0)", "ts"),
|
||||
("(1..=1000000_i64).fold(0_i64, |acc, x| acc + x)", "rust"),
|
||||
):
|
||||
halted = False
|
||||
try:
|
||||
evaluate_polyglot_sandbox(inf_expr, lang=inf_lang, max_steps=2000)
|
||||
except SandboxResourceError:
|
||||
halted = True
|
||||
assert halted, f"Failed to halt resource exhaustion {inf_expr!r} in {inf_lang}"
|
||||
else:
|
||||
print("[notice] 'node' executable not found in PATH; skipping Node.js polyglot sandbox security & resource exhaustion subtests.")
|
||||
for inf_expr, inf_lang in (
|
||||
("((Z (lambda (r) (lambda (x) (r (+ x 1))))) 0)", "guile"),
|
||||
("Array.from({length: 1000000}, (_, i): number => i + 1).reduce((a, b) => a + b, 0)", "ts"),
|
||||
("(1..=1000000_i64).fold(0_i64, |acc, x| acc + x)", "rust"),
|
||||
):
|
||||
halted = False
|
||||
try:
|
||||
evaluate_polyglot_sandbox(inf_expr, lang=inf_lang, max_steps=2000)
|
||||
except SandboxResourceError:
|
||||
halted = True
|
||||
assert halted, f"Failed to halt resource exhaustion {inf_expr!r} in {inf_lang}"
|
||||
|
||||
# Verify 5-state #hsPolyglotModeSelector on /engineering/ and /math/
|
||||
eng_idx_txt = (cfg.core_dir / "site" / "engineering" / "index.html").read_text(encoding="utf-8")
|
||||
@@ -1126,27 +1119,24 @@ def test_ipld_quant_and_mcp_server() -> None:
|
||||
assert "hs-sigil-seal" in surf_txt, f"Missing hs-sigil-seal in {surf_p}"
|
||||
assert "hs-sigil-colophon" in surf_txt, f"Missing hs-sigil-colophon in {surf_p}"
|
||||
|
||||
if shutil.which("node"):
|
||||
node_rain_test = subprocess.run(
|
||||
[
|
||||
"node",
|
||||
"-e",
|
||||
f"const CR = require({json.dumps(str(coderain_js_p))});"
|
||||
"if (CR.MATRIX_CHARS.length !== 66) process.exit(1);"
|
||||
"if (CR.SIGIL_GLINTS.length < 8) process.exit(2);"
|
||||
"const sub = CR.PROFILES.subtle;"
|
||||
"if (sub.frameIntervalMs !== 80 || sub.colPitchPx !== 24 || sub.canvasOpacity !== 0.45) process.exit(3);"
|
||||
"const aCenter = CR.computeColumnAlpha(500, 1000, sub, false);"
|
||||
"const aOuter = CR.computeColumnAlpha(50, 1000, sub, false);"
|
||||
"if (!(aCenter < aOuter && aCenter <= 0.09 && aOuter >= 0.20)) process.exit(4);",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert node_rain_test.returncode == 0, f"Node Code-Rain check failed ({node_rain_test.returncode}): {node_rain_test.stderr}"
|
||||
else:
|
||||
print("[notice] 'node' executable not found in PATH; skipping Node.js code-rain subtest.")
|
||||
node_rain_test = subprocess.run(
|
||||
[
|
||||
"node",
|
||||
"-e",
|
||||
f"const CR = require({json.dumps(str(coderain_js_p))});"
|
||||
"if (CR.MATRIX_CHARS.length !== 66) process.exit(1);"
|
||||
"if (CR.SIGIL_GLINTS.length < 8) process.exit(2);"
|
||||
"const sub = CR.PROFILES.subtle;"
|
||||
"if (sub.frameIntervalMs !== 80 || sub.colPitchPx !== 24 || sub.canvasOpacity !== 0.45) process.exit(3);"
|
||||
"const aCenter = CR.computeColumnAlpha(500, 1000, sub, false);"
|
||||
"const aOuter = CR.computeColumnAlpha(50, 1000, sub, false);"
|
||||
"if (!(aCenter < aOuter && aCenter <= 0.09 && aOuter >= 0.20)) process.exit(4);",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert node_rain_test.returncode == 0, f"Node Code-Rain check failed ({node_rain_test.returncode}): {node_rain_test.stderr}"
|
||||
|
||||
# Verify PLAN-AUTOMATED-PER-COMMIT-REPO-ROOT-README-SYNCHRONIZATION-FOR-GITEA
|
||||
# and PLAN-README-AND-GIT-COMMIT-MESSAGE-VERSION-PARITY-FIX
|
||||
@@ -1243,32 +1233,29 @@ def test_ipld_quant_and_mcp_server() -> None:
|
||||
assert js_sig_1["js_ui_sha256"] != js_sig_2["js_ui_sha256"], "Mutating JS DOM control must change js_ui_sha256 fingerprint"
|
||||
assert js_sig_1["has_lens_select_highlight"] is True and js_sig_1["speech_text_count"] == 25
|
||||
|
||||
if shutil.which("node"):
|
||||
node_quant_tut_test = subprocess.run(
|
||||
[
|
||||
"node",
|
||||
"-e",
|
||||
f"const QT = require({json.dumps(str(quant_tut_js_p))});"
|
||||
"if (QT.episodes.length !== 5) process.exit(1);"
|
||||
"let totalScenes = 0;"
|
||||
"QT.episodes.forEach((ep) => {"
|
||||
" ep.keyframes.forEach((kf) => {"
|
||||
" totalScenes++;"
|
||||
" if (!Array.isArray(kf.uiTargets) || kf.uiTargets.length === 0) process.exit(2);"
|
||||
" if (!kf.uiElementLabel || !kf.speechText) process.exit(3);"
|
||||
" });"
|
||||
"});"
|
||||
"if (totalScenes !== 25) process.exit(4);"
|
||||
"const ep04 = QT.episodes[3];"
|
||||
"if (!ep04.keyframes.every((kf) => kf.uiTargets.includes('lensSelect') && kf.uiTargets.includes('lensProjectionCard'))) process.exit(5);",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert node_quant_tut_test.returncode == 0, f"Node QuantTutorials check failed ({node_quant_tut_test.returncode}): {node_quant_tut_test.stderr}"
|
||||
else:
|
||||
print("[notice] 'node' executable not found in PATH; skipping Node.js quant tutorials subtest.")
|
||||
node_quant_tut_test = subprocess.run(
|
||||
[
|
||||
"node",
|
||||
"-e",
|
||||
f"const QT = require({json.dumps(str(quant_tut_js_p))});"
|
||||
"if (QT.episodes.length !== 5) process.exit(1);"
|
||||
"let totalScenes = 0;"
|
||||
"QT.episodes.forEach((ep) => {"
|
||||
" ep.keyframes.forEach((kf) => {"
|
||||
" totalScenes++;"
|
||||
" if (!Array.isArray(kf.uiTargets) || kf.uiTargets.length === 0) process.exit(2);"
|
||||
" if (!kf.uiElementLabel || !kf.speechText) process.exit(3);"
|
||||
" });"
|
||||
"});"
|
||||
"if (totalScenes !== 25) process.exit(4);"
|
||||
"const ep04 = QT.episodes[3];"
|
||||
"if (!ep04.keyframes.every((kf) => kf.uiTargets.includes('lensSelect') && kf.uiTargets.includes('lensProjectionCard'))) process.exit(5);",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert node_quant_tut_test.returncode == 0, f"Node QuantTutorials check failed ({node_quant_tut_test.returncode}): {node_quant_tut_test.stderr}"
|
||||
|
||||
# Verify Plan #57 (Strategies 1A, 2A, 3A): Zero-Git-Audio deploy-time WAV voice compiler (quant_voice.py) & 0 audio files in Git
|
||||
from hyperstitionstud_io.publishing.quant_voice import build_quant_tour_voice_assets
|
||||
|
||||
Reference in new issue
Block a user