mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-09-14 14:01:28 +08:00
9817695a60
Reorganizes the verification system into per-OS bundles, addressing
the cross-platform CI matrix added in c51841590.
Layout
──────
verification/
README.md — tutorial-structure docs (was at root)
witness-fixes.json — input config (OS-independent)
results.md — last-run report (was at root)
inventory.json — capability inventory (was at root)
linux/
manifest.md.json — signed by Linux CI
history.jsonl
macos/
manifest.md.json — signed by macOS CI
history.jsonl
windows/
manifest.md.json — signed by Windows CI
history.jsonl
Why per-OS
──────────
File hashes drift across platforms (LF vs CRLF normalization, path
separators, prebuilt binary differences). Each OS produces its own
truthful snapshot. The cross-platform witness-verify CI job runs
once per OS and writes/verifies that OS's bundle, catching
platform-specific marker drift before it reaches users on that
platform.
linux/ + windows/ initially seeded by copying the macOS-generated
manifests; CI on each OS will regenerate its own per-OS bundle on
first push.
Why JSONL inside, not binary RVF
──────────────────────────────────
@ruvector/rvf-node provides a true RVF binary format with native
bindings on all 3 OSes — but it's optimized for vector similarity
search, not key-value retrieval. The witness use case is structured
key-value lookup (snapshot N's commit + fix statuses), so JSONL is
the better fit inside each container. The folder layout adopts the
RVF *cognitive container* concept (per-OS bundle of manifest +
history + metadata); the file format inside is JSONL.
Script changes
──────────────
- lib.mjs: added osDir() platform mapper + 'os' field on manifest +
'os' field on history entries.
- regen-witness.mjs: defaults to verification/<os>/{manifest,history}
using process.platform → osDir.
- v3-ci.yml: witness-verify reads its OS-specific manifest via
$RUNNER_OS dispatch.
Tutorial README
───────────────
verification/README.md rewritten as a tutorial: bootstrap → register
fix → regen → verify → investigate regressions → wire into CI. Plus
features matrix, daily cheat sheet, schema, anti-patterns, integration
with the broader regression stack (Layer 1/2/3 from the agentic-
validation gist).
Co-Authored-By: RuFlo <ruv@ruv.net>
71 lines
2.6 KiB
JavaScript
71 lines
2.6 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* ruflo-internal witness regen — thin wrapper around the canonical
|
|
* implementation in `plugins/ruflo-core/scripts/witness/regen.mjs`.
|
|
*
|
|
* The plugin script is project-agnostic; this wrapper hard-codes ruflo's
|
|
* paths so contributors can run a one-liner. Add new fix entries by
|
|
* editing `witness-fixes.json` at the repo root.
|
|
*
|
|
* Usage:
|
|
* node scripts/regen-witness.mjs # regen + append history
|
|
* node scripts/regen-witness.mjs --dry-run # preview without writing
|
|
*/
|
|
|
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
import { join, resolve, dirname } from 'node:path';
|
|
import { regenerate, appendHistory, osDir } from '../plugins/ruflo-core/scripts/witness/lib.mjs';
|
|
|
|
const REPO_ROOT = process.cwd();
|
|
|
|
// Per-OS layout (see ADR-103 §6 — verification cognitive container).
|
|
// Each OS subdir holds the manifest signed by that OS's runner; CI
|
|
// regenerates its own per-OS bundle. Shared inputs live at verification/.
|
|
const OS = osDir();
|
|
const VERIFICATION_DIR = join(REPO_ROOT, 'verification');
|
|
const MANIFEST_PATH = join(VERIFICATION_DIR, OS, 'manifest.md.json');
|
|
const HISTORY_PATH = join(VERIFICATION_DIR, OS, 'history.jsonl');
|
|
const FIXES_CONFIG = join(VERIFICATION_DIR, 'witness-fixes.json');
|
|
const DRY_RUN = process.argv.includes('--dry-run');
|
|
|
|
// Ensure the per-OS subdir exists (CI on a new OS bootstraps cleanly).
|
|
mkdirSync(dirname(MANIFEST_PATH), { recursive: true });
|
|
|
|
const newFixes = existsSync(FIXES_CONFIG)
|
|
? JSON.parse(readFileSync(FIXES_CONFIG, 'utf8')).fixes ?? []
|
|
: [];
|
|
|
|
const releases = {};
|
|
for (const [key, pkgPath] of [
|
|
['ruflo', 'ruflo/package.json'],
|
|
['claude-flow', 'package.json'],
|
|
['@claude-flow/cli', 'v3/@claude-flow/cli/package.json'],
|
|
['@claude-flow/memory', 'v3/@claude-flow/memory/package.json'],
|
|
]) {
|
|
const fullPath = join(REPO_ROOT, pkgPath);
|
|
if (existsSync(fullPath)) releases[key] = JSON.parse(readFileSync(fullPath, 'utf8')).version;
|
|
}
|
|
|
|
const result = regenerate({
|
|
repoRoot: REPO_ROOT,
|
|
manifestPath: MANIFEST_PATH,
|
|
newFixes,
|
|
releases,
|
|
ed25519Roots: [REPO_ROOT, join(REPO_ROOT, 'v3')],
|
|
});
|
|
|
|
console.log('witness regen summary');
|
|
console.log('─────────────────────');
|
|
console.log(result.summary);
|
|
|
|
if (DRY_RUN) {
|
|
console.log('\n(dry-run — manifest NOT written)');
|
|
process.exit(0);
|
|
}
|
|
|
|
writeFileSync(MANIFEST_PATH, JSON.stringify(result.witness, null, 2));
|
|
console.log(`\nwritten: ${MANIFEST_PATH}`);
|
|
|
|
appendHistory(HISTORY_PATH, result.witness.manifest, result.manifestHash);
|
|
console.log(`appended: ${HISTORY_PATH}`);
|