Skip to content

Backport worker_may_ignore history handling#356

Open
d2army wants to merge 2 commits into
transfers-masterfrom
ian-yap/backport-worker-may-ignore-0-0-7
Open

Backport worker_may_ignore history handling#356
d2army wants to merge 2 commits into
transfers-masterfrom
ian-yap/backport-worker-may-ignore-0-0-7

Conversation

@d2army
Copy link
Copy Markdown

@d2army d2army commented May 9, 2026

Summary

  • Backport worker_may_ignore history handling from the 0.1.x line to transfers-master / 0.0.x without proto regeneration.
  • Make History::Event constructable when a history event has an attributes oneof unknown to the old generated proto, so worker_may_ignore can still be read.
  • Ignore known Nexus/options-updated events and unknown worker-ignorable events while preserving fail-closed behavior for non-ignorable unknown events.

Why (#1)

  • Temporal Cloud can attach new Nexus/options-updated history events that older 0.0.x Ruby workers do not understand.
  • On the 0.0.x line, History::Event#extract_attributes can receive nil for an unknown attributes oneof and raise before worker_may_ignore is read; making attribute extraction nil-safe keeps the compatibility bit reachable.

Why (#2)

  • StateManager#apply_event calls History::EventTarget.from_event(event) before its event-type case statement, so unknown event prefixes can raise before the final unsupported-event branch is reached.
  • This backport adds the upstream ignore paths for known safe event types and for unknown events marked worker_may_ignore=true, while still raising for unknown events that are not explicitly safe to ignore.

Temporal team confirmation

Confirmed with the Temporal team that the relevant server-injected event types (WORKFLOW_EXECUTION_OPTIONS_UPDATED, WORKFLOW_EXECUTION_PAUSED, WORKFLOW_EXECUTION_UNPAUSED, WORKFLOW_EXECUTION_TIME_SKIPPING_TRANSITIONED, and the two server-injected NEXUS_OPERATION_CANCEL_REQUEST_* events) carry worker_may_ignore=true consistently, including in existing histories. This makes the runtime-only patch sufficient — the worker_may_ignore rescue path handles them via the same flow upstream PR #355 uses, and proto regeneration is not required.

Test plan

  • RBENV_VERSION=3.0.6 bundle exec rspec -r temporal/connection/grpc spec/unit/lib/temporal/workflow/history/event_spec.rb spec/unit/lib/temporal/workflow/state_manager_spec.rb
  • RBENV_VERSION=3.0.6 ruby -c lib/temporal/workflow/history/event.rb && RBENV_VERSION=3.0.6 ruby -c lib/temporal/workflow/state_manager.rb && RBENV_VERSION=3.0.6 ruby -c spec/unit/lib/temporal/workflow/history/event_spec.rb && RBENV_VERSION=3.0.6 ruby -c spec/unit/lib/temporal/workflow/state_manager_spec.rb && git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant