Batch 12 of the ad hoc timeout literal migration (epic #4445). Replaces every bare numeric timeout/timeoutMs object-literal property in tests/check-env.test.cjs, tests/config-get-default.test.cjs, tests/federated-config.test.cjs, tests/gsd-check-update-worker-platform-gate.test.cjs, tests/gsd-mcp-server-bin.test.cjs, tests/health-validation.test.cjs, tests/locking-bugs-1909-1916-1925-1927.test.cjs, tests/perf-316-state-lock-buffer-alloc.test.cjs, tests/perf-317-context-monitor-fs.test.cjs, and tests/pi-config-dir-env-override.test.cjs with a named constant, per eslint-rules/no-adhoc-timeout-literal.cjs. Removes these 10 files from the rule's allowlist. Ground truth via eslint matched the issue's stated 26 sites across 10 files exactly. Reuses PROBE_TIMEOUT_MS, GENERATOR_SCRIPT_TIMEOUT_MS, GSD_TOOLS_CLI_MODERATE_TIMEOUT_MS, and INSTALL_TIMEOUT_MS across 4 files. No new shared constants needed -- every recurring value across files was independently verified to be a genuinely different operation class, per this migration's standing rule that numeric coincidence is never identity. Adds 11 new file-local constants, three of which are not real subprocess timeouts at all (a config-merge fixture value, and two node:test per-test timeout options bounding ReDoS/lock-retry regression backstops). Per the issue's explicit mandate, gsd-check-update-worker-platform-gate.test.cjs now imports (read-only) NPM_VIEW_TIMEOUT_MS from gsd-core/bin/check-latest-version.cjs for disclosure -- this file and that production module once independently guessed the same 15000ms value, causing the PR #4428 Windows double-SIGKILL collision. No site in this file's current bare literals actually wraps a live npm-view call needing margin arithmetic, so the import documents the historical relationship honestly rather than fabricating a computation. No src/bin file edited (only a read-only import added), no numeric value changed anywhere. Co-authored-by: sim <sim@local> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,17 @@ const { cleanup } = require('./helpers.cjs');
|
||||
// Constants
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* NOT a subprocess spawn timeout. This is `node:test`'s own per-test
|
||||
* `{ timeout }` option (the second positional argument to `test(name,
|
||||
* options, fn)`), bounding a worker_threads + SharedArrayBuffer
|
||||
* lock-contention regression test (sabCount retry assertion). Coincides
|
||||
* numerically with tests/helpers/timeouts.cjs's PROBE_TIMEOUT_MS but is a
|
||||
* completely different mechanism (a node:test option, not a subprocess
|
||||
* spawn bound) -- disclosed, not merged.
|
||||
*/
|
||||
const LOCK_RETRY_TEST_TIMEOUT_MS = 15000;
|
||||
|
||||
const STATE_CJS_PATH = path.join(
|
||||
__dirname, '..', 'gsd-core', 'bin', 'lib', 'state.cjs'
|
||||
);
|
||||
@@ -193,7 +204,7 @@ describe('perf #316: acquireStateLock hoists sleep buffer — exactly one SAB pe
|
||||
|
||||
test(
|
||||
'sabCount === 1 after a call that undergoes >= 1 retry (post-fix assertion)',
|
||||
{ timeout: 15000 },
|
||||
{ timeout: LOCK_RETRY_TEST_TIMEOUT_MS },
|
||||
async () => {
|
||||
// ── Worker A: hold the lock until the writer signals contention ─────────
|
||||
// The holder releases the lock only when the writer signals its first
|
||||
|
||||
Reference in New Issue
Block a user