-
Notifications
You must be signed in to change notification settings - Fork 559
Add CheckCompatLayerGeneration to release prepare command #25911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: tylerbutler <[email protected]>
Co-authored-by: tylerbutler <[email protected]>
Co-authored-by: tylerbutler <[email protected]>
Co-authored-by: tylerbutler <[email protected]>
build-tools/packages/build-cli/src/library/releasePrepChecks.ts
Outdated
Show resolved
Hide resolved
…eneration check Co-authored-by: tylerbutler <[email protected]>
Co-authored-by: tylerbutler <[email protected]>
Co-authored-by: tylerbutler <[email protected]>
Co-authored-by: tylerbutler <[email protected]>
…onfiguration Co-authored-by: tylerbutler <[email protected]>
Co-authored-by: tylerbutler <[email protected]>
|
@copilot when is onlyConfiguredPackages set to false? |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
…tion Co-authored-by: tylerbutler <[email protected]>
build-tools/packages/build-cli/src/library/releasePrepChecks.ts
Outdated
Show resolved
Hide resolved
…te fixCommand - Update checkCompatLayerGeneration to check only packages in the release group or individual package being released, not all packages in repo - Change fixCommand from "pnpm run -r layerGeneration:gen" to "pnpm run layerGeneration:gen" to allow root package.json to handle the -r flag - Add Package import to checkFunctions.ts Co-authored-by: tylerbutler <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
…to copilot/update-release-prepare-command # Conflicts: # build-tools/packages/build-cli/src/test/commands/generate/compatLayerGeneration.test.ts
This comment was marked as outdated.
This comment was marked as outdated.
|
/azp run Build - protocol-definitions,Build - test-tools,server-gitrest,server-gitssh,server-historian,server-routerlicious,Build - client packages,repo-policy-check |
|
/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 successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Build - protocol-definitions,Build - test-tools,server-gitrest,server-gitssh,server-routerlicious,Build - client packages,repo-policy-check,Build - build-tools |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run Build - protocol-definitions,Build - test-tools,server-gitrest,server-gitssh,server-routerlicious,Build - client packages,repo-policy-check,Build - build-tools |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
@copilot Looks like there are some build or lint failures. Try to reproduce them locally and fix them |
Co-authored-by: tylerbutler <[email protected]>
Updated comments in commit 43b8af4 to reference the correct command name ( |
|
/azp run Build - protocol-definitions,Build - test-tools,server-gitrest,server-gitssh,server-routerlicious,Build - client packages,repo-policy-check,Build - build-tools |
|
/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,server-historian |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description
The
release preparecommand was missing the compatibility layer generation check that runs in the mainreleasecommand.This PR adds the missing check by creating shared logic that both commands can use, using direct function calls instead of shell commands for better efficiency and maintainability.
Changes
library/layerCompatibility.tscontaining shared layer compatibility functions (maybeGetNewGeneration,isCurrentPackageVersionPatch, and constants)runCompatLayerGenerationCheck()helper inreleasePrepChecks.tsthat directly calls the shared layer compatibility functions to check if packages need updatesCheckCompatLayerGenerationfollowing existing check patterns and added toallChecksmap inprepare.tscheckCompatLayerGenerationincheckFunctions.tsto use shared helper, reducing duplication and properly scoping to the release group or package being releasedcommands/generate/compatLayerGeneration.tsto import shared functions from the library instead of defining them locally (the command was renamed fromlayerCompatGeneration.tstocompatLayerGeneration.tsin main branch)maybeGetNewGenerationcurrentDateparameter for testability (defaults tonew Date())daysInMonthApproximationtoDAYS_IN_MONTH_APPROXIMATION(constant naming convention)DEFAULT_MINIMUM_COMPAT_WINDOW_MONTHSto shared libraryrunCompatLayerGenerationCheckto accept a list of packages instead of contextCheckCompatLayerGenerationto usereleaseGroupOrPackageparameter for better scopingcheckCompatLayerGenerationto check only packages in the specific release group or individual package being released, not all packages in the repository"pnpm run -r layerGeneration:gen"to"pnpm run layerGeneration:gen"to delegate to root package.json script, allowing implementation changes without modifying the fix commandlayerCompatGeneration.ts→compatLayerGeneration.ts), updating all references and documentation comments accordinglyBoth commands now run identical compatibility layer generation checks via shared logic in the library directory, following proper code organization patterns and best practices for testability.
The check function validates only packages that already have
fluidCompatMetadataconfigured, skipping packages without metadata since not all packages need layer compatibility. This approach uses thefluidCompatMetadatafield as an opt-in signal, which aligns with the intended design where packages explicitly opt into layer compatibility tracking.How layer compatibility generation works
The
flub generate compatLayerGenerationcommand:--dir,--all,--packages, etc.)fluidCompatMetadata: initializes with generation 1The command uses
fluidCompatMetadataas the opt-in signal - packages with this field are considered opted in for layer compatibility tracking.Setting up layer compatibility for a package
Current approach using pnpm workspace scripts:
layerGeneration:genscript to package.json:"layerGeneration:gen": "flub generate compatLayerGeneration --dir . -v"pnpm run layerGeneration:gento initialize the packagefluidCompatMetadatafield and generates the layer generation filePackages opt out by not including the
layerGeneration:genscript. When runningpnpm run -r layerGeneration:gen, only packages with the script defined will have the command executed.Breaking Changes
None.
Reviewer Guidance
library/layerCompatibility.tsfollowing proper code organizationDAYS_IN_MONTH_APPROXIMATION,DEFAULT_MINIMUM_COMPAT_WINDOW_MONTHS)context.packagesInReleaseGroup(releaseGroup)to get the correct package setcontext.fullPackageMap.get(releasePackage)to get the specific packagefluidCompatMetadatafield serves as the opt-in signal"pnpm run layerGeneration:gen") which can callpnpm run -r layerGeneration:gen, allowing the implementation to be easily changed laterlayerCompatGeneration.tstocompatLayerGeneration.tsin the main branch merge, and all imports and documentation comments have been updated to reference the correct command nameOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.