π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
test(metaharness): fingerprint-schema compat tripwire (iter 81)
ruvb0ac5998ea72
diff --git a/.github/workflows/metaharness-ci.yml b/.github/workflows/metaharness-ci.ymlindex fc73cb9b06..957d847dd5 100644--- a/.github/workflows/metaharness-ci.yml+++ b/.github/workflows/metaharness-ci.yml@@ -345,6 +345,19 @@ jobs:npx -y metaharness@latest --versionecho "β metaharness CLI warm"+ - name: Upstream fingerprint schema invariants (iter 81 β protects _similarity.mjs)+ # If upstream `metaharness score|genome` renames any of the 14+ # fields _similarity.mjs::projectToVec reads (harnessFit,+ # compileConfidence, taskCoverage, toolSafety, memoryUsefulness,+ # estCostPerRunUsd, recommendedMode, archetype, template, repo_type,+ # agent_topology, risk_score, test_confidence, publish_readiness),+ # projectToVec defaults that field to 0 and similarity silently+ # degrades to categorical+jaccard-only signal. Same class of bug+ # as iter-47 (CLI binary schema mismatch).+ run: |+ node scripts/check-fingerprint-schema.mjs --format json+ echo "β upstream fingerprint schema compatible with _similarity.mjs"+- name: Upstream mcp-scan format invariants (iter 80 β protects iter-50 parser)# If upstream `harness mcp-scan` ever changes its text format,# iter-50's parseMcpScanText silently returns empty findings anddiff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.shindex e57ac1affb..62e129f06c 100755--- a/plugins/ruflo-metaharness/scripts/smoke.sh+++ b/plugins/ruflo-metaharness/scripts/smoke.sh@@ -191,6 +191,22 @@ grep -q "execCli(\[\s*'-y'\s*,\s*'metaharness@latest'" "$F" 2>/dev/null || \grep -q "cwd: opts" "$F" || miss="$miss no-cwd-passthrough"[[ -z "$miss" ]] && ok || bad "$miss"+step "17z44. fingerprint-schema compat tripwire (iter 81)"+miss=""+F="$ROOT/../../scripts/check-fingerprint-schema.mjs"+[[ -x "$F" ]] || miss="$miss not-executable"+node --check "$F" 2>/dev/null || miss="$miss syntax-error"+# All 14 fields listed in the tripwire script+for field in harnessFit compileConfidence taskCoverage toolSafety memoryUsefulness estCostPerRunUsd recommendedMode archetype template repo_type agent_topology risk_score test_confidence publish_readiness; do+ grep -q "'${field}'" "$F" 2>/dev/null || miss="$miss missing-field-${field}"+done+# CI workflow runs it+W="$ROOT/../../.github/workflows/metaharness-ci.yml"+grep -q "check-fingerprint-schema.mjs" "$W" 2>/dev/null || miss="$miss not-in-ci"+# Runtime: tripwire passes against installed metaharness+node "$F" >/dev/null 2>&1 || miss="$miss tripwire-fails-locally"+[[ -z "$miss" ]] && ok || bad "$miss"+step "17z43. upstream mcp-scan format compat tripwire (iter 80)"miss=""F="$ROOT/../../scripts/check-mcp-scan-format.mjs"diff --git a/scripts/check-fingerprint-schema.mjs b/scripts/check-fingerprint-schema.mjsnew file mode 100755index 0000000000..dfb32378de--- /dev/null+++ b/scripts/check-fingerprint-schema.mjs@@ -0,0 +1,147 @@+#!/usr/bin/env node+// check-fingerprint-schema β protect _similarity.mjs from silent upstream+// schema drift in `metaharness score` / `metaharness genome`.+//+// iter 47 discovered that `harness score` and `metaharness score` have+// different output schemas β using the wrong one made similarity() return+// 0.8125 on self-roundtrip (should be 1.0). The fix routed score+genome+// through `runMetaharness` to get the correct shape.+//+// But there's still no test that ASSERTS the correct shape stays correct.+// If upstream renames `harnessFit` to `harness_fit` (or anything),+// _similarity.mjs::projectToVec reads `s.harnessFit` β undefined β 0 β+// all numerics collapse to 0 β similarity always returns the categorical+// + jaccard agreement, never the cosine. Drift detection silently breaks.+//+// This script runs the two `metaharness` subcommands and asserts the+// fields _similarity.mjs::projectToVec actually reads.+//+// USAGE+// node scripts/check-fingerprint-schema.mjs # exits 0 if intact+// node scripts/check-fingerprint-schema.mjs --format json # CI-consumable+//+// EXIT CODES+// 0 fingerprint schemas intact (or metaharness not installed)+// 1 at least one expected field is missing+// 2 unexpected error++import { spawnSync } from 'node:child_process';++const ARGS = (() => {+ const a = { format: 'table' };+ for (let i = 2; i < process.argv.length; i++) {+ if (process.argv[i] === '--format') a.format = process.argv[++i];+ }+ return a;+})();++// _similarity.mjs::projectToVec reads these EXACT field names. If+// upstream renames any of them, projectToVec returns 0 for that index+// and the cosine signal degrades silently.+const SCORE_FIELDS = [+ 'harnessFit', 'compileConfidence', 'taskCoverage', 'toolSafety',+ 'memoryUsefulness', 'estCostPerRunUsd', 'recommendedMode',+ 'archetype', 'template',+];+const GENOME_FIELDS = [+ 'repo_type', 'agent_topology', 'risk_score',+ 'test_confidence', 'publish_readiness',+];++function emit(payload, code) {+ if (ARGS.format === 'json') console.log(JSON.stringify(payload, null, 2));+ else {+ console.log(`# check-fingerprint-schema\n`);+ if (payload.skipped) console.log(`β ${payload.reason}`);+ else if (payload.ok) console.log(`β All ${payload.results.length} fields intact.`);+ else {+ console.log(`β ${payload.failedCount}/${payload.results.length} fields missing:`);+ for (const r of payload.results) {+ if (!r.ok) console.log(` - ${r.subcommand}.${r.field} (${r.detail})`);+ }+ }+ }+ process.exit(code);+}++function runMeta(subcmd, path) {+ const r = spawnSync('npx', [+ '-y', 'metaharness@latest', subcmd, path, '--json',+ ], { encoding: 'utf-8', timeout: 90_000 });+ if (r.status === null+ || /could not determine executable|404|not installed|MODULE_NOT_FOUND|ENOTFOUND/i.test(r.stderr || '')) {+ return { degraded: true };+ }+ const m = /\{[\s\S]*\}/.exec(r.stdout || '');+ if (!m) return { degraded: false, json: null, raw: r.stdout?.slice(0, 200) };+ try { return { degraded: false, json: JSON.parse(m[0]) }; }+ catch (e) { return { degraded: false, json: null, error: e.message }; }+}++async function main() {+ const path = '.';++ // 1. metaharness score+ const scoreR = runMeta('score', path);+ if (scoreR.degraded) {+ emit({+ skipped: true,+ reason: 'metaharness-not-available β install with `npm i --include=optional` to verify schema',+ generatedAt: new Date().toISOString(),+ }, 0);+ }+ if (!scoreR.json) {+ emit({+ ok: false,+ results: [{ subcommand: 'score', field: '*', ok: false, detail: 'no JSON in output' }],+ failedCount: 1,+ generatedAt: new Date().toISOString(),+ }, 1);+ }++ // 2. metaharness genome+ const genomeR = runMeta('genome', path);+ if (!genomeR.json) {+ emit({+ ok: false,+ results: [{ subcommand: 'genome', field: '*', ok: false, detail: 'no JSON in output' }],+ failedCount: 1,+ generatedAt: new Date().toISOString(),+ }, 1);+ }++ // 3. Assert each expected field is present (i.e., key exists, even+ // if value is null β we just care upstream didn't rename it).+ const results = [];+ for (const field of SCORE_FIELDS) {+ const present = scoreR.json[field] !== undefined;+ results.push({+ subcommand: 'score',+ field,+ ok: present,+ detail: present ? `value=${typeof scoreR.json[field]}` : 'MISSING β projectToVec defaults to 0',+ });+ }+ for (const field of GENOME_FIELDS) {+ const present = genomeR.json[field] !== undefined;+ results.push({+ subcommand: 'genome',+ field,+ ok: present,+ detail: present ? `value=${typeof genomeR.json[field]}` : 'MISSING β projectToVec defaults to 0',+ });+ }++ const failed = results.filter((r) => !r.ok);+ emit({+ ok: failed.length === 0,+ results,+ failedCount: failed.length,+ generatedAt: new Date().toISOString(),+ }, failed.length === 0 ? 0 : 1);+}++main().catch((e) => {+ console.error('check-fingerprint-schema crashed:', e?.message ?? e);+ process.exit(2);+});