Skip to content

feat: warn when ADR file scope is too broad#329

Merged
rhuanbarreto merged 2 commits into
mainfrom
feat/greedy-glob-warning
May 23, 2026
Merged

feat: warn when ADR file scope is too broad#329
rhuanbarreto merged 2 commits into
mainfrom
feat/greedy-glob-warning

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Add a performance diagnostic to resolveScopedFiles() that emits a logWarn() when an ADR's files glob resolves more than 1,000 files (SCOPE_FILE_WARN_THRESHOLD) or the glob scan takes longer than 2,000ms (SCOPE_SCAN_WARN_MS)
  • The warning includes the ADR ID, file count, glob patterns, scan duration, and actionable advice to narrow the files patterns
  • Update ARCH-005 (Testing Standards) with a new Do/Don't about wrapping spyOn calls in try/finally to prevent spy leaks when assertions fail

Test plan

  • bun run validate passes (lint, typecheck, format, 1119 tests, 27/27 ADR checks, knip, build)
  • New test: warns when file scope exceeds threshold (creates 1001 files, asserts warning fires with ADR ID, count, and suggestion)
  • New test: does not warn when file scope is within threshold (10 files, asserts no warning)
  • Manual: run archgate check on a large repo with a broad files: ["**/*"] ADR to confirm warning appears

Add a performance diagnostic to `resolveScopedFiles()` that warns users
when an ADR's `files` glob resolves too many files (>1000) or takes too
long (>2000ms). This helps users identify greedy glob patterns that slow
down `archgate check`.

Also updates ARCH-005 with a new Do/Don't about wrapping spyOn calls in
try/finally to prevent spy leaks when assertions fail mid-test.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 22, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 339cd3e
Status: ✅  Deploy successful!
Preview URL: https://2d24c8cc.archgate-cli.pages.dev
Branch Preview URL: https://feat-greedy-glob-warning.archgate-cli.pages.dev

View logs

@rhuanbarreto rhuanbarreto merged commit 0d99b7f into main May 23, 2026
10 checks passed
@rhuanbarreto rhuanbarreto deleted the feat/greedy-glob-warning branch May 23, 2026 21:43
@archgatebot archgatebot Bot mentioned this pull request May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant