Skip to content

fix: set type metadata on search attribute payloads in test server#2677

Merged
maciejdudko merged 2 commits intotemporalio:masterfrom
AdityaTeltia:fix/test-server-search-attribute-type-metadata
Oct 10, 2025
Merged

fix: set type metadata on search attribute payloads in test server#2677
maciejdudko merged 2 commits intotemporalio:masterfrom
AdityaTeltia:fix/test-server-search-attribute-type-metadata

Conversation

@AdityaTeltia
Copy link
Contributor

Today, Temporal server sets type metadata on search attribute payloads even if user doesn't set it, test server should do the same.

What was changed

  • Modified TestVisibilityStoreImpl.upsertSearchAttributesForExecution() to automatically add type metadata to search attribute payloads when missing
  • Added METADATA_TYPE_KEY constant matching the standard used throughout the codebase
  • Enhanced the method to preserve existing metadata while adding missing type information
  • Created comprehensive tests in TestVisibilityStoreImplTest to verify the fix works correctly

Why?

The test server was not setting type metadata on search attribute payloads, while the real Temporal server does this automatically. This inconsistency could cause problems when testing search attribute functionality, as tests might behave differently between test and production environments. The fix ensures consistent behavior and improves reliability of tests that depend on search attribute functionality.

Checklist

  1. Closes Test server needs to set metadata type for search attribute payloads #2666

  2. How was this tested:

    • Created unit tests in TestVisibilityStoreImplTest with two test methods:
      • testTypeMetadataIsAddedToPayloads() - verifies missing type metadata is automatically added
      • testExistingTypeMetadataIsPreserved() - verifies existing metadata is preserved
    • Ran existing search attribute tests to ensure no regressions (all 4 tests pass)
    • Verified the implementation follows the same patterns as SearchAttributePayloadConverter
    • Tested with different search attribute types (Int, Text, Keyword) to ensure correct type strings are used
  3. Any docs updates needed?

    • No documentation updates needed as this is an internal implementation detail that maintains backward compatibility

@AdityaTeltia AdityaTeltia requested a review from a team as a code owner October 8, 2025 09:53
@CLAassistant
Copy link

CLAassistant commented Oct 8, 2025

CLA assistant check
All committers have signed the CLA.

@maciejdudko
Copy link
Contributor

Hi Aditya, thank you for your contribution!

Before we can merge your PR, you must sign our Contributor License Agreement. Please refer to @CLAassistant's automatic comment above.

Features Integration Tests CI job has failed. It looks like you haven't copied tags from our repository into your fork - without that, this job will not work. Please run the following commands inside your repository clone:

git remote add upstream https://github.com/temporalio/sdk-java.git
git fetch upstream --tags
git push origin --tags

Please leave a comment when you've run the commands so we can re-run CI.

@AdityaTeltia
Copy link
Contributor Author

Hi @maciejdudko, I have fetched and pushed tags using steps you mentioned.

Before we can merge your PR, you must sign our Contributor License Agreement. Please refer to @CLAassistant's automatic comment above.

I have already signed Contributor License Agreement, not sure why it is still stating that it hasn't been signed yet.

image

@maciejdudko
Copy link
Contributor

The features tests passed, thank you.

It looks like Github didn't recognize you as the author of the commit. This can be because your Git is configured to use a different email address than the one you used for Github account. Please see this guide to add additional emails: https://docs.github.com/en/account-and-profile/how-tos/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/adding-an-email-address-to-your-github-account

Alternatively, you can recommit the changes under a different email. First change your email address in Git config to match your Github account, then inside your branch, run git commit --amend --reset-author followed by git push --force.

@AdityaTeltia AdityaTeltia force-pushed the fix/test-server-search-attribute-type-metadata branch from bb824d3 to 9dc2cc8 Compare October 10, 2025 05:36
@AdityaTeltia
Copy link
Contributor Author

@maciejdudko license check is passing now. Can you please review the PR?

Copy link
Contributor

@maciejdudko maciejdudko left a comment

Choose a reason for hiding this comment

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

Everything looks good, thank you for your contribution!

@maciejdudko maciejdudko merged commit f9a5d74 into temporalio:master Oct 10, 2025
15 checks passed
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.

Test server needs to set metadata type for search attribute payloads

3 participants