Skip to content

Fix bug that occurs when re-adding version metadata after removing all keys#8887

Merged
carlydf merged 5 commits intomainfrom
cdf/update-version-metadata-bug-fix
Dec 22, 2025
Merged

Fix bug that occurs when re-adding version metadata after removing all keys#8887
carlydf merged 5 commits intomainfrom
cdf/update-version-metadata-bug-fix

Conversation

@carlydf
Copy link
Contributor

@carlydf carlydf commented Dec 20, 2025

What changed?

Fix bug that occurs when re-adding version metadata after removing all keys

Why?

Because otherwise, users could break their version workflow.
Luckily, this won't happen to users of the worker controller, because there are certain metadata keys added to all versions managed by the worker controller.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

  • None

Note

Ensure version metadata can be re-added after removing all keys by reinitializing maps and using nil-safe deletes, with new test coverage.

  • Backend (worker deployment):
    • In service/worker/workerdeployment/version_workflow.go, initialize VersionState.Metadata and Metadata.Entries when UpsertEntries is provided, and use Metadata.GetEntries() for deletes to be nil-safe.
  • Tests:
    • Extend TestUpdateVersionMetadata to remove all entries then re-upsert and validate; minor assertion update to s.Len.

Written by Cursor Bugbot for commit 47680a7. This will update automatically on new commits. Configure here.

@carlydf carlydf requested review from a team as code owners December 20, 2025 02:35
@carlydf carlydf merged commit 8192318 into main Dec 22, 2025
99 of 101 checks passed
@carlydf carlydf deleted the cdf/update-version-metadata-bug-fix branch December 22, 2025 23:50
simvlad pushed a commit that referenced this pull request Feb 2, 2026
…l keys (#8887)

## What changed?
Fix bug that occurs when re-adding version metadata after removing all
keys

## Why?
Because otherwise, users could break their version workflow.
Luckily, this won't happen to users of the worker controller, because
there are certain metadata keys added to all versions managed by the
worker controller.

## How did you test it?
- [x] built
- [x] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [x] added new functional test(s)

## Potential risks
- None

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Ensure version metadata can be re-added after removing all keys by
reinitializing maps and using nil-safe deletes, with new test coverage.
> 
> - **Backend (worker deployment)**:
> - In `service/worker/workerdeployment/version_workflow.go`, initialize
`VersionState.Metadata` and `Metadata.Entries` when `UpsertEntries` is
provided, and use `Metadata.GetEntries()` for deletes to be nil-safe.
> - **Tests**:
> - Extend `TestUpdateVersionMetadata` to remove all entries then
re-upsert and validate; minor assertion update to `s.Len`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
47680a7. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
awln-temporal pushed a commit that referenced this pull request Feb 6, 2026
…l keys (#8887)

Fix bug that occurs when re-adding version metadata after removing all
keys

Because otherwise, users could break their version workflow.
Luckily, this won't happen to users of the worker controller, because
there are certain metadata keys added to all versions managed by the
worker controller.

- [x] built
- [x] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [x] added new functional test(s)

- None

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Ensure version metadata can be re-added after removing all keys by
reinitializing maps and using nil-safe deletes, with new test coverage.
>
> - **Backend (worker deployment)**:
> - In `service/worker/workerdeployment/version_workflow.go`, initialize
`VersionState.Metadata` and `Metadata.Entries` when `UpsertEntries` is
provided, and use `Metadata.GetEntries()` for deletes to be nil-safe.
> - **Tests**:
> - Extend `TestUpdateVersionMetadata` to remove all entries then
re-upsert and validate; minor assertion update to `s.Len`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
47680a7. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants