Skip to content

ci: build CommonJS test-version-utils for perf runs#27383

Open
daesunp wants to merge 3 commits into
microsoft:mainfrom
daesunp:test-version-utils-cjs
Open

ci: build CommonJS test-version-utils for perf runs#27383
daesunp wants to merge 3 commits into
microsoft:mainfrom
daesunp:test-version-utils-cjs

Conversation

@daesunp
Copy link
Copy Markdown
Contributor

@daesunp daesunp commented May 22, 2026

Description

Fixes the Performance benchmarks pipeline (perf_e2e_local, perf_e2e_frs, perf_e2e_odsp),
which has failed continuously on main since #27265 with:

Error: Unable to read/parse .../test-end-to-end-tests/.mocharc.cjs:
Error: Cannot find module './dist/compatOptions.js'

Root cause

The perf pipeline runs pnpm exec fluid-build --nolint --task build:test:esm --worker.
@fluid-private/test-version-utils/mocharc-common.cjs require()s its own ./dist/compatOptions.js (CommonJS) at mocha load time, but #27265 narrowed test-end-to-end-tests's build:test:esm override from "^tsc" (every ancestor's CJS build) to a single explicit ancestor, dropping the transitive CJS build of test-version-utils. The CJS artifact stopped being produced and mocha failed to load its config.

Fix

Add a one-time pre-build step in tools/pipelines/test-perf-benchmarks.yml that runs
fluid-build packages/test/test-version-utils --task compile before the main
build:test:esm step. This warms test-version-utils's dist/ so the runtime
require() from mocharc-common.cjs resolves.

Because the new step lives inside the ${{ each job in parameters.benchmarkJobs }}:
template, the single source-line addition applies to all 5 stages.

Copilot AI review requested due to automatic review settings May 22, 2026 00:00
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

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

Based on the diff (12 lines, 1 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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the performance benchmark pipelines that run ESM-focused builds by ensuring @fluid-private/test-version-utils still produces the CommonJS artifact (dist/compatOptions.js) that its mocharc-common.cjs loads via require() at Mocha startup.

Changes:

  • Adds a fluidBuild.tasks override so build:esnext depends on the package’s tsc (CommonJS) build.
  • Documents the rationale in package.json to prevent future regressions when scoped ESM builds are used.

Comment thread packages/test/test-version-utils/package.json Outdated
Copy link
Copy Markdown
Contributor

@jason-ha jason-ha left a comment

Choose a reason for hiding this comment

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

If the perf pipeline passed with this, then let's do it.

@jason-ha jason-ha changed the title build(test-version-utils): build CommonJS when ESM is requested ci: build CommonJS test-version-utils for perf runs May 22, 2026
Copy link
Copy Markdown
Contributor Author

daesunp commented May 22, 2026

/azp run Build - protocol-definitions,Build - test-tools,server-gitrest,server-gitssh,server-historian,server-routerlicious,Build - client packages,repo-policy-check

Copy link
Copy Markdown
Contributor Author

daesunp commented May 22, 2026

/azp run Build - api-markdown-documenter,Build - benchmark-tool,Build - build-common,Build - build-tools,Build - common-utils,Build - eslint-config-fluid,Build - eslint-plugin-fluid

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Copy link
Copy Markdown
Contributor Author

daesunp commented May 22, 2026

/azp run Performance benchmarks

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

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.

3 participants