Skip to content

[Visibility][Elasticsearch] Change datetime format to always include nanos component in pagination filter - #11564

Merged
rodrigozhou merged 2 commits into
mainfrom
rodrigozhou/fix-es-pagination
Aug 14, 2026
Merged

rodrigozhou merged 2 commits into
mainfrom
rodrigozhou/fix-es-pagination

Conversation

@rodrigozhou

@rodrigozhou rodrigozhou commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

What changed?

Change datetime format to always include nanos component in pagination filter in Elasticsearch Visibility.
Also added Visibility integration tests with Elasticsearch.

Why?

With Elasticsearch, comparing dates without explicitly specifying all components can lead to unexpected results.
Eg: StartTime = '2023-04-05T06:07:08Z' would match a workflow with StartTime = '2023-04-05T06:07:08.100000000Z'.
This behavior is unexpected and can mess up with pagination.
This PR fixes it so missing nanos components is always specified (in the example, it would be filled with 0s).

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

@rodrigozhou
rodrigozhou requested a review from a team August 13, 2026 22:11
@rodrigozhou
rodrigozhou requested review from a team as code owners August 13, 2026 22:11
@rodrigozhou
rodrigozhou force-pushed the rodrigozhou/fix-es-pagination branch from 52b60cb to ceb488d Compare August 13, 2026 22:19

@yiminc yiminc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

limit the change to the pagination filter, to avoid broader behavior change.

