Skip to content

Commit c968726

Browse files
committed
ci(WO71): conformance matrix — every shipped model byte-exact in CI
A conformance-matrix job downloads the frozen vectors + model zips from the models Releases (index sha256 verified first) and replays each fixture byte-exactly through the runtime. urd-g2p (split parts) joins via the resolver in a later pass.
1 parent c789832 commit c968726

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

‎.github/workflows/rake.yml‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,39 @@ jobs:
101101
ruby-version: "3.4"
102102
bundler-cache: true
103103
- run: bundle exec standardrb
104+
105+
conformance-matrix:
106+
name: Conformance matrix (frozen fixtures)
107+
runs-on: ubuntu-latest
108+
steps:
109+
- uses: actions/checkout@v7
110+
- uses: ruby/setup-ruby@v1
111+
with:
112+
ruby-version: "3.3"
113+
bundler-cache: true
114+
- name: Download fixtures (GitHub Releases channel)
115+
run: |
116+
mkdir -p fixtures && cd fixtures
117+
BASE="https://github.com/interscript/interscript-models/releases/download"
118+
curl -fsSL -o models-index.yaml "$BASE/index-v12/models-index.yaml"
119+
curl -fsSL -o models-index.yaml.sha256 "$BASE/index-v12/models-index.yaml.sha256"
120+
shasum -a 256 -c models-index.yaml.sha256
121+
for v in urd-diac-base fas-diac-base urd-g2p-base; do
122+
curl -fsSL -O "$BASE/index-v12/$v-vectors.json"
123+
done
124+
# the two single-zip models; urd-g2p (split parts) resolves
125+
# via the runtime resolver in a later matrix pass
126+
for m in urd-diac-base-1.0 fas-diac-base-1.0; do
127+
url=$(ruby -ryaml -e "puts YAML.load_file('models-index.yaml')['models']['$m']['url']")
128+
curl -fsSL -o "$m.zip" "$url"
129+
done
130+
- name: Run the matrix
131+
run: |
132+
for pair in "urd-diac-base-1.0 urd-diac-base" "fas-diac-base-1.0 fas-diac-base"; do
133+
set -- $pair
134+
echo "::group::$1"
135+
SECRYST_E2E_ZIP="$PWD/fixtures/$1.zip" \
136+
CONFORMANCE_VECTORS="$PWD/fixtures/$2-vectors.json" \
137+
bundle exec rspec spec/interscript/ml/conformance_spec.rb
138+
echo "::endgroup::"
139+
done
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# frozen_string_literal: true
2+
3+
require "json"
4+
require "interscript/ml"
5+
6+
# The frozen-fixture contract (interscript-models/conformance/) — the
7+
# ruby runtime must reproduce a model's vectors byte-exactly under the
8+
# declared decode mode, or the change does not merge.
9+
RSpec.describe "frozen conformance fixtures" do
10+
before do
11+
skip "set CONFORMANCE_VECTORS and SECRYST_E2E_ZIP" unless
12+
ENV["CONFORMANCE_VECTORS"] && ENV["SECRYST_E2E_ZIP"]
13+
end
14+
15+
it "reproduces the vectors byte-exactly (single-row-greedy)" do
16+
vectors = JSON.parse(File.read(ENV["CONFORMANCE_VECTORS"]))
17+
expect(vectors["decode"]["mode"]).to eq("single-row-greedy")
18+
model = Interscript::ML::Translator.new(model_file: ENV["SECRYST_E2E_ZIP"])
19+
failures = []
20+
vectors["vectors"].each do |v|
21+
got = model.translate(v["src"])
22+
failures << "#{v["src"].inspect} -> #{got.inspect} (expected #{v["out"].inspect})" if got != v["out"]
23+
end
24+
expect(failures).to be_empty,
25+
"#{vectors['model']}: #{failures.length}/#{vectors['vectors'].length} mismatched\n" +
26+
failures.first(3).join("\n")
27+
end
28+
end

0 commit comments

Comments
 (0)