mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
b6019013ea
PR #6156 needed two 12-reviewer rounds, and a convergence audit measured that 16 of its 37 round-2 toothless-guard clusters (43%) lived in files its own round-1 fixes had just written. Two of those defect classes are mechanically detectable from test source text; this adds a gate for them plus a drift pin for duplicated constants. Rules: - degenerate-spread-aggregate / degenerate-filtered-aggregate: Math.max(...[]) is -Infinity and Math.min(...[]) is +Infinity, so a bound over a spread passes for a run that produced zero elements. Same for .every()/.reduce() over a .filter() that matched nothing. Flagged whether the aggregate sits inside expect() or is hoisted into a const that expect() later consumes. - one-sided-tuned-constant: a constant whose own comment declares it a pin, asserted only as an upper (or only a lower) bound. CONST + 1 does not count -- it constrains the neighbour, not the constant. - pin-comment-without-import: a comment saying the value MUST match `SOME_CONST` in a file that never imports it. - duplicated-constant-drift: registry-driven equality pin over knowingly-duplicated constants, seeded with COMM_ERROR_FUTURE_SKEW_TOLERANCE_MS vs FUTURE_SKEW_TOLERANCE_MS. Also fails if a declaration is renamed away, so a rename cannot silently disable the pin. Scanning masks comments, strings, template literals and regex literals in one length-preserving pass, then matches parens by depth, so a reworded equivalent is still caught and an occurrence inside a string is not. Non-emptiness guards are recognised only when they force at least one element -- toHaveLength(0), toEqual([]) and toBeGreaterThanOrEqual(0) are explicitly NOT guards. Rides the existing "Run build pipeline tests" vitest step in showcase_validate.yml (which fires on every PR touching showcase/**), and adds a named CLI step so the failure is legible in the CI log. Runtime ~0.5s over 1,187 test files. test-vacuity-allowlist.json grandfathers the pre-existing set: 2 live entries on main and 4 pre-registered for #6156. It is shrink-only -- an entry whose violation is fixed but whose entry remains is reported STALE and fails the gate.