@rodrigozhou
rodrigozhou force-pushed the rodrigozhou/fix-es-pagination branch from ceb488d to 60e9007 Compare August 14, 2026 18:29
@rodrigozhou
rodrigozhou force-pushed the rodrigozhou/fix-es-pagination branch from 60e9007 to 260aae9 Compare August 14, 2026 18:39
@rodrigozhou
rodrigozhou requested a review from yiminc August 14, 2026 18:39
@rodrigozhou rodrigozhou added the reliability-2026 Reliability related changes label Aug 14, 2026
@rodrigozhou
rodrigozhou requested a review from yycptt August 14, 2026 18:42
awln-temporal
awln-temporal approved these changes Aug 14, 2026 •
@rodrigozhou
rodrigozhou merged commit adaa8f0 into main Aug 14, 2026
94 checks passed
@rodrigozhou
rodrigozhou deleted the rodrigozhou/fix-es-pagination branch August 14, 2026 23:11
@rodrigozhou rodrigozhou changed the title [Visibility][Elasticsearch] Change datetime format to always include nanos component [Visibility][Elasticsearch] Change datetime format to always include nanos component in pagination filter Aug 17, 2026
stpierre pushed a commit that referenced this pull request Aug 19, 2026
…nanos component (#11564) (#11619)

## What changed?
Cherry pick #11564 to `cloud/v1.32.0-161` branch.

## Why?
^

## 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
awln-temporal added a commit that referenced this pull request Sep 3, 2026
## What changed?

Backports the remaining merged PRs labeled
[release/1.32.0](https://github.com/temporalio/temporal/issues?q=state%3Aclosed%20label%3Arelease%2F1.32.0)
onto release/v1.32.x, in main merge order:

- [#11599](#11599) Optimize
Visibility PostgreSQL upgrade schema v1.14
- [#11723](#11723) Validate
history pagination branch token against mutable state
- [#11800](#11800) Capture
panics in Visibility query converter
- [#11813](#11813) Capture
panic in ServiceErrorInterceptor
- [#11829](#11829) Return
empty Elasticsearch page token when the result is smaller than the page
- [#11839](#11839) Fix
FirstWorkflowTaskBackoff accumulation upon Continue-As-New
- [#11801](#11801) Fix
Visibility SQL query conversion

[#11265](#11265) and
[#11564](#11564) were already
present on release/v1.32.x and are not duplicated here.

## Testing

- Targeted unit tests for Visibility query conversion, RPC interception,
History branch-token validation, and Continue-As-New backoff
- make GOLANGCI_LINT_FIX=false
GOLANGCI_LINT_BASE_REV=origin/release/v1.32.x lint-code

---------

Co-authored-by: Rodrigo Zhou <[email protected]>
Co-authored-by: Prathyush PV <[email protected]>
Co-authored-by: Yichao Yang <[email protected]>
simvlad pushed a commit that referenced this pull request Sep 12, 2026
…nanos component (#11564)

Change datetime format to always include nanos component in
Elasticsearch Visibility.
Also added Visibility integration tests with Elasticsearch.

With Elasticsearch, comparing dates without explicitly specifying all
components can lead to unexpected results.
Eg: `StartTime = '2023-04-05T06:07:08Z'` would match a workflow with
`StartTime = '2023-04-05T06:07:08.100000000Z'`.
This behavior is unexpected and can mess up with pagination.
This PR fixes it so missing nanos components is always specified (in the
example, it would be filled with 0s).

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

(cherry picked from commit adaa8f0)

Backport notes:
- The CI change is adapted: release/v1.30.x starts containers through the
  integration-test job's compose service list, so elasticsearch is added there
  rather than to a CONTAINERS env var.
- tests/testcore/test_cluster.go keeps this branch's esConfig field and archiver
  wiring; only the index setup/teardown helpers move to persistence-tests.
- The visibility suite uses require.EventuallyWithT instead of
  common/testing/await, searchattribute.EncodeValue instead of
  sadefs.MustEncodeValue, and drops the serializer argument to
  visibility.NewManager, none of which exist on this branch.
- The errors.AsType refactor in visibility_store.go is left as errors.As, since
  this branch targets Go 1.25.
- persistencetests.SetupEsIndex keeps this branch's PutMapping call for
  searchattribute.TestEsNameTypeMap().Custom(). main's copy of that helper no
  longer registers the custom search attributes, and without them the ES and
  OpenSearch functional tests query fields the index does not map.
simvlad added a commit that referenced this pull request Sep 14, 2026
## What changed?
Cherry-picks the PRs labeled `release/1.31.3` onto `release/v1.31.x`.
Merge conflicts were confined to test and CI code (plus the dependency
pins in `go.mod`/`go.sum`)

List of PRs:
- #11190 - Update sqlparser
dependency
- #11265 - Update ringpop-go
and tchannel-go
- #11409 - Update sqlparser
to v0.1.0
- #11564 -
[Visibility][Elasticsearch] Change datetime format to always include
nanos component
- #11599 - Optimize
Visibility PostgreSQL upgrade schema v1.14
- #11723 - Validate history
pagination branch token against mutable state

Also contains additional fixes:
- Fixes the broken tests in CI after
#12037: [Enable the
test-invoke compute provider for
DeploymentVersionSuite](e9390b3)

## Why?
Security and reliability patch release for 1.31.3.

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

## Potential risks
N/A

---------

Co-authored-by: Rodrigo Zhou <[email protected]>
Co-authored-by: Prathyush PV <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
simvlad added a commit that referenced this pull request Sep 14, 2026
## What changed?
Cherry-picks the PRs labeled `release/1.30.7` onto `release/v1.30.x`,
excluding #11014, which will
be cherry picked independently

List of PRs:
- #11190 - Update sqlparser
dependency
- #11265 - Update ringpop-go
and tchannel-go
- #11409 - Update sqlparser
to v0.1.0
- #11564 -
[Visibility][Elasticsearch] Change datetime format to always include
nanos component
- #11723 - Validate history
pagination branch token against mutable state

Conflicts were in the dependency pins in `go.mod`/`go.sum`, in test and
CI code, and in one production file:

- `service/history/configs/config.go` - `NewConfig` on `main` has a
`SendRawHistoryBytesToMatchingService` entry that does not exist on this
branch. Kept this branch's two `SendRaw*` entries and added only
`EnablePaginationTokenBranchValidation` and
`EnablePaginationTokenBranchValidationShadowMode`.

Two production edits were also needed where git reported no conflict:

-
`common/persistence/visibility/store/elasticsearch/visibility_store.go`
- #11564 carries an
incidental refactor to `errors.AsType[*query.ConverterError]`, a Go 1.26
stdlib API. This
branch's `go` directive is 1.25.11, so those two call sites are left as
`errors.As`.
- `.github/workflows/run-tests.yml` - #11564 adds `elasticsearch` to a
`CONTAINERS` env var that
  does not exist here.

## Why?
Security and reliability patch release for 1.30.7.

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

## Potential risks
`EnablePaginationTokenBranchValidation` defaults to `true`, so #11723's
rejection path is live as
soon as this ships.

---------

Co-authored-by: Rodrigo Zhou <[email protected]>
Co-authored-by: Prathyush PV <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants