From 07f3cf4389d69f974371da577ce3507cf08a6527 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Sun, 8 Nov 2026 20:47:36 +0800 Subject: [PATCH] test: pin the ML funcall provisioning contract against a local index fixture resolve() fetches the remote index over HTTP before validating the model id, so on a network-constrained CI runner the raw Net::ReadTimeout surfaced instead of the named RegistryError the contract ruling requires. The unknown-id rejection does not need the network: point INTERSCRIPT_ML_INDEX at a local fixture and the spec becomes deterministic (with_env restores the process env). The three flake failures today (PR runs and main, 3.4/ubuntu) were all this spec hitting Net::ReadTimeout / 502 on the registry fetch. --- spec/isc/semantics_spec.rb | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/spec/isc/semantics_spec.rb b/spec/isc/semantics_spec.rb index 2c1bc4fa..65c30790 100644 --- a/spec/isc/semantics_spec.rb +++ b/spec/isc/semantics_spec.rb @@ -391,15 +391,39 @@ def with_map(name, body) # provisioning error that tells the user what is missing. The fix # (restoring the require) yields the ideal shape: a # RegistryError that enumerates the known model ids. - expect { - Interscript::Stdlib::Functions::SecrystAdapter.call("test", model: "no-such-model") - }.to raise_error( - Interscript::ML::IMF::RegistryError, - /unknown model id "no-such-model" \(known:/ - ) + # + # The unknown-id rejection is pinned against a LOCAL index fixture: + # resolve() fetches DEFAULT_INDEX_URL over HTTP before validating, + # and on a network-constrained runner the raw Net::ReadTimeout used + # to surface instead of the named error. The contract under test — + # unknown ids fail loudly with a RegistryError — does not need the + # network. + Dir.mktmpdir do |dir| + index = File.join(dir, "models.yaml") + File.write(index, <<~YAML) + version: 1 + models: {} + YAML + with_env("INTERSCRIPT_ML_INDEX", index) do + expect { + Interscript::Stdlib::Functions::SecrystAdapter.call("test", model: "no-such-model") + }.to raise_error( + Interscript::ML::IMF::RegistryError, + /unknown model id "no-such-model" \(known:/ + ) + end + end end end +def with_env(name, value) + old = ENV[name] + ENV[name] = value + yield +ensure + ENV[name] = old +end + RSpec.describe "ISC semantics — strict parse (adoption ruling)" do it "rules: the corpus is strict-parse-clean; the stricter parse is adoptable" do # Gate evaluation 2026-10-23: all 295 corpus files (291 maps + 4