Skip to content

feat: mock typed search-attribute upsert in the testing framework - #784

Open
xepozz wants to merge 3 commits into
masterfrom
feature/mock-typed-search-attributes
Open

feat: mock typed search-attribute upsert in the testing framework#784
xepozz wants to merge 3 commits into
masterfrom
feature/mock-typed-search-attributes

Conversation

@xepozz

@xepozz xepozz commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

What was changed

Mock typed search-attribute upserts in the testing framework, mirroring the activity/child-workflow mockers (#778).

  • MockSearchAttributeInterceptor — swallows the UpsertWorkflowTypedSearchAttributes command (the time-skipping test-server doesn't implement it) and records each update; untyped upsertSearchAttributes is left untouched.
  • SearchAttributeInvocationCache (interface + RoadRunner KV + InMemory) — stores upserts as a single name → entry map, crossing the worker↔test-process boundary like the child/activity caches.
  • SearchAttributeMocker ($this->searchAttributeMocks) — assertUpserted / assertUpsertedValue / assertUnset / assertNotUpserted / wasUpserted / getUpserted / getUpsertedAttributes, wired into WorkflowTestCase.

Why?

Workflow::upsertTypedSearchAttributes() timed out under the time-skipping test-server because the Java test-server binary doesn't implement the typed-SA command (the untyped one is accepted). Typed search-attribute upserts are now assertable in tests instead of hanging the run.

Checklist

  1. Closes [Bug] upsertTypedSearchAttributes in test server #654

  2. How was this tested:

New Unit + Functional suites, all green: interceptor swallow/record (raw datetime value, unset, and the collision-name index + numeric-name 2024 edge cases), SearchAttributeMocker assertions (strict value match), and a functional test that drives a typed workflow and asserts the full upserted set on the real RoadRunner cache.

  1. Any docs updates needed?

Yes — document search-attribute mocking ($this->searchAttributeMocks) on the PHP testing-suite page at docs.temporal.io.

@xepozz
xepozz requested review from a team, roxblnfk and wolfy-j as code owners July 28, 2026 09:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 15f34a7740

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread testing/src/SearchAttributeMocker.php Outdated
…ework (#654)

Workflow::upsertTypedSearchAttributes() timed out under the time-skipping
test-server because the Java test-server binary does not implement the
UpsertWorkflowTypedSearchAttributes command. Add a testing-framework mock,
mirroring the activity/child-workflow mockers (#778):

- MockSearchAttributeInterceptor swallows the typed upsert command (so the
  test-server never sees it) and records each update into a cross-process
  RoadRunner KV cache; untyped upsert is left untouched.
- SearchAttributeInvocationCache trio (interface + RoadRunner + InMemory)
  stores upserts as a single name->entry map.
- SearchAttributeMocker exposes assertUpserted / assertUpsertedValue /
  assertUnset / assertNotUpserted / wasUpserted / getUpserted /
  getUpsertedAttributes, wired into WorkflowTestCase.
- Fixture + functional (typed stub, full-set assertion) and unit tests.
@xepozz
xepozz force-pushed the feature/mock-typed-search-attributes branch from 15f34a7 to 63a3991 Compare July 28, 2026 09:24
…functional bootstrap

Launching RoadRunner via the relative './rr' executable and relative
config/-w paths resolves against the process cwd, which caused
intermittent 'sh: exec: ./rr: not found' failures in CI. Build absolute
paths for the rr binary, -c, -w and configFile, matching the acceptance
RRStarter.
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.

[Bug] upsertTypedSearchAttributes in test server

2 participants