refactor: hard-fork GSD -> MSD (Make Software Done)
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.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* GSD Tools Tests - dedicated temp subdirectory
|
||||
* MSD Tools Tests - dedicated temp subdirectory
|
||||
*
|
||||
* Tests for issue #1975: GSD temp files should use a dedicated
|
||||
* subdirectory (path.join(os.tmpdir(), 'gsd')) instead of writing
|
||||
* Tests for issue #1975: MSD temp files should use a dedicated
|
||||
* subdirectory (path.join(os.tmpdir(), 'msd')) instead of writing
|
||||
* directly to os.tmpdir().
|
||||
*/
|
||||
|
||||
@@ -14,20 +14,20 @@ const os = require('os');
|
||||
|
||||
const {
|
||||
reapStaleTempFiles,
|
||||
} = require('../gsd-core/bin/lib/io.cjs');
|
||||
} = require('../msd-core/bin/lib/io.cjs');
|
||||
|
||||
const GSD_TEMP_DIR = path.join(os.tmpdir(), 'gsd');
|
||||
const MSD_TEMP_DIR = path.join(os.tmpdir(), 'msd');
|
||||
|
||||
// ─── Dedicated temp subdirectory ────────────────────────────────────────────
|
||||
|
||||
describe('dedicated gsd temp subdirectory', () => {
|
||||
describe('dedicated msd temp subdirectory', () => {
|
||||
describe('output() temp file placement', () => {
|
||||
// output() writes to tmpfile when JSON > 50KB. We test indirectly by
|
||||
// checking that reapStaleTempFiles scans the subdirectory.
|
||||
|
||||
test('gsd temp subdirectory path is os.tmpdir()/gsd', () => {
|
||||
// The GSD_TEMP_DIR constant should resolve to <tmpdir>/gsd
|
||||
assert.strictEqual(GSD_TEMP_DIR, path.join(os.tmpdir(), 'gsd'));
|
||||
test('msd temp subdirectory path is os.tmpdir()/msd', () => {
|
||||
// The MSD_TEMP_DIR constant should resolve to <tmpdir>/msd
|
||||
assert.strictEqual(MSD_TEMP_DIR, path.join(os.tmpdir(), 'msd'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -35,47 +35,47 @@ describe('dedicated gsd temp subdirectory', () => {
|
||||
let testPrefix;
|
||||
|
||||
beforeEach(() => {
|
||||
testPrefix = `gsd-tempsub-test-${Date.now()}-`;
|
||||
// Ensure the gsd subdirectory exists for test setup
|
||||
fs.mkdirSync(GSD_TEMP_DIR, { recursive: true });
|
||||
testPrefix = `msd-tempsub-test-${Date.now()}-`;
|
||||
// Ensure the msd subdirectory exists for test setup
|
||||
fs.mkdirSync(MSD_TEMP_DIR, { recursive: true });
|
||||
});
|
||||
|
||||
test('removes stale files from gsd subdirectory', () => {
|
||||
const stalePath = path.join(GSD_TEMP_DIR, `${testPrefix}stale.json`);
|
||||
test('removes stale files from msd subdirectory', () => {
|
||||
const stalePath = path.join(MSD_TEMP_DIR, `${testPrefix}stale.json`);
|
||||
fs.writeFileSync(stalePath, '{}');
|
||||
const oldTime = new Date(Date.now() - 10 * 60 * 1000);
|
||||
fs.utimesSync(stalePath, oldTime, oldTime);
|
||||
|
||||
reapStaleTempFiles(testPrefix, { maxAgeMs: 5 * 60 * 1000 });
|
||||
|
||||
assert.ok(!fs.existsSync(stalePath), 'stale file in gsd subdir should be removed');
|
||||
assert.ok(!fs.existsSync(stalePath), 'stale file in msd subdir should be removed');
|
||||
});
|
||||
|
||||
test('preserves fresh files in gsd subdirectory', () => {
|
||||
const freshPath = path.join(GSD_TEMP_DIR, `${testPrefix}fresh.json`);
|
||||
test('preserves fresh files in msd subdirectory', () => {
|
||||
const freshPath = path.join(MSD_TEMP_DIR, `${testPrefix}fresh.json`);
|
||||
fs.writeFileSync(freshPath, '{}');
|
||||
|
||||
reapStaleTempFiles(testPrefix, { maxAgeMs: 5 * 60 * 1000 });
|
||||
|
||||
assert.ok(fs.existsSync(freshPath), 'fresh file in gsd subdir should be preserved');
|
||||
assert.ok(fs.existsSync(freshPath), 'fresh file in msd subdir should be preserved');
|
||||
// Clean up
|
||||
fs.unlinkSync(freshPath);
|
||||
});
|
||||
|
||||
test('removes stale directories from gsd subdirectory', () => {
|
||||
const staleDir = path.join(GSD_TEMP_DIR, `${testPrefix}dir`);
|
||||
test('removes stale directories from msd subdirectory', () => {
|
||||
const staleDir = path.join(MSD_TEMP_DIR, `${testPrefix}dir`);
|
||||
fs.mkdirSync(staleDir, { recursive: true });
|
||||
const oldTime = new Date(Date.now() - 10 * 60 * 1000);
|
||||
fs.utimesSync(staleDir, oldTime, oldTime);
|
||||
|
||||
reapStaleTempFiles(testPrefix, { maxAgeMs: 5 * 60 * 1000 });
|
||||
|
||||
assert.ok(!fs.existsSync(staleDir), 'stale directory in gsd subdir should be removed');
|
||||
assert.ok(!fs.existsSync(staleDir), 'stale directory in msd subdir should be removed');
|
||||
});
|
||||
|
||||
test('creates gsd subdirectory if it does not exist', () => {
|
||||
test('creates msd subdirectory if it does not exist', () => {
|
||||
// Use a unique nested path to avoid interfering with other tests
|
||||
const uniqueSubdir = path.join(os.tmpdir(), `gsd-creation-test-${Date.now()}`);
|
||||
const uniqueSubdir = path.join(os.tmpdir(), `msd-creation-test-${Date.now()}`);
|
||||
|
||||
// Verify it does not exist
|
||||
if (fs.existsSync(uniqueSubdir)) {
|
||||
@@ -87,11 +87,11 @@ describe('dedicated gsd temp subdirectory', () => {
|
||||
// reapStaleTempFiles should not throw even if subdir does not exist
|
||||
// (it gets created or handled gracefully)
|
||||
assert.doesNotThrow(() => {
|
||||
reapStaleTempFiles(`gsd-creation-test-${Date.now()}-`, { maxAgeMs: 0 });
|
||||
reapStaleTempFiles(`msd-creation-test-${Date.now()}-`, { maxAgeMs: 0 });
|
||||
});
|
||||
});
|
||||
|
||||
test('does not scan system tmpdir root for gsd- files', () => {
|
||||
test('does not scan system tmpdir root for msd- files', () => {
|
||||
// Place a stale file in the OLD location (system tmpdir root)
|
||||
const oldLocationPath = path.join(os.tmpdir(), `${testPrefix}old-location.json`);
|
||||
fs.writeFileSync(oldLocationPath, '{}');
|
||||
@@ -99,7 +99,7 @@ describe('dedicated gsd temp subdirectory', () => {
|
||||
fs.utimesSync(oldLocationPath, oldTime, oldTime);
|
||||
|
||||
// reapStaleTempFiles should NOT remove files from the old location
|
||||
// because it now only scans the gsd subdirectory
|
||||
// because it now only scans the msd subdirectory
|
||||
reapStaleTempFiles(testPrefix, { maxAgeMs: 5 * 60 * 1000 });
|
||||
|
||||
// The file in the old location should still exist (not scanned)
|
||||
@@ -121,7 +121,7 @@ describe('dedicated gsd temp subdirectory', () => {
|
||||
|
||||
// The legacy reap function should still clean old-location files
|
||||
// We import it if exported, or verify the main reap handles both
|
||||
const ioModule = require('../gsd-core/bin/lib/io.cjs');
|
||||
const ioModule = require('../msd-core/bin/lib/io.cjs');
|
||||
if (typeof ioModule.reapStaleTempFilesLegacy === 'function') {
|
||||
ioModule.reapStaleTempFilesLegacy(testPrefix, { maxAgeMs: 5 * 60 * 1000 });
|
||||
assert.ok(!fs.existsSync(oldLocationPath), 'legacy reap should clean old location');
|
||||
|
||||
Reference in New Issue
Block a user