* fix(#505): remove dead SDK-shim verification subsystem from bin/install.js Post-ADR-0174 the @opengsd/gsd-sdk package was retired; sdk/ no longer ships. installSdkIfNeeded had no callers in the live install flow and its entire transitive call graph (classifySdkInstall, buildSdkFailFastReport, renderSdkFailFastReport, buildGsdSdkVersionMismatchReport, readGsdSdkVersion, parseGsdSdkVersion, findGsdSdkOnPath, isGsdSdkOnPath, isLegacyGsdSdkShim, filterNpxFromPath, getUserShellPath, getUserShellWindowsPersistentPath, trySelfLinkGsdSdk, trySelfLinkGsdSdkWindows, buildWindowsShimTriple, formatSdkPathDiagnostic, renderGsdSdkVersionMismatchReport) was dead code. Also removed two now-empty test files (no-unconditional-win32-skip.test.cjs, bug-3020-install-shell-path-probe.test.cjs) that exercised the removed functions, and added a regression guard (bug-505-remove-dead-sdk-verification.test.cjs). detectStaleStandaloneSdk and formatStaleStandaloneSdkWarning are deliberately KEPT — they handle a real leftover-global-SDK condition (#3406). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * chore: add changeset for #505 dead SDK-shim removal Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#505): restore buildWindowsShimTriple/formatSdkPathDiagnostic projection surfaces The dead-code removal also deleted buildWindowsShimTriple and formatSdkPathDiagnostic (plus their imports/exports). These have no production caller, but they are the install.js side of a projection-contract drift guard: tests/bug-3441 and tests/bug-3442 assert install.js delegates to shell-command-projection.cjs rather than hand-rolling the projection. Removing them broke those tests (TypeError: ... is not a function) — surfaced by the full/coverage CI matrix, which runs suites the local scoped run skipped. Restore the two thin wrappers, their `*FromProjection` import aliases, and their exports. Update the bug-505 guard test to assert they remain exported as contract surfaces (moved out of the dead-symbol list). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
87 lines
3.2 KiB
JavaScript
87 lines
3.2 KiB
JavaScript
/**
|
|
* Regression guard for #505: dead SDK-shim verification subsystem removed.
|
|
*
|
|
* Post-ADR-0174 the `@opengsd/gsd-sdk` package was retired; `sdk/` no longer
|
|
* ships. `installSdkIfNeeded` and all functions it transitively called are
|
|
* dead code with no live callers. This test asserts:
|
|
*
|
|
* 1. All removed symbols are NO LONGER exported from bin/install.js.
|
|
* 2. The two live stale-standalone-SDK helpers (detectStaleStandaloneSdk,
|
|
* formatStaleStandaloneSdkWarning) are STILL exported as functions — they
|
|
* handle a real user-facing condition (#3406) and MUST NOT be removed.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
process.env.GSD_TEST_MODE = '1';
|
|
|
|
const { describe, test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
|
|
const inst = require('../bin/install.js');
|
|
|
|
describe('bug #505: dead SDK verification subsystem removed from bin/install.js', () => {
|
|
// ----------------------------------------------------------------
|
|
// Dead symbols — must NOT be exported after removal
|
|
// ----------------------------------------------------------------
|
|
const deadSymbols = [
|
|
'installSdkIfNeeded',
|
|
'classifySdkInstall',
|
|
'buildSdkFailFastReport',
|
|
'renderSdkFailFastReport',
|
|
'buildGsdSdkVersionMismatchReport',
|
|
'renderGsdSdkVersionMismatchReport',
|
|
'readGsdSdkVersion',
|
|
'parseGsdSdkVersion',
|
|
'findGsdSdkOnPath',
|
|
'isGsdSdkOnPath',
|
|
'isLegacyGsdSdkShim',
|
|
'trySelfLinkGsdSdk',
|
|
'trySelfLinkGsdSdkWindows',
|
|
'filterNpxFromPath',
|
|
'getUserShellPath',
|
|
'getUserShellWindowsPersistentPath',
|
|
];
|
|
|
|
for (const sym of deadSymbols) {
|
|
test(`dead symbol '${sym}' is not exported`, () => {
|
|
assert.equal(
|
|
typeof inst[sym],
|
|
'undefined',
|
|
`'${sym}' should have been removed (post #505 dead-code removal) but is still exported as ${typeof inst[sym]}`,
|
|
);
|
|
});
|
|
}
|
|
|
|
// ----------------------------------------------------------------
|
|
// Live symbols — MUST still be exported as functions
|
|
// ----------------------------------------------------------------
|
|
test('live function detectStaleStandaloneSdk is still exported', () => {
|
|
assert.equal(
|
|
typeof inst.detectStaleStandaloneSdk,
|
|
'function',
|
|
'detectStaleStandaloneSdk handles real stale-SDK condition (#3406) and must not be removed',
|
|
);
|
|
});
|
|
|
|
test('live function formatStaleStandaloneSdkWarning is still exported', () => {
|
|
assert.equal(
|
|
typeof inst.formatStaleStandaloneSdkWarning,
|
|
'function',
|
|
'formatStaleStandaloneSdkWarning handles real stale-SDK condition (#3406) and must not be removed',
|
|
);
|
|
});
|
|
|
|
// buildWindowsShimTriple / formatSdkPathDiagnostic have no production caller
|
|
// after this removal, but they are the install.js side of a projection-contract
|
|
// drift guard (tests/bug-3441, tests/bug-3442) that assert install.js delegates
|
|
// to shell-command-projection.cjs. They are deliberately kept exported.
|
|
test('contract surface buildWindowsShimTriple is still exported', () => {
|
|
assert.equal(typeof inst.buildWindowsShimTriple, 'function');
|
|
});
|
|
|
|
test('contract surface formatSdkPathDiagnostic is still exported', () => {
|
|
assert.equal(typeof inst.formatSdkPathDiagnostic, 'function');
|
|
});
|
|
});
|