You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(pipelines): can't have the same asset display name 3 times (#34017)
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`:
```ts
// 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*
thrownewError(`invalid stage name "${id}". Stage name must start with a letter and contain only alphanumeric characters, hypens ('-'), underscores ('_') and periods ('.')`);
0 commit comments