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:
@@ -4,7 +4,7 @@
|
||||
* Tests for arg redaction policy (issue #177).
|
||||
*
|
||||
* Redaction decides whether args appear in emitted events based on
|
||||
* the GSD_AUDIT_ARGS env var. Tests use real env manipulation and
|
||||
* the MSD_AUDIT_ARGS env var. Tests use real env manipulation and
|
||||
* restore state in afterEach. No mocks.
|
||||
*/
|
||||
|
||||
@@ -14,48 +14,48 @@ const assert = require('node:assert/strict');
|
||||
const {
|
||||
shouldIncludeArgs,
|
||||
redactEvent,
|
||||
} = require('../../gsd-core/bin/lib/observability/redaction.cjs');
|
||||
} = require('../../msd-core/bin/lib/observability/redaction.cjs');
|
||||
|
||||
describe('shouldIncludeArgs', () => {
|
||||
let originalEnv;
|
||||
|
||||
beforeEach(() => {
|
||||
originalEnv = process.env.GSD_AUDIT_ARGS;
|
||||
delete process.env.GSD_AUDIT_ARGS;
|
||||
originalEnv = process.env.MSD_AUDIT_ARGS;
|
||||
delete process.env.MSD_AUDIT_ARGS;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (originalEnv === undefined) {
|
||||
delete process.env.GSD_AUDIT_ARGS;
|
||||
delete process.env.MSD_AUDIT_ARGS;
|
||||
} else {
|
||||
process.env.GSD_AUDIT_ARGS = originalEnv;
|
||||
process.env.MSD_AUDIT_ARGS = originalEnv;
|
||||
}
|
||||
});
|
||||
|
||||
test('returns false when GSD_AUDIT_ARGS is not set', () => {
|
||||
test('returns false when MSD_AUDIT_ARGS is not set', () => {
|
||||
assert.strictEqual(shouldIncludeArgs(), false);
|
||||
});
|
||||
|
||||
test('returns false when GSD_AUDIT_ARGS is empty string', () => {
|
||||
process.env.GSD_AUDIT_ARGS = '';
|
||||
test('returns false when MSD_AUDIT_ARGS is empty string', () => {
|
||||
process.env.MSD_AUDIT_ARGS = '';
|
||||
assert.strictEqual(shouldIncludeArgs(), false);
|
||||
});
|
||||
|
||||
test('returns false when GSD_AUDIT_ARGS is "0"', () => {
|
||||
process.env.GSD_AUDIT_ARGS = '0';
|
||||
test('returns false when MSD_AUDIT_ARGS is "0"', () => {
|
||||
process.env.MSD_AUDIT_ARGS = '0';
|
||||
assert.strictEqual(shouldIncludeArgs(), false);
|
||||
});
|
||||
|
||||
test('returns true when GSD_AUDIT_ARGS is "1"', () => {
|
||||
process.env.GSD_AUDIT_ARGS = '1';
|
||||
test('returns true when MSD_AUDIT_ARGS is "1"', () => {
|
||||
process.env.MSD_AUDIT_ARGS = '1';
|
||||
assert.strictEqual(shouldIncludeArgs(), true);
|
||||
});
|
||||
|
||||
test('returns false for any other non-1 value', () => {
|
||||
process.env.GSD_AUDIT_ARGS = 'yes';
|
||||
process.env.MSD_AUDIT_ARGS = 'yes';
|
||||
assert.strictEqual(shouldIncludeArgs(), false);
|
||||
|
||||
process.env.GSD_AUDIT_ARGS = 'true';
|
||||
process.env.MSD_AUDIT_ARGS = 'true';
|
||||
assert.strictEqual(shouldIncludeArgs(), false);
|
||||
});
|
||||
});
|
||||
@@ -64,19 +64,19 @@ describe('redactEvent', () => {
|
||||
let originalEnv;
|
||||
|
||||
beforeEach(() => {
|
||||
originalEnv = process.env.GSD_AUDIT_ARGS;
|
||||
delete process.env.GSD_AUDIT_ARGS;
|
||||
originalEnv = process.env.MSD_AUDIT_ARGS;
|
||||
delete process.env.MSD_AUDIT_ARGS;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (originalEnv === undefined) {
|
||||
delete process.env.GSD_AUDIT_ARGS;
|
||||
delete process.env.MSD_AUDIT_ARGS;
|
||||
} else {
|
||||
process.env.GSD_AUDIT_ARGS = originalEnv;
|
||||
process.env.MSD_AUDIT_ARGS = originalEnv;
|
||||
}
|
||||
});
|
||||
|
||||
test('strips args from event when GSD_AUDIT_ARGS is not set', () => {
|
||||
test('strips args from event when MSD_AUDIT_ARGS is not set', () => {
|
||||
const event = Object.freeze({
|
||||
traceId: 'abc',
|
||||
command: 'plan',
|
||||
@@ -106,8 +106,8 @@ describe('redactEvent', () => {
|
||||
assert.deepStrictEqual(redacted.result, { kind: 'HandlerRefusal', reason: 'nope' });
|
||||
});
|
||||
|
||||
test('includes args when GSD_AUDIT_ARGS=1', () => {
|
||||
process.env.GSD_AUDIT_ARGS = '1';
|
||||
test('includes args when MSD_AUDIT_ARGS=1', () => {
|
||||
process.env.MSD_AUDIT_ARGS = '1';
|
||||
const event = Object.freeze({
|
||||
traceId: 'abc',
|
||||
command: 'plan',
|
||||
@@ -116,7 +116,7 @@ describe('redactEvent', () => {
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
const redacted = redactEvent(event);
|
||||
assert.ok('args' in redacted, 'args must be present when GSD_AUDIT_ARGS=1');
|
||||
assert.ok('args' in redacted, 'args must be present when MSD_AUDIT_ARGS=1');
|
||||
assert.deepStrictEqual(redacted.args, ['--foo', 'bar']);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user