Files
msd-core/tests/no-cjs-sdk-handsync-tooling.test.cjs
Tom Boucher 9b5ee37364 chore(#556): retire orphaned CJS↔SDK hand-sync tooling (#559)
The @opengsd/gsd-sdk package boundary was retired (ADR-0174, #191/#192) and
the sdk/ tree is no longer tracked. ADR-0174's Supersedes table explicitly
records that the generator-based Shared-Module hand-sync lint is deleted as
part of that collapse. This removes the now-orphaned machinery it left behind:

- scripts/lint-shared-module-handsync.cjs — paired bin/lib/*.cjs files with
  sdk/src/**/*.ts sources that no longer exist; wired into no CI workflow or
  npm script (dead).
- scripts/shared-module-handsync-allowlist.json — the lint's allowlist; every
  entry pointed at a non-existent sdk/src source / generated artifact /
  freshness check.
- tests/lint-shared-module-handsync.test.cjs — tested the deleted lint.

Docs corrected to match:
- CONTRIBUTING.md — removed the "CJS↔SDK seam" instruction (it linked the
  already-deleted docs/agents/cjs-sdk-seam.md and told contributors to
  maintain the allowlist under a retired generator pattern).
- docs/prd/3524-cjs-sdk-hard-seam.md + docs/prd/README.md — marked the PRD
  Superseded by ADR-0174, matching the already-superseded ADR-3524.

Added tests/no-cjs-sdk-handsync-tooling.test.cjs as a regression guard so the
retired tooling stays removed and is not silently re-wired into package.json.

ADR-3524 is left in place (already Superseded by ADR-0174); runtime modules and
regression tests that cite it in comments keep resolving. No user-facing change.

Closes #556

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 20:28:57 -04:00

54 lines
2.3 KiB
JavaScript

// allow-test-rule: architectural-invariant
// Guards a removal mandated by ADR-0174 (retire @opengsd/gsd-sdk package
// boundary), which explicitly deletes the generator-based CJS↔SDK hand-sync
// tooling. These assertions check repo structure (file absence, package.json
// wiring) — they are not source-text inspection of any .cjs module — and exist
// to prevent silent re-introduction of the retired seam tooling.
/**
* Regression guard for issue #556 — retire orphaned CJS↔SDK hand-sync tooling.
*
* The @opengsd/gsd-sdk package boundary was retired (ADR-0174, #191/#192) and
* the `sdk/` tree is no longer tracked. The generator-based hand-sync lint that
* policed CJS-vs-SDK TypeScript drift is therefore dead infrastructure: it
* referenced an `sdk/src` tree that no longer exists and was wired into no CI
* workflow or npm script. This guard asserts it stays removed.
*/
const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const REPO_ROOT = path.join(__dirname, '..');
describe('retired CJS↔SDK hand-sync tooling (#556 / ADR-0174)', () => {
test('the hand-sync pair lint script is absent', () => {
const lintScript = path.join(REPO_ROOT, 'scripts', 'lint-shared-module-handsync.cjs');
assert.ok(
!fs.existsSync(lintScript),
'scripts/lint-shared-module-handsync.cjs should be removed — the CJS↔SDK seam it policed was retired by ADR-0174',
);
});
test('the hand-sync allowlist is absent', () => {
const allowlist = path.join(REPO_ROOT, 'scripts', 'shared-module-handsync-allowlist.json');
assert.ok(
!fs.existsSync(allowlist),
'scripts/shared-module-handsync-allowlist.json should be removed — it paired bin/lib/*.cjs files with sdk/src sources that no longer exist',
);
});
test('no npm script re-wires the retired hand-sync lint', () => {
const pkg = JSON.parse(fs.readFileSync(path.join(REPO_ROOT, 'package.json'), 'utf8'));
const offenders = Object.entries(pkg.scripts || {})
.filter(([, cmd]) => cmd.includes('lint-shared-module-handsync'))
.map(([name]) => name);
assert.deepEqual(
offenders,
[],
`package.json scripts must not invoke the retired hand-sync lint; found: ${offenders.join(', ')}`,
);
});
});