Skip to content

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Apr 2, 2025

When introducing friendly asset names in #33844, we made a mistake in calculating unique action names for distinct assets with the same display name.

As a result, the same asset could be added to the pipeline twice, but not thrice.

The simplest fix would have been to move the increment before the reassignment of name:

            // Before
            if (nameCount > 0) {
              name += `${nameCount + 1}`;
            }
            namesCtrs.set(name, nameCount + 1);

            // After
            namesCtrs.set(name, nameCount + 1);
            if (nameCount > 0) {
              name += `${nameCount + 1}`;
            }

But it occurred to me that that would still lead to problems if there were actions with display names that would conflict with the numbered names in that way (e.g., ['asdf', 'asdf', 'asdf2'], leading to action names ['asdf', 'asdf2', 'asdf2']).

So what we do instead is linear probing: increment a counter for every name and pick the first name that is unused.

Also in this PR: Stages can't have a name of only one character. Fix that.

Closes #34004.


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

When introducing friendly asset names in #33844, we made a mistake in
calculating unique action names for distinct assets with the same
display name.

As a result, the same asset could be added to the pipeline twice,
but not thrice. Fix the logic.

Also in this PR: Stages can't have a name of only one character. Fix
that.

Closes #34004.
@rix0rrr rix0rrr requested a review from a team as a code owner April 2, 2025 12:34
@aws-cdk-automation aws-cdk-automation requested a review from a team April 2, 2025 12:34
@github-actions github-actions bot added bug This issue is a bug. p1 labels Apr 2, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Apr 2, 2025
Copy link
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)

@rix0rrr rix0rrr added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Apr 2, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 2, 2025 14:40

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

@codecov
Copy link

codecov bot commented Apr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.98%. Comparing base (009680d) to head (5170341).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #34017   +/-   ##
=======================================
  Coverage   83.98%   83.98%           
=======================================
  Files         120      120           
  Lines        6976     6976           
  Branches     1178     1178           
=======================================
  Hits         5859     5859           
  Misses       1005     1005           
  Partials      112      112           
Flag Coverage Δ
suite.unit 83.98% <100.00%> (ø)

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

Components Coverage Δ
packages/aws-cdk ∅ <ø> (∅)
packages/aws-cdk-lib/core 83.98% <100.00%> (ø)
🚀 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.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 5170341
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Apr 2, 2025

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 mergify bot merged commit 1418277 into main Apr 2, 2025
20 checks passed
@mergify mergify bot deleted the huijbers/pipeline-names branch April 2, 2025 15:23
@github-actions
Copy link
Contributor

github-actions bot commented Apr 2, 2025

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 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug This issue is a bug. contribution/core This is a PR that came from AWS. p1 pr-linter/exempt-integ-test The PR linter will not require integ test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(assets): Duplicate Action Name in Assets Stage Due to Nested Stack Template Naming in v2.187.0+

3 participants