Skip to content

perf(build-cli): speed up assert-tag validation - #28253

Open
Craig Macomber (Microsoft) (CraigMacomber) wants to merge 2 commits into
microsoft:mainfrom
CraigMacomber:tagFast
Open

Craig Macomber (Microsoft) (CraigMacomber) wants to merge 2 commits into
microsoft:mainfrom
CraigMacomber:tagFast

Conversation

@CraigMacomber

Copy link
Copy Markdown
Contributor

Description

Reduce local repository-wide assert-tag validation from approximately 44 seconds to 5.3 seconds, with identical validation output.

  • Avoid loading external imports, standard library declarations, and ambient type packages while retaining local-import traversal.
  • Cache module resolutions to avoid repeated filesystem lookups.
  • Skip simulated tagging during validation unless --requireTagged is requested.
  • Reject decoded messages containing */ before they can produce invalid block comments.
  • Add isolated integration tests for validation, tagging, local imports, conditional import resolution, and no-write error handling.

Verified all 23 focused tests, TypeScript compilation, formatting, lint, and repository-wide validation using the locally built CLI.

Reviewer Guidance

The review process is outlined in the pull request guidelines.

The optimization assumes no additional package-local files are reachable only through external imports or ambient type packages. This limitation is documented alongside the project configuration.

…eject messages with */. Add test suite for actual validation and tagging. Validation times goes from 44 to 10 seconds.
Cache module resolutions per project and skip ambient type packages to avoid repeated filesystem lookups and unnecessary declaration loading. Clarify the performance rationale and local-file reachability assumptions.

Local repository-wide validation now takes 5.27 seconds, down from about 10 seconds after the previous optimization and 44 seconds originally, with identical validation output.

Verified all 23 focused tests, TypeScript compilation, formatting, lint, and repository-wide validation.
Copilot AI lite review requested due to automatic review settings September 18, 2026 19:18
@github-actions github-actions Bot added base: main PRs targeted against main branch area: tools area: build Build related issues area: repo Repo related work area: website and removed base: main PRs targeted against main branch labels Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi! Thank you for opening this PR. Want me to review it?

Based on the diff (359 lines, 2 files), I've queued these reviewers:

  • Correctness — logic errors, race conditions, lifecycle issues
  • Security — vulnerabilities, secret exposure, injection
  • API Compatibility — breaking changes, release tags, type design
  • Performance — algorithmic regressions, memory leaks
  • Testing — coverage gaps, hollow tests

How this works

  • Adjust the reviewer set by ticking/unticking boxes above. Reviewer toggles alone don't trigger anything.

  • Tick Start review below to dispatch the review fleet.

  • After review finishes, tick Start review again to request another run — it auto-resets after each dispatch.

  • This comment updates as new commits land; your reviewer selections are preserved.

  • Start review

@github-actions

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: could not be determined; will be reported when the comparison runs
Head commit: 698bc8cf77b25bb1b61ace0da0601275345e9614

Pending — Build - client packages is running. Results will appear here when the build completes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Validation and module-resolution changes warrant final human review.

Pull request overview

Speeds up generate:assertTags validation while preserving local import traversal and improving safety.

Changes:

  • Optimizes TypeScript loading and module resolution.
  • Skips unnecessary validation-time tagging.
  • Rejects unsafe */ messages.
  • Adds isolated integration coverage.
File summaries
File Description
build-tools/packages/build-cli/src/test/commands/generate/assertTags.test.ts Adds integration tests for tagging and validation scenarios.
build-tools/packages/build-cli/src/commands/generate/assertTags.ts Implements validation performance optimizations and safety checks.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build Build related issues area: repo Repo related work area: tools area: website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants