Round 7 (516dffa..45aa9e1, WARN: 12 MAJOR, 0 BLOCKER) and the fence defect
found while writing its review.md. Each fix began with a test that failed on
0f400d3 (v6.3.0); suite 2208 (2206/0/2), 14 tests more.
- Tests-only (operator 2026-10-11): the plan's Files: alone decides, and the
text says so (red-proof, trekexecute Sub-step B, step-implementer,
HANDOVER-CONTRACTS). red-proof no longer reads the step's diff, so a change
already in the tree when the step began no longer counts against it, and a
plan placed outside .claude/ reads the same. The round-6 test that had the
diff overrule the plan is rewritten to the new rule.
- The Files: reader keeps a plain file beside a backticked path
(", Dockerfile", "the CLI entry src/cli.mjs", "and Makefile"). Measured on
the 520 Files: fields in 182 plans: no field reads differently.
- Red proof reports a command its timeout killed as killed after the timeout,
not "could not start"; the release check tells a timeout from output past
its buffer and from another signal. One reading of a stop
(criteria-runner stoppedBy) for red proof, the criteria runner and the
release check.
- A trailing `# comment` is dropped in a backticked check too, and in a
command passed as written, so the words screened are the words run.
- The release check reads a relative --review in --repo.
- The 15-minute timeout is defined once (criteria-runner.mjs).
- The findings check reads each cited file once per validation.
- One isMain helper (lib/util/is-main.mjs) for every CLI: the 31 copies of
the realpath guard and the 20 modules still on the file:// guard, which
exited 0 having done nothing under a symlink or a path with a space.
- The Bash guard writes its no-one-to-ask refusal once, on a direct condition.
- The findings check ends a ```json block only at a fence on its own line, so
three backticks inside a JSON string no longer end it (also in 6.2.0).
- Brief-conformance notes: a test for test-lock green on exit 127 (it
passed at once; it fails when 127 is read as could-not-run); the prose now
names the git revision `@~1` as the one leading-@ exception.
Not changed: the example plan's steps 1-2 keep their tests-only warning
(operator decision 2026-10-09; the r5 test records it). Brief note 4 (a
Regression: whose runner is not installed goes to the fix rounds) is a
routing question for the operator.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
95 lines
3.4 KiB
JavaScript
95 lines
3.4 KiB
JavaScript
// lib/validators/architecture-discovery.mjs
|
|
// EXTERNAL CONTRACT — drift-WARN, never drift-FAIL.
|
|
//
|
|
// The architecture/ directory is produced by an upstream architect plugin
|
|
// (opt-in). voyage validates only DISCOVERY (file present at canonical path)
|
|
// and tolerates internal-format drift via warnings.
|
|
//
|
|
// Never read body content beyond first heading. Never assert frontmatter shape.
|
|
|
|
import { existsSync, readdirSync, statSync, readFileSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
import { issue } from '../util/result.mjs';
|
|
import { isMain } from '../util/is-main.mjs';
|
|
|
|
const CANONICAL_OVERVIEW = 'overview.md';
|
|
const CANONICAL_GAPS = 'gaps.md';
|
|
const KNOWN_ALTERNATIVES = ['architecture-overview.md', 'overview.markdown', 'README.md'];
|
|
|
|
export function discoverArchitecture(projectDir) {
|
|
const archDir = projectDir ? join(projectDir, 'architecture') : null;
|
|
const result = {
|
|
found: false,
|
|
overview: null,
|
|
gaps: null,
|
|
looseFiles: [],
|
|
warnings: [],
|
|
};
|
|
|
|
if (!archDir || !existsSync(archDir) || !statSync(archDir).isDirectory()) {
|
|
return result;
|
|
}
|
|
|
|
const overviewPath = join(archDir, CANONICAL_OVERVIEW);
|
|
if (existsSync(overviewPath) && statSync(overviewPath).isFile()) {
|
|
result.found = true;
|
|
result.overview = overviewPath;
|
|
} else {
|
|
for (const alt of KNOWN_ALTERNATIVES) {
|
|
const altPath = join(archDir, alt);
|
|
if (existsSync(altPath) && statSync(altPath).isFile()) {
|
|
result.found = true;
|
|
result.overview = altPath;
|
|
result.warnings.push(issue(
|
|
'ARCH_NON_CANONICAL_OVERVIEW',
|
|
`Architecture file at non-canonical path: ${alt}`,
|
|
`Canonical contract is architecture/overview.md. The upstream architect producer may have drifted; this is a warning, not a blocker.`,
|
|
));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
const gapsPath = join(archDir, CANONICAL_GAPS);
|
|
if (existsSync(gapsPath) && statSync(gapsPath).isFile()) result.gaps = gapsPath;
|
|
|
|
const all = readdirSync(archDir).filter(f => /\.md$/i.test(f));
|
|
result.looseFiles = all
|
|
.filter(f => f !== CANONICAL_OVERVIEW && f !== CANONICAL_GAPS && !KNOWN_ALTERNATIVES.includes(f))
|
|
.map(f => join(archDir, f));
|
|
|
|
if (result.looseFiles.length > 0) {
|
|
result.warnings.push(issue(
|
|
'ARCH_LOOSE_FILES',
|
|
`Found ${result.looseFiles.length} unrecognized architecture file(s)`,
|
|
`Architecture contract expects overview.md (+ optional gaps.md). Loose files may indicate format drift in the upstream architect producer.`,
|
|
));
|
|
}
|
|
|
|
if (result.found && result.overview) {
|
|
try {
|
|
const text = readFileSync(result.overview, 'utf-8');
|
|
const firstHeading = text.match(/^#\s+(.+?)\s*$/m);
|
|
result.firstHeading = firstHeading ? firstHeading[1] : null;
|
|
} catch { /* ignore — only sniff */ }
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
if (isMain(import.meta.url)) {
|
|
const projectDir = process.argv[2];
|
|
const wantJson = process.argv.includes('--json');
|
|
if (!projectDir) {
|
|
process.stderr.write('Usage: architecture-discovery.mjs <project-dir> [--json]\n');
|
|
process.exit(2);
|
|
}
|
|
const r = discoverArchitecture(projectDir);
|
|
if (wantJson) {
|
|
process.stdout.write(JSON.stringify(r, null, 2) + '\n');
|
|
} else {
|
|
process.stdout.write(`architecture-discovery: ${r.found ? 'FOUND' : 'NONE'} ${r.overview || projectDir}\n`);
|
|
for (const w of r.warnings) process.stderr.write(` WARN [${w.code}] ${w.message}\n`);
|
|
}
|
|
process.exit(0);
|
|
}
|