From 3c4e0b21ad76a734731725cf16cdfb772aa69bbf Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Tue, 28 Jul 2026 20:40:58 +0530 Subject: chore: make the boundary scanner see every cast, not just the unsafe forms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The scanner banned as any, as {, as unknown as, non-null assertions and ts-ignore, but said nothing about `as SomeNamedType` — so a new cast over CDP or JSON data could be added and CI would stay green, which is the exact regression the refactor exists to prevent. It also could not see a cast whose target type sits on the following line. Adds named-cast, function-cast and trailing-cast. All six surviving assertions in src/ are now visible to the scanner and individually exempted with a stated reason, so the allowlist is the complete inventory. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/check-boundaries.ts | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts/check-boundaries.ts') diff --git a/scripts/check-boundaries.ts b/scripts/check-boundaries.ts index 5dff96d..c438b83 100644 --- a/scripts/check-boundaries.ts +++ b/scripts/check-boundaries.ts @@ -17,6 +17,9 @@ const RULES: ReadonlyArray<{ readonly rule: string; readonly re: RegExp }> = [ { rule: "non-null-assertion", re: /[A-Za-z_$)\]]!\s*(?:[.[(;,)\]}]|$)/ }, { rule: "inline-object-cast", re: /\bas\s+\{/ }, { rule: "double-cast", re: /\bas\s+unknown\s+as\b/ }, + { rule: "named-cast", re: /\bas\s+(?:new\s+)?[A-Z][A-Za-z0-9_]*/ }, + { rule: "function-cast", re: /\bas\s+\(/ }, + { rule: "trailing-cast", re: /\bas\s*$/ }, ]; export type SourceFile = { readonly path: string; readonly text: string }; -- cgit v1.2.3