You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AGENTS.md (test-style section, ~line 195) makes plain node:assert the house style for new tests and explicitly rules out node:assert/strict ("strict mode's deep-equality and coercion rules cause more friction and surprising failures than they prevent"). But the convention isn't enforced and the codebase overwhelmingly violates it:
208 test files import node:assert/strict vs 29 on plain node:assert (unitTests + integrationTests).
Even the "target-shape" dirs AGENTS.md names are mostly /strict: unitTests/config 11, unitTests/resources 25, unitTests/components 48.
The only thing catching new /strict usage today is the AI reviewer, which raises it as a non-blocking suggestion on every affected PR — recurring noise that never gets systematically resolved (see e.g. PR #1106).
Goal
Make the documented convention deterministic — caught by CI's linter before review — so the reviewer nit disappears and new code can't regress.
The rule to standardize on: default to require('node:assert'); never import node:assert/strict; when a specific assertion genuinely needs strict/deep-strict semantics, call assert.strictEqual / assert.deepStrictEqual explicitly (both available from plain node:assert). This keeps strictness opt-in and visible at the call site rather than silently applied to every assert.equal by the import.
Plan
Migrate existing node:assert/strict imports → node:assert across test files. This is mechanical and safe: strict→loose only ever weakens an assertion, so no currently-green test can turn red. (Optionally, spot-convert assertions that should stay strict to explicit strictEqual/deepStrictEqual.) Consider staging by dir — the target-shape dirs (config/resources/components, ~84 files) first.
Enforce with oxlint no-restricted-imports so regressions fail runLinter:
Can be scoped to unitTests/{config,resources,components}/** first via oxlint overrides, then widened as legacy dirs are migrated.
Notes
oxlint supportsno-restricted-imports (verified against the installed version's rule list).
Enabling the rule repo-wide before migrating will fail lint on the 208 existing files — hence migrate first (or scope via overrides).
Older unitTests/security/* and unitTests/utility/* are not the target shape (they also use sinon/rewire per AGENTS.md); their imports are still safe to migrate but can be de-prioritized.
Correction to the migration plan above: the claim "strict→loose only ever weakens an assertion, so no green test can turn red" is wrong for negative assertions.
node:assert/strict makes notEqual===notStrictEqual (!==) and notDeepEqual===notDeepStrictEqual. Swapping to plain node:assert makes them loose (!=), so e.g. assert.notEqual(x, undefined) where x is null flips from pass (null !== undefined) to throw (null != undefined is false). This deterministically broke integrationTests/apiTests/northwind.test.mjs (LEFT OUTER JOIN rows have null columns; notEqual(row[key], undefined) at :4963/:4983) — red on all 4 runtimes in PR #1558.
Corrected rule for this migration: positive equal/deepEqual only weaken silently (accepted per house style), but negative notEqual/notDeepEqual can flip pass→fail — convert those call sites to notStrictEqual/notDeepStrictEqual (identical in both modules; the lint rule only bans the node:assert/strict import path). 17 files / 37 sites are affected; being fixed in PR #1558.
Worth baking into the AGENTS.md note and the lint enforcement so future migrations don't reintroduce it.
Problem
AGENTS.md (test-style section, ~line 195) makes plain
node:assertthe house style for new tests and explicitly rules outnode:assert/strict("strict mode's deep-equality and coercion rules cause more friction and surprising failures than they prevent"). But the convention isn't enforced and the codebase overwhelmingly violates it:node:assert/strictvs 29 on plainnode:assert(unitTests + integrationTests)./strict:unitTests/config11,unitTests/resources25,unitTests/components48.The only thing catching new
/strictusage today is the AI reviewer, which raises it as a non-blocking suggestion on every affected PR — recurring noise that never gets systematically resolved (see e.g. PR #1106).Goal
Make the documented convention deterministic — caught by CI's linter before review — so the reviewer nit disappears and new code can't regress.
The rule to standardize on: default to
require('node:assert'); never importnode:assert/strict; when a specific assertion genuinely needs strict/deep-strict semantics, callassert.strictEqual/assert.deepStrictEqualexplicitly (both available from plainnode:assert). This keeps strictness opt-in and visible at the call site rather than silently applied to everyassert.equalby the import.Plan
node:assert/strictimports →node:assertacross test files. This is mechanical and safe: strict→loose only ever weakens an assertion, so no currently-green test can turn red. (Optionally, spot-convert assertions that should stay strict to explicitstrictEqual/deepStrictEqual.) Consider staging by dir — the target-shape dirs (config/resources/components, ~84 files) first.no-restricted-importsso regressions failrunLinter:unitTests/{config,resources,components}/**first via oxlintoverrides, then widened as legacy dirs are migrated.Notes
no-restricted-imports(verified against the installed version's rule list).overrides).unitTests/security/*andunitTests/utility/*are not the target shape (they also use sinon/rewire per AGENTS.md); their imports are still safe to migrate but can be de-prioritized.openaiStreamtest files to plainnode:assert— use as the reference for the mechanical change.Acceptance
node:assert/strictimports remain in the enforced scope.no-restricted-importsrule added and green in CI.🤖 Generated with Claude Code