conformance: 97 rules of 9 verifiers, 206 vectors; verify-layer and agents refuse a classical key under an ML-DSA-65 name; market-settlement reads the notarization time from the certified read; proof-of-ai README in English
This commit is contained in:
1 parent
c9f2932e04
commit
c9798a0013
111 files changed
+15871
-292
No files matched your search
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
// conformance.mjs: runs the conformance vectors against ANY implementation, given as a command in any language.
|
||||
//
|
||||
// node conformance.mjs --impl "<command>" [--online] [--only <id prefix>] [--vectors <dir>] [--json]
|
||||
// node conformance.mjs --impl "<command>" [--online] [--only <id prefix>] [--artifacts <kind,kind>] [--vectors <dir>] [--json]
|
||||
//
|
||||
// The contract of an implementation (three calls, JSON on stdout):
|
||||
// <command> --capabilities { artifacts: [...], rules: [...], online: bool, batch: bool } what it claims to judge
|
||||
@@ -50,7 +50,7 @@ export function compara(v, r) {
|
||||
* Runs the suite. @returns {{ caps, rezultate: [{ id, stare: 'PASS'|'FAIL'|'BROKEN'|'NOT_COVERED'|'SKIPPED_ONLINE', detaliu }], eroare? }}
|
||||
* `env` is added to the environment of the implementation (the planting control points it at planted copies through it).
|
||||
*/
|
||||
export function ruleazaSuita({ impl, online = false, dir, doar = null, env = {}, vectori: dati = null }) {
|
||||
export function ruleazaSuita({ impl, online = false, dir, doar = null, artefacte = null, env = {}, vectori: dati = null }) {
|
||||
const cmd = desparte(impl); if (!cmd.length) return { eroare: 'no implementation command' };
|
||||
if (cmd[0] === 'node') cmd[0] = process.execPath;
|
||||
const mediu = { ...process.env, ...env };
|
||||
@@ -59,6 +59,7 @@ export function ruleazaSuita({ impl, online = false, dir, doar = null, env = {},
|
||||
if (!Array.isArray(caps.artifacts) || !Array.isArray(caps.rules)) return { eroare: 'capabilities need artifacts and rules' };
|
||||
let vectori = dati; if (!vectori) { const s = incarcaVectorii(dir); if (s.eroare) return { eroare: s.eroare }; vectori = s.vectori; }
|
||||
if (doar) vectori = vectori.filter((v) => v.id.startsWith(doar));
|
||||
if (artefacte) vectori = vectori.filter((v) => artefacte.includes(v.artifact));
|
||||
const rezultate = []; const deRulat = [];
|
||||
for (const v of vectori) {
|
||||
const lipsa = !caps.artifacts.includes(v.artifact) ? ['artifact ' + v.artifact] : v.exercises.filter((r) => !caps.rules.includes(r));
|
||||
@@ -89,7 +90,7 @@ export function ruleazaSuita({ impl, online = false, dir, doar = null, env = {},
|
||||
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||
const a = process.argv.slice(2); const opt = (n) => { const i = a.indexOf(n); return i >= 0 ? a[i + 1] : null; };
|
||||
const impl = opt('--impl'); if (!impl) { console.error('usage: node conformance.mjs --impl "<command>" [--online] [--only <id prefix>] [--vectors <dir>] [--json]'); process.exit(2); }
|
||||
const s = ruleazaSuita({ impl, online: a.includes('--online'), dir: opt('--vectors') || undefined, doar: opt('--only') });
|
||||
const s = ruleazaSuita({ impl, online: a.includes('--online'), dir: opt('--vectors') || undefined, doar: opt('--only'), artefacte: opt('--artifacts') ? opt('--artifacts').split(',') : null });
|
||||
if (s.eroare) { console.log('NOT MEASURED: ' + s.eroare); process.exit(2); }
|
||||
const n = (st) => s.rezultate.filter((r) => r.stare === st).length;
|
||||
if (a.includes('--json')) console.log(JSON.stringify({ implementation: s.caps.name || impl, results: s.rezultate }, null, 1));
|
||||
|
||||
Reference in new issue
Block a user