Skip to content

fix(build): prepare shared declarations before parallel plugins - #46024

Open
mikebridge wants to merge 1 commit into
apache:masterfrom
mikebridge:fix-frontend-plugin-build-race
Open

mikebridge wants to merge 1 commit into
apache:masterfrom
mikebridge:fix-frontend-plugin-build-race

Conversation

@mikebridge

Copy link
Copy Markdown
Contributor

SUMMARY

TL;DR: Build shared TypeScript projects once before starting parallel plugin builds, so plugins do not write the same declaration files concurrently.

Background: plugins:build starts three per-package tsc --build processes. Each plugin references the same core and chart-controls projects, and each compiler can rebuild those references. The Lerna package schedule does not serialize these TypeScript reference builds.

Problem: frontend lint has failed with missing declarations or inconsistent shared types in separate plugins:

Changes: compile the three shared referenced projects in one tsc --build invocation before the existing parallel stage. TypeScript traverses their dependencies in order. The plugin stage retains its concurrency and sees up-to-date shared declarations. Babel output, per-plugin type checking and root type checking remain unchanged. Filtered builds also prepare these shared prerequisites.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable; build scheduling only.

TESTING INSTRUCTIONS

  • npm run test -- --runInBand spec/scripts/build.test.ts: exercises default, --skip-lib, filtered builds, and stopping before plugins when shared compilation fails. The tests fail without the new phase.
  • From a clean declaration state, run npm run plugins:build -- --skip-lib && npm run type.
  • Compare emitted declarations before and after the scheduling change.

The exact intermittent CI errors were not reproduced locally. Concurrent writes to the same shared projects were confirmed with verbose compiler logs on master; this change removes that overlap. After a fresh locked dependency install, three clean fixed builds passed in 15.8/15.8/15.7 seconds versus 17.0 seconds before, with all 2,242 declaration files/maps byte-for-byte identical. Root type checking and changed-file hooks passed. Validation was on macOS with Node 24; Linux CI remains necessary.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov

codecov Bot commented Nov 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.00%. Comparing base (fcc13d4) to head (7c0fec1).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #46024   +/-   ##
=======================================
  Coverage   85.00%   85.00%           
=======================================
  Files        3080     3080           
  Lines      209266   209266           
  Branches    49296    49296           
=======================================
  Hits       177895   177895           
  Misses      27989    27989           
  Partials     3382     3382           
Flag Coverage Δ
javascript 81.31% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mikebridge
mikebridge marked this pull request as ready for review November 4, 2026 23:30
@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: 7c0fec106764

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant