Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(ui): keep vitest filters reachable through npm test
cyhf5991f2a6baf
diff --git a/docs/plans/model-hub-usage-metering.md b/docs/plans/model-hub-usage-metering.mdindex 1d7c2650e..2b88628e5 100644--- a/docs/plans/model-hub-usage-metering.md+++ b/docs/plans/model-hub-usage-metering.md@@ -1341,3 +1341,45 @@ IDs, which §4 of the scenario-testing standard has required all along, so a barthe standard not being followed rather than a second legitimate convention. Zero test renames.Coverage went 20 rows / 1 legend-selected catalog → **22 citations across 22 rows**, and thestandard now states the property so the next catalog writes citations that pass.++### Stage 2, round 6 (head `aa051476e`) — a new class: a composite npm script swallows filters++One P2 finding, on a line round 5 introduced, and it is **not** class A — it is the first+appearance of a different class: **a composite npm script forwards `--` arguments only to its+last command.** No breaker trip; a first appearance is a finding, not a pattern.++```+"test": "vitest run && npm run validate:catalog"+npm test -- UsageTab.test.tsx+ → vitest run && npm run validate:catalog UsageTab.test.tsx+```++npm appends the arguments to the *end* of the whole string, so the filter landed on the+validator — which takes no path and ignored it — while vitest ran all 231 files unfiltered.+Both halves still exited 0, so the failure is silent: the focused run AGENTS.md asks for+first quietly becomes a four-minute full suite, and the argument that was supposed to narrow+it is discarded by a command that never wanted it.++The class has exactly one other member in `ui/package.json`, and checking it is what decided+the fix. `"build": "npm run validate:imports && tsc -b && vite build"` is composite too, but+its argument-taking command is **last**, so `npm run build -- --mode=x` reaches `vite build`+by accident rather than by design. A rule of the form "put the arg-taking command last" is a+rule about command order that nothing enforces and the next composite breaks again.++**So the fix deletes the mechanism instead of wrapping it.** `"test"` returns to+`vitest run`, and the gate reaches CI as a vitest case: `checkCatalogs()` is exported from+`validate-scenario-catalog.mjs` with the CLI behind an `import.meta.url` guard, and+`scenarioCatalog.test.mjs` asserts on it. A test case has no argument to misroute, and+`npm test` already means "everything that must hold", so the gate needs no second entry+point in CI to be reached.++Both alternatives the reviewer offered were declined for the same reason. A wrapper script+that parses `--` and forwards to each command keeps the hazard and adds a layer that hides+it. A separate unfiltered CI command re-splits "what must hold" across two callers, which is+how the gate could be forgotten on the next workflow edit — and `build-linux-artifacts`+already runs `npm test`.++What proved it: `npm test -- UsageTab.test.tsx` now runs 1 file / 14 cases, and the gate case+fails with the resolver's own message when `MEMORY-LIST-006`'s citation is rotted to a+nonexistent ID (reverted after checking). Full suite 231 files / 2943 tests, CLI gate 22+citations across 22 rows, `tsc` clean, `eslint` clean, `npm run build` ✓.diff --git a/ui/package.json b/ui/package.jsonindex 17b510680..c6eae7770 100644--- a/ui/package.json+++ b/ui/package.json@@ -14,7 +14,7 @@"lint:report": "eslint .","lint:baseline": "node scripts/lint-baseline.mjs --update","preview": "vite preview",- "test": "vitest run && npm run validate:catalog",+ "test": "vitest run","test:crypto": "vitest run src/lib/vaultCrypto.test.ts","validate:catalog": "node scripts/validate-scenario-catalog.mjs","validate:theme": "node scripts/validate-theme.mjs"diff --git a/ui/scripts/scenarioCatalog.test.mjs b/ui/scripts/scenarioCatalog.test.mjsindex 836446d12..65676e2e9 100644--- a/ui/scripts/scenarioCatalog.test.mjs+++ b/ui/scripts/scenarioCatalog.test.mjs@@ -5,6 +5,7 @@ import path from 'node:path';import { afterAll, describe, expect, it } from 'vitest';import { collectCases, isUiEvidence, resolveUiEvidence, uiEvidenceRows } from './scenarioCatalog.mjs';+import { checkCatalogs, report } from './validate-scenario-catalog.mjs';/** Executable, and so citable as evidence. */const RUNS = 'MH-FIXTURE-RUNS';@@ -173,4 +174,27 @@ describe('UI evidence resolution', () => {});expect(isUiEvidence('tests/test_a.py::test_a')).toBe(false);});++ /**+ * The gate itself, run against the real catalogs rather than a fixture.+ *+ * Here and not chained onto `npm test`, because npm appends `--` arguments to+ * the end of a composite script: `vitest run && npm run validate:catalog` turned+ * `npm test -- UsageTab.test.tsx` into a full unfiltered suite plus a validator+ * ignoring a path, which breaks the focused run this repo asks for first. A test+ * case has no argument to misroute, and `npm test` already means "everything+ * that must hold".+ */+ it(+ 'every UI citation in the checkout names one case this suite collects',+ () => {+ const result = checkCatalogs();+ expect(result.problems, report(result)).toEqual([]);+ // A checkout whose catalogs cite no UI case at all would pass the line+ // above while proving nothing, which is the shape of pass this gate exists+ // to reject.+ expect(result.rows.length).toBeGreaterThan(0);+ },+ 60_000,+ );});diff --git a/ui/scripts/validate-scenario-catalog.mjs b/ui/scripts/validate-scenario-catalog.mjsindex 50f8cb8fd..9301ce077 100644--- a/ui/scripts/validate-scenario-catalog.mjs+++ b/ui/scripts/validate-scenario-catalog.mjs@@ -3,10 +3,20 @@* Gate: every UI citation a scenario catalog makes names exactly one case vitest* collects, in the file the citation points at.*- * This runs from `npm test`, which is the UI suite's own CI step, because that is- * where the collector lives. The Python catalog checker owns everything it can- * answer exactly — the row's shape, its file, and the ID being greppable inside- * that file — and defers executability here rather than approximating it.+ * The check lives here as `checkCatalogs`, and two callers share it: this file's+ * CLI (`npm run validate:catalog`) and one case in `scenarioCatalog.test.mjs`,+ * which is how it reaches CI. It was briefly chained onto `npm test` as+ * `vitest run && npm run validate:catalog` instead, and that is a defect with a+ * quiet cost: npm appends `--` arguments to the *end* of a composite script, so+ * `npm test -- UsageTab.test.tsx` became+ * `vitest run && npm run validate:catalog UsageTab.test.tsx` — vitest ran all 231+ * files unfiltered and the gate silently ignored a path. Forwarding through a+ * wrapper would keep the hazard and hide it; a test case has no argument to+ * misroute, and the suite runner already owns "everything that must hold".+ *+ * The Python catalog checker owns everything it can answer exactly — the row's+ * shape, its file, and the ID being greppable inside that file — and defers+ * executability here rather than approximating it.*/import fs from 'node:fs';@@ -40,7 +50,14 @@ const catalogPaths = () => {.filter((file) => fs.existsSync(file));};-const main = () => {+/**+ * Every citation in the checkout, and what is wrong with it — `problems` empty+ * when each names one collected case.+ *+ * Returns rather than exits so a test can assert on it: the CLI is one caller of+ * this check, not its owner.+ */+export const checkCatalogs = () => {const catalogs = catalogPaths().map((file) => {const catalog = yaml.load(fs.readFileSync(file, 'utf8'));const name = path.relative(REPO_ROOT, file);@@ -52,27 +69,39 @@ const main = () => {};});const rows = catalogs.flatMap((catalog) => catalog.rows);- if (rows.length === 0) {- console.log('scenario catalogs: no row cites a UI case');- return;- }+ if (rows.length === 0) return { rows, problems: [] };const files = [...new Set(rows.map((row) => path.relative(UI_ROOT, path.join(REPO_ROOT, row.file))))];// One collection for every catalog: `list` costs a vitest startup, and the// question each row asks is answered by the same collected set.const collected = collectCases({ files });- const problems = catalogs.flatMap((catalog) => resolveUiEvidence(catalog.rows, collected, catalog.ids));- if (problems.length > 0) {- console.error(`\nScenario-catalog UI citations that do not name a collected vitest case:\n`);- for (const problem of problems) console.error(` - ${problem}`);- console.error('');- process.exitCode = 1;- return;+ return {+ rows,+ problems: catalogs.flatMap((catalog) => resolveUiEvidence(catalog.rows, collected, catalog.ids)),+ };+};++/** How the gate reads for a human, in a terminal or in a CI log. */+export const report = ({ rows, problems }) => {+ if (rows.length === 0) return 'scenario catalogs: no row cites a UI case';+ if (problems.length === 0) {+ return `scenario catalogs: ${rows.length} UI citations across `+ + `${new Set(rows.map((row) => row.id)).size} rows each name one collected vitest case`;}- console.log(- `scenario catalogs: ${rows.length} UI citations across `- + `${new Set(rows.map((row) => row.id)).size} rows each name one collected vitest case`,- );+ return [+ '\nScenario-catalog UI citations that do not name a collected vitest case:\n',+ ...problems.map((problem) => ` - ${problem}`),+ '',+ ].join('\n');};-main();+// Only when run as a command, so importing the check does not execute it.+if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {+ const result = checkCatalogs();+ if (result.problems.length > 0) {+ console.error(report(result));+ process.exitCode = 1;+ } else {+ console.log(report(result));+ }+}