Files
OmniRoute/tests/unit/check-rtl-ratchet.test.ts
Diego Rodrigues de Sa e Souza 8c5bfbe631 fix(quality): reconcile inherited file-size drift on the release tip (#9554)
* fix(quality): reconcile inherited file-size drift on the release tip

13 files sit above their frozen LOC on the clean tip 8180b49ce1
(measured by the gate itself). The PR-mode base-relative check (#8522)
correctly lets innocent PRs pass, but per-PR rebaselines were lost
across successive conflict resolutions of this hot file during the
08-05/06 merge batch — so the absolute mode (nightly, local runs) is
permanently red and stops distinguishing real growth from inherited
drift.

Frozen values updated to the measured tip, each annotated with the
merged PR that grew the file (#9024 #9324 #9329 #9193 #9332 #9228
#9236 #9314 #9260 #8934 #9196 #9163); executors default.ts and kiro.ts
(above the 1000 cap with no frozen entry) join the frozen set.

* fix(quality): prune orphaned ESLint suppressions and clear the 5 unsuppressed errors

The 'No new ESLint warnings' job reds the whole queue with exit 2:
'There are suppressions left that do not occur anymore' — the 08-05
merge batch removed code whose violations were frozen in
eslint-suppressions.json, leaving orphaned entries (673->670 files,
4338->4333 violations after eslint --prune-suppressions).

The full-tree run also surfaced 5 real unsuppressed errors merged with
the batch, fixed here instead of suppressed (new violations must be
fixed, per policy): 4x no-explicit-any in
tests/unit/catalog-order-contract.test.ts ((conn as any).id -> typed
cast) and 1x react/no-unescaped-entities in the agent-bridge
SetupWizard (#9095).

Also restores the _comment policy header the successive hot-file
conflict resolutions had dropped (TS7 debt freeze provenance + prune
policy).

* fix(quality): absorb the two file-size growths merged while this PR was in CI

The base kept moving during the reconcile cycle: #9184 grew
src/sse/handlers/chat.ts 1857->1877 and #9005 grew
open-sse/executors/default.ts 1027->1042. Re-measured on the merged
tree; gate back to 0 violations.

* fix(tests): move the orphaned RTL ratchet test to a collected path as node:test

#8828 added tests/unit/scripts/check-rtl-ratchet.test.ts — a path no
runner collects (the node:test globs enumerate an explicit subdir list
without scripts/, and vitest.config.ts never included it), so the file
NEVER ran and the test-discovery orphan gate reds the queue. Moved to
tests/unit/ (collected by node:test) and converted from vitest
describe/it/expect to node:test+assert to match the runner and the
sibling check-*.test.ts files. 5/5 green under the real runner.

---------

Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
2026-08-06 01:45:28 -03:00

38 lines
1.7 KiB
TypeScript

// #8828 RTL layout ratchet — countViolations unit contract.
// Moved from tests/unit/scripts/ (a path no runner collects: the node:test
// globs stop at an explicit subdir list and vitest.config.ts never included
// it, so the file NEVER ran) and converted from vitest to node:test, the
// runner that collects tests/unit/*.test.ts.
import { test } from "node:test";
import assert from "node:assert/strict";
import { countViolations } from "../../scripts/check/check-rtl-ratchet.mjs";
test("counts physical directional utilities", () => {
assert.equal(countViolations('<span className="mr-2" />'), 1);
assert.equal(countViolations('<td className="pr-3 text-left" />'), 2);
assert.equal(countViolations('<div className="border-l-2 rounded-r-md" />'), 2);
});
test("ignores logical utilities, which already mirror", () => {
assert.equal(countViolations('<span className="me-2 ps-3 text-start" />'), 0);
assert.equal(countViolations('<div className="border-s-2 rounded-e-md" />'), 0);
});
test("ignores a class already scoped to an rtl: variant", () => {
assert.equal(countViolations('<div className="rtl:mr-0" />'), 0);
// Only the unscoped half of a pair counts.
assert.equal(countViolations('<div className="rtl:mr-0 mr-2" />'), 1);
});
test("ignores left/right paired on one element, which spans both edges", () => {
assert.equal(countViolations('<div className="absolute left-0 right-0 top-0" />'), 0);
// A lone edge offset is still directional.
assert.equal(countViolations('<div className="absolute left-0 top-0" />'), 1);
});
test("does not match unrelated identifiers containing the prefixes", () => {
assert.equal(countViolations('<div className="control-panel highlight-2" />'), 0);
assert.equal(countViolations("const marginLeft = 2;"), 0);
});