chore(#2453): resolve the uniform-router-param conflict and clear the warning floor (#2489)

npx eslint . reported 0 errors, 53 warnings. The floor eroded the signal: a
genuinely new warning had to be spotted against noise, so 'lint is clean' was not
usable as a check. This takes it to zero.

Fifty of the 53 were one category in gsd-core/bin/gsd-tools.cjs — all unused
ARGUMENTS (error x30, cwd x10, raw x7, args x3), never unused variables. They are
the Command Routing Hub's uniform handler signature, function routeX({ args, cwd,
raw, error }), declared identically whether or not a handler uses all four
members. argsIgnorePattern: '^_' is structurally in conflict with that convention:
satisfying it would mean _-prefixing ~50 parameters and making the signature
non-uniform across the table. Option 1 of #2453: disable args checking for that
file only, keeping varsIgnorePattern intact so genuinely dead variables (the #2379
class) still surface — verified by injecting an unused variable, which still warns.

This is the config decision #732 explicitly deferred ('Severities stay warn (no
config change in this pass)').

The remaining three predate the issue's count of 51 and are real defects, not
suppressions:

- tests/workflow-compat.test.cjs — the step-9 lookahead used (?=\*\*10\.|\z).
  \z is a Perl/Ruby end-of-input anchor with NO meaning in JavaScript; it matched
  a literal 'z', so the lazy span silently stopped at the first z whenever **10.
  was absent, truncating the captured step and letting the assertion pass against
  a partial block. Corrected to $.
- tests/debugger-prevention.test.cjs — an unused RegExp built one line above the
  one actually used. Removed.
- tests/installer-migrations.test.cjs — try/finally inside a test body, which
  CONTRIBUTING prohibits ('verbose, masks test failures, not an approved
  pattern'); the unused t was the symptom. Converted to t.after().

Closes #2453

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-07-21 18:38:51 -04:00
committed by GitHub
parent 360b3ebc5a
commit c19d3d7bda
4 changed files with 59 additions and 29 deletions

View File

@@ -2654,36 +2654,34 @@ describe('migration.plan()', () => {
test('a regular managed file is still backed up by content (no behavior change)', (t) => {
const configDir = createTempInstall();
try {
writeFile(configDir, 'extensions/gsd.cjs', 'locally patched extension\n');
writeManifest(configDir, { 'extensions/gsd.cjs': sha256('the original extension\n') });
t.after(() => cleanup(configDir));
const result = runInstallerMigrations({
configDir,
runtime: 'pi',
scope: 'global',
migrations: [piExtensionMigration],
now: () => '2026-07-20T00:00:00.000Z',
});
writeFile(configDir, 'extensions/gsd.cjs', 'locally patched extension\n');
writeManifest(configDir, { 'extensions/gsd.cjs': sha256('the original extension\n') });
const backupAction = result.plan.actions.find((a) => a.type === 'backup-and-remove');
assert.ok(backupAction, 'expected backup-and-remove for the locally patched file');
const result = runInstallerMigrations({
configDir,
runtime: 'pi',
scope: 'global',
migrations: [piExtensionMigration],
now: () => '2026-07-20T00:00:00.000Z',
});
// The PLAN carries backupRelPath: null — the concrete backup location is
// chosen during apply and recorded in the journal, so read it from there.
const journal = JSON.parse(fs.readFileSync(path.join(configDir, result.journalRelPath), 'utf8'));
const journalled = journal.actions.find((a) => a.backupRelPath);
assert.ok(journalled, 'apply must record the backup path in the journal for the user');
const backupPath = path.join(configDir, journalled.backupRelPath);
assert.equal(
fs.readFileSync(backupPath, 'utf8'),
'locally patched extension\n',
'a real file must still be backed up by content so the user can recover it',
);
assert.ok(!fs.existsSync(path.join(configDir, 'extensions', 'gsd.cjs')));
} finally {
cleanup(configDir);
}
const backupAction = result.plan.actions.find((a) => a.type === 'backup-and-remove');
assert.ok(backupAction, 'expected backup-and-remove for the locally patched file');
// The PLAN carries backupRelPath: null — the concrete backup location is
// chosen during apply and recorded in the journal, so read it from there.
const journal = JSON.parse(fs.readFileSync(path.join(configDir, result.journalRelPath), 'utf8'));
const journalled = journal.actions.find((a) => a.backupRelPath);
assert.ok(journalled, 'apply must record the backup path in the journal for the user');
const backupPath = path.join(configDir, journalled.backupRelPath);
assert.equal(
fs.readFileSync(backupPath, 'utf8'),
'locally patched extension\n',
'a real file must still be backed up by content so the user can recover it',
);
assert.ok(!fs.existsSync(path.join(configDir, 'extensions', 'gsd.cjs')));
});
// In-flight failure recovery: when a later step of the SAME apply() attempt