Skip to content

chore: run aws-cdk-lib gen before mixins gen in spec-update workflow#37558

Merged
mergify[bot] merged 1 commit intomainfrom
fix/spec-update-gen-ordering
Apr 9, 2026
Merged

chore: run aws-cdk-lib gen before mixins gen in spec-update workflow#37558
mergify[bot] merged 1 commit intomainfrom
fix/spec-update-gen-ordering

Conversation

@vishaalmehrishi
Copy link
Copy Markdown
Contributor

Issue

Fixes the recurring build failure on L1 spec update PRs (e.g. #37530) where git diff-index detects uncommitted changes in packages/@aws-cdk/cfn-property-mixins/package.json.

Supersedes #37556 which added cfn-property-mixins to the gen step but didn't fix the ordering issue.

Root Cause: Race Condition in Parallel Gen

The spec-update workflow runs lerna run gen for all three packages (aws-cdk-lib, @aws-cdk/mixins-preview, @aws-cdk/cfn-property-mixins) in a single command. Lerna executes them in parallel. This creates a race condition:

  1. aws-cdk-lib gen writes new service entries (e.g. aws-novaact, aws-securityagent) to scope-map.json via writeModuleMap()

  2. cfn-property-mixins gen reads scope-map.json via loadModuleMap() to determine which services to generate exports for — see the filter at line 23: if (moduleMap[service.name])

  3. mixins-preview gen has the same dependency on scope-map.json

Evidence from workflow run #354

The gen step logs show cfn-property-mixins finished before aws-cdk-lib:

10:53:00 @aws-cdk/cfn-property-mixins:   Services: 278    ← finished first, read stale scope-map.json
10:53:05 aws-cdk-lib:                     Services: 282    ← finished second, wrote updated scope-map.json

cfn-property-mixins generated for 278 services because it read scope-map.json before aws-cdk-lib added the 4 new service entries. During the CI build, cdk-build runs gen again with the updated scope-map.json, producing 2 new export entries in package.json that weren't in the commit → git diff-index fails.

Description of changes

Split the single lerna run gen command into two sequential steps:

  1. Generate L1 code — runs gen for aws-cdk-lib only, which updates scope-map.json
  2. Generate mixins — runs gen for mixins-preview and cfn-property-mixins, which now read the updated scope-map.json

Description of how you validated changes

  • Traced the full dependency chain through the codebase (links above)
  • Confirmed the race condition from workflow run #354 logs showing 278 vs 282 services
  • Confirmed the CI build failure logs show the same cfn-property-mixins/package.json | 2 ++ after the workflow re-run

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

The spec-update workflow runs gen for aws-cdk-lib, mixins-preview, and
cfn-property-mixins in parallel via a single lerna command. This causes
a race condition: cfn-property-mixins and mixins-preview read
scope-map.json to determine which services to generate for, but
aws-cdk-lib gen is the step that writes new service entries to
scope-map.json. When cfn-property-mixins finishes before aws-cdk-lib,
it misses the new services, and the PR build fails with uncommitted
changes in cfn-property-mixins/package.json.

Split into two sequential steps so aws-cdk-lib gen runs first and
updates scope-map.json before the mixins packages read it.
@github-actions github-actions bot added the p2 label Apr 9, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team April 9, 2026 11:52
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Apr 9, 2026
@mergify mergify bot temporarily deployed to automation April 9, 2026 11:52 Inactive
@mergify mergify bot temporarily deployed to automation April 9, 2026 11:53 Inactive
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@vishaalmehrishi vishaalmehrishi changed the title fix: run aws-cdk-lib gen before mixins gen in spec-update workflow chore: run aws-cdk-lib gen before mixins gen in spec-update workflow Apr 9, 2026
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 9, 2026 12:00

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Apr 9, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Apr 9, 2026

Merge Queue Status

  • Entered queue2026-04-09 12:37 UTC · Rule: default-squash
  • Checks skipped · PR is already up-to-date
  • Merged2026-04-09 12:37 UTC · at dc6da6eacf4f2bba31cb7e22885c69cea0f64e06

This pull request spent 12 seconds in the queue, including 2 seconds running CI.

Required conditions to merge

@mergify mergify bot merged commit 2928e23 into main Apr 9, 2026
45 of 46 checks passed
@mergify mergify bot deleted the fix/spec-update-gen-ordering branch April 9, 2026 12:37
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants