Files
msd-core/tests/mempalace-capture-gate-default.test.cjs
Tom Boucher 4df6d884b3 fix(#2641): treat absent capture_artifacts as enabled (schema default) (#2982)
* test(#2641): add regression for mempalace-capture gate default inversion

* fix(#2641): treat absent capture_artifacts as enabled (schema default)

The gate used `capture_artifacts !== true` which treated absent (undefined)
as disabled — inverted from the capability registry's declared default of
true. Changed to `capture_artifacts === false` (disabled only on explicit
false), matching the sibling gsd-mempalace-recall skill's correct pattern.

* chore(#2641): add changeset fragment

* chore(#2641): backfill changeset PR number 2982

---------

Co-authored-by: sim <sim@local>
2026-08-01 15:23:58 -04:00

43 lines
1.8 KiB
JavaScript

// allow-test-rule: source-text-is-the-product (see #2641)
// The mempalace-capture skill gates on config.mempalace.capture_artifacts.
// The capability registry declares this key with default: true, so an absent
// key must be treated as enabled. The skill previously used `!== true` which
// treated absent (undefined) as disabled — inverted from the schema default.
// The fix changes it to `=== false` (disabled only on explicit false).
'use strict';
const { describe, test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const SKILL = path.join(__dirname, '..', 'skills', 'gsd-mempalace-capture', 'SKILL.md');
const COMMAND = path.join(__dirname, '..', 'commands', 'gsd', 'mempalace-capture.md');
describe('#2641 — mempalace-capture gate treats absent capture_artifacts as enabled', () => {
test('SKILL.md uses === false (disabled only on explicit false), not !== true', () => {
const text = fs.readFileSync(SKILL, 'utf8');
assert.ok(
text.includes('capture_artifacts === false'),
'SKILL.md must use capture_artifacts === false (defaults to enabled when absent, matching the schema) — not !== true (#2641)',
);
assert.ok(
!text.includes('capture_artifacts !== true'),
'SKILL.md must NOT use the inverted capture_artifacts !== true check (#2641)',
);
});
test('commands/gsd/mempalace-capture.md uses === false, not !== true', () => {
const text = fs.readFileSync(COMMAND, 'utf8');
assert.ok(
text.includes('capture_artifacts === false'),
'commands/gsd/mempalace-capture.md must use capture_artifacts === false (#2641)',
);
assert.ok(
!text.includes('capture_artifacts !== true'),
'commands/gsd/mempalace-capture.md must NOT use the inverted check (#2641)',
);
});
});