test(#2665): reversion guards for all three round-4 fixes
None of the round-4 fixes had a test that fails on reversion: re-shipping the test-instrumentation chain passes #2858 (everything ships, so every require resolves), dropping the strict env from test.yml demotes the guard to report-only with nothing red, and the skillsHome derivation tests are enumeration-relative over declarations that are all empty today. One guard each, every one negative-controlled against its reverted fix (fails pre-fix, passes post-fix): - packaging-shipped-scripts-require-only-shipped.test.cjs asserts the four chain files are absent from the npm pack file list (reuses the tarball set the #2858 gate already resolves — no second npm pack). - live-config-guard.test.cjs asserts all three test jobs wire GSD_STRICT_LIVE_CONFIG_GUARD, matching the WHOLE expression anchored — a prefix match accepted both a Windows-silently-strict tail and a malformed one. - helpers-process-isolation.test.cjs cold-requires helpers.cjs in a child with sentinel skillsHome env vars injected into both enumerations, so the walk itself is under test rather than today's empty declarations.
This commit is contained in:
@@ -410,3 +410,40 @@ describe('#2665: scan-budget truncation', () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('#2665 round 4: CI wires the guard to strict mode', () => {
|
||||
// The reversion this guards: dropping GSD_STRICT_LIVE_CONFIG_GUARD from
|
||||
// test.yml silently demotes the guard back to report-only, and a future
|
||||
// leak of exactly the class #2665 closes prints a warning and CI stays
|
||||
// green. Windows lanes are deliberately report-only until the documented
|
||||
// pre-existing USERPROFILE leak class is swept (SEVERITY note in
|
||||
// scripts/live-config-guard.cjs) — so the assertion is per-OS, not global.
|
||||
test('all three test jobs set GSD_STRICT_LIVE_CONFIG_GUARD (Windows carved out)', () => {
|
||||
const yaml = require('js-yaml');
|
||||
const wf = yaml.load(
|
||||
fs.readFileSync(
|
||||
path.join(__dirname, '..', '.github', 'workflows', 'test.yml'),
|
||||
'utf8',
|
||||
),
|
||||
);
|
||||
|
||||
for (const job of ['test', 'test-full']) {
|
||||
const v = String(wf.jobs?.[job]?.env?.GSD_STRICT_LIVE_CONFIG_GUARD ?? '');
|
||||
assert.match(
|
||||
v,
|
||||
// The WHOLE expression, anchored — a prefix match accepted both
|
||||
// `&& '1' || '1'` (Windows silently strict) and a malformed tail
|
||||
// (found by this round's pre-push adversarial review).
|
||||
/^\$\{\{\s*matrix\.os\s*!=\s*'windows-latest'\s*&&\s*'1'\s*\|\|\s*''\s*\}\}$/,
|
||||
`jobs.${job}.env.GSD_STRICT_LIVE_CONFIG_GUARD must be strict on ` +
|
||||
`non-Windows lanes and empty on windows-latest; got: ${JSON.stringify(v)}`,
|
||||
);
|
||||
}
|
||||
|
||||
assert.strictEqual(
|
||||
String(wf.jobs?.['test-inert']?.env?.GSD_STRICT_LIVE_CONFIG_GUARD ?? ''),
|
||||
'1',
|
||||
'jobs.test-inert (ubuntu-only) must set GSD_STRICT_LIVE_CONFIG_GUARD: 1',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user