Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD across contents and paths, upstream package/repo coordinates -> @golem15/msd-core and golem15com/msd-core. Deep links into upstream history, sibling upstream packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is. Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line, package/plugin identity, regenerated lockfile, install-tree fixtures, derived registries and benchmark baseline; migration checksum baseline re-locked (MSD keeps its own install state, so no install had applied the old sums); sort-order and regex-escaped expectations in tests adjusted.
59 lines
3.0 KiB
JavaScript
59 lines
3.0 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* tests/agent-skills-compact-variant.test.cjs — ADR-4139, epic #4139, Phase 7 (#4407).
|
|
*
|
|
* `agents/*.compact.md` is a THIRD shape layered onto the variant-swap mechanism Phase 6
|
|
* built (`tests/helpers/compact-content-variant.cjs`): registration, protected-content and
|
|
* size checks apply unchanged, but reachability does not, because an agent variant is
|
|
* selected by a generic, config-driven code construction inside `cmdAgentSkills`
|
|
* (`src/init.cts`'s `#2454` fallback), not by a literal path named in workflow prose. See
|
|
* that helper's module docstring and the `AGENTS_ROOT` constant for why this file does not
|
|
* call `checkReachability`.
|
|
*
|
|
* That code seam is not a per-file property (there is no per-file literal path to search
|
|
* markdown for — one generic construction in `cmdAgentSkills` serves every registered pair),
|
|
* so it is not checked here as a source-shape assertion. It is proven the way this repo
|
|
* requires (`local/no-source-grep`, "behavioral tests are required") by
|
|
* `tests/agent-skills.test.cjs`'s "#4407 compact payload selection" describe block, which
|
|
* actually spawns `msd_run agent-skills` against a real compact/canonical pair and asserts
|
|
* on the served payload — a test that can only pass if the seam genuinely reads and returns
|
|
* the compact file, which is a stronger guarantee than a string search over source text.
|
|
*/
|
|
|
|
const { describe, test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
|
|
const {
|
|
AGENTS_ROOT,
|
|
discoverRegisteredVariants,
|
|
checkRegistration,
|
|
checkProtectedContentPreserved,
|
|
checkSizeSmaller,
|
|
} = require('./helpers/compact-content-variant.cjs');
|
|
|
|
describe('agent-skills compact variant guard — real repo state (ADR-4139, Phase 7 #4407)', () => {
|
|
test('check 1 (registration): every agents/*.compact.md file has a canonical sibling', () => {
|
|
const pairs = discoverRegisteredVariants([AGENTS_ROOT]);
|
|
const violations = checkRegistration(pairs);
|
|
assert.deepStrictEqual(violations, [], `registration violations: ${JSON.stringify(violations, null, 2)}`);
|
|
});
|
|
|
|
test('check 3 (protected content preserved): a canonical agent file\'s msd:protected blocks, if any, survive in its compact sibling', () => {
|
|
const pairs = discoverRegisteredVariants([AGENTS_ROOT]);
|
|
const violations = checkProtectedContentPreserved(pairs);
|
|
assert.deepStrictEqual(violations, [], `protected-content violations: ${JSON.stringify(violations, null, 2)}`);
|
|
});
|
|
|
|
test('check 4 (size smaller): every compact agent file is strictly smaller than its canonical sibling', () => {
|
|
const pairs = discoverRegisteredVariants([AGENTS_ROOT]);
|
|
const violations = checkSizeSmaller(pairs);
|
|
assert.deepStrictEqual(violations, [], `size violations: ${JSON.stringify(violations, null, 2)}`);
|
|
});
|
|
|
|
test('every discovered pair is discoverable at all (non-vacuous guard)', () => {
|
|
const pairs = discoverRegisteredVariants([AGENTS_ROOT]);
|
|
assert.ok(pairs.length > 0, 'expected at least one agents/*.compact.md pair — a guard with nothing to check is not yet a guard');
|
|
});
|
|
});
|