Skip to content

DOC-4758 async JSON doc examples #3335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 11, 2025

Conversation

andy-stark-redis
Copy link
Contributor

@andy-stark-redis andy-stark-redis commented Jun 25, 2025

Make sure that:

  • You have read the contribution guidelines.
  • You applied code formatting rules using the mvn formatter:format target. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.

DOC-4758

Lettuce async examples for the JSON landing page and the Path page.

Note: I've used arrInsert() instead of arrAppend() on line 195 because the arrAppend() method doesn't seem to work when the array is at the root path. The implementation seems to assume that the path argument is optional when the path is the root, as it says in the command doc page. However, I think the docs might be wrong, because this doesn't work in the CLI either. I'll look into this.

@andy-stark-redis andy-stark-redis marked this pull request as ready for review June 25, 2025 13:38
Copy link
Collaborator

@tishun tishun left a comment

Choose a reason for hiding this comment

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

I initially commented that some of the verifications did not need to use .toString() but could instead use the JsonValue object hierarchy. However since all of the inside the REMOVE_START / REMOVE_END blocks I think we can leave them as they are, as this way it is simpler.

Typically, in Java, it is not recommended to rely on the implementation of the toString method as the string representation of any object could be changed without this being constituted as contract violation.

@tishun tishun added this to the Async milestone Jul 8, 2025
@tishun tishun merged commit 371beb0 into redis:main Jul 11, 2025
8 checks passed
kiryazovi-redis added a commit that referenced this pull request Jul 28, 2025
* DOC-4758 async JSON doc examples (#3335)

* DOC-4758 added landing page examples

* DOC-4758 added Path page examples

* DOC-4758 work around arrAppend issue

* DOC-4758 applied formatting

* WIP: staging changes before rebase to lettuce-observability

* Fix MOVING push notification capture using PushListener API

- Fixed receiveMovingPushNotificationTest to properly capture MOVING messages
- Switched from flawed ping-based approach to proper PushListener API
- Added ByteBuffer decoding to extract actual IP addresses from push messages
- Enhanced two-step rebind process (migrate + bind) working correctly
- Successfully capturing RESP3 push messages: MOVING, MIGRATING, MIGRATED, etc.
- Test now passes and captures real MOVING notifications during endpoint rebind

The test now properly hooks into Lettuce's protocol layer to capture
RESP3 push messages that come before command responses, solving the
core issue where we were only seeing PONG responses.

* CAE-633: Fix Redis Enterprise cluster configuration discovery and push notification tests

- Fixed stale cluster configuration issue in RedisEnterpriseConfigDiscovery
- Added proper cache clearing in parseShards() method to get fresh master/slave lists
- Added getNodeWithMasterShards() method for proper node selection in failover tests
- Fixed infinite retry loops in FaultInjectionClient validation
- Updated MaintenanceNotificationTest to use dynamic node selection for both FAILING_OVER and FAILED_OVER tests
- Added CONTEXT_MOVING_PUSH_NOTIFICATIONS.md to .gitignore
- All push notification tests now working with real-time dynamic cluster discovery

* Fix critical bugs in push notification tests - all tests now passing

- Fix double-prefixing bug in shard ID state recording
  * originalShardRoles.put(masterShard, 'master') instead of 'redis:' + masterShard
  * Prevents malformed redis:redis:1 IDs that broke state restoration

- Increase migration timeout from 120s to 300s in FaultInjectionClient
  * Migration operations move actual data and need more time than failovers
  * Fixes receiveMigratedPushNotificationTest timeout failures

- Fix cluster state restoration logic to only failover master shards
  * Redis Enterprise constraint: only master shards can be failed over
  * Prevents 'ERROR: No such master shard id' when trying to failover slaves
  * Only targets current masters that should become slaves

- Complete test suite now passing: 5/5 tests successful
  * MOVING, MIGRATING, MIGRATED, FAILING_OVER, FAILED_OVER notifications
  * Dynamic cluster discovery with proper state isolation
  * Real-time adaptation to cluster state changes between test runs

Tests run: 5, Failures: 0, Errors: 0, Skipped: 0

* refactor: Clean up scenario folder - remove legacy methods and magic numbers

- Remove all legacy methods with hardcoded defaults from FaultInjectionClient:
  * triggerShardMigration(String, String) - 2-parameter version
  * triggerShardFailover(String, String) - 2-parameter version
  * triggerShardFailover(String, String, String) - 3-parameter version
  * triggerMovingNotification(String, String, String) - 3-parameter version
  * validateRladminCommandCompletion() - useless method

- Replace magic numbers with meaningful constants across scenario folder:
  * Use Duration.ofMinutes() for long timeouts (300s->5min, 180s->3min, etc.)
  * Add descriptive constants for all timeout values
  * Improve code readability and maintainability

- Update tests to use 4-parameter dynamic discovery methods
- Fix Jackson import to use proper import instead of full package name
- Update maintenance operation system to handle missing legacy methods

All tests pass and compilation successful.

* Fix StepVerifier timeout issues and remove .vscode/settings.json from tracking

- Increase StepVerifier timeout for long-running operations (migrations/failovers)
- Change from .verifyComplete() to .expectComplete().verify(LONG_OPERATION_TIMEOUT)
- All tests now complete successfully without timing out
- Remove .vscode/settings.json from git tracking

---------

Co-authored-by: andy-stark-redis <[email protected]>
svc-squareup-copybara pushed a commit to cashapp/misk that referenced this pull request Aug 8, 2025
| Package | Type | Package file | Manager | Update | Change |
|---|---|---|---|---|---|
| [io.lettuce:lettuce-core](https://github.com/redis/lettuce) |
dependencies | misk/gradle/libs.versions.toml | gradle | minor |
`6.7.1.RELEASE` -> `6.8.0.RELEASE` |
| [com.squareup.wire](https://github.com/square/wire) | plugin |
misk/gradle/libs.versions.toml | gradle | patch | `5.3.7` -> `5.3.8` |
| [com.squareup.wire:wire-schema](https://github.com/square/wire) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7`
-> `5.3.8` |
| [com.squareup.wire:wire-runtime](https://github.com/square/wire) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7`
-> `5.3.8` |
| [com.squareup.wire:wire-reflector](https://github.com/square/wire) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7`
-> `5.3.8` |
| [com.squareup.wire:wire-moshi-adapter](https://github.com/square/wire)
| dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`5.3.7` -> `5.3.8` |
| [com.squareup.wire:wire-grpc-client](https://github.com/square/wire) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7`
-> `5.3.8` |
| [com.squareup.wire:wire-bom](https://github.com/square/wire) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch | `5.3.7`
-> `5.3.8` |

---

### Release Notes

<details>
<summary>redis/lettuce (io.lettuce:lettuce-core)</summary>

###
[`v6.8.0.RELEASE`](https://github.com/redis/lettuce/releases/tag/6.8.0.RELEASE)

[Compare
Source](redis/lettuce@6.7.1.RELEASE...6.8.0.RELEASE)

The Lettuce team is pleased to announce the Lettuce 6.8.0 minor release!

This release provides support for the newly introduced [Redis Query
Engine
support](https://redis.github.io/lettuce/user-guide/redis-search/) which
was is part of Redis 8.0 and previously - as part of RedisStack. The new
operators (`DIFF`, `DIFF1`, `ANDOR` and `ONE`) for the `BITOP` command
are also available. The team has worked on extending the contract of the
`XADD` and `XTRIM ` commands to support trimming policy, and also
introduced the new `XDELEX` and `XACKDEL` commands.

Lettuce 6.8.0 supports Redis 2.6+ up to Redis 8.x. In terms of Java
runtime, Lettuce requires at least Java 8 and
works with Java 24. The driver is tested against Redis 8.2, Redis 8.0,
Redis 7.4 and Redis 7.2.

Find the full changelog at the end of this document.
Thanks to all contributors who made Lettuce 6.8.0.RELEASE possible.

📗 Links
Reference documentation:
https://lettuce.io/core/6.8.0.RELEASE/reference/
Javadoc: https://lettuce.io/core/6.8.0.RELEASE/api/

⭐ New Features
Introduce RediSearch by [@&#8203;tishun](https://github.com/tishun) in
redis/lettuce#3375
Add support for new operations of BITOP command in Redis Community
Edition 8.2 by [@&#8203;atakavci](https://github.com/atakavci) in
redis/lettuce#3334
Add support for 8.2 stream commands by
[@&#8203;uglide](https://github.com/uglide) in
redis/lettuce#3374

🐞 Bug Fixes
NoClassDefFoundError in Lettuce 6.7.0
[#&#8203;3317](redis/lettuce#3317) by
[@&#8203;tishun](https://github.com/tishun) in
redis/lettuce#3318

💡 Other
The instance of the `ObjectMapper` can now be reused in the
`DefaultJsonParser` by [@&#8203;thachlp](https://github.com/thachlp) in
redis/lettuce#3372
Added basic connection interruption tests by
[@&#8203;uglide](https://github.com/uglide) in
redis/lettuce#3292
DOC-4758 async JSON doc examples by
[@&#8203;andy-stark-redis](https://github.com/andy-stark-redis) in
redis/lettuce#3335
Fixed SocketOptions.Builder validation messages by
[@&#8203;hubertchylik](https://github.com/hubertchylik) in
redis/lettuce#3366
Refactor tests for clarity and maintainability by
[@&#8203;Rian-Ismael](https://github.com/Rian-Ismael) in
redis/lettuce#3363
Provide support for the SVS-VMANA index
([#&#8203;3385](redis/lettuce#3385)) by
[@&#8203;tishun](https://github.com/tishun) in
redis/lettuce#3386

❤️ New Contributors## New Contributors

- [@&#8203;hubertchylik](https://github.com/hubertchylik) made their
first contribution in redis/lettuce#3366

**Full Changelog**:
redis/lettuce@6.7.0.RELEASE...6.8.0.RELEASE

</details>

<details>
<summary>square/wire (com.squareup.wire)</summary>

###
[`v5.3.8`](https://github.com/square/wire/blob/HEAD/CHANGELOG.md#Version-538)

[Compare Source](square/wire@5.3.7...5.3.8)

*2025-08-08*

##### Swift

- Fix edge case for oneof field named `self`
([#&#8203;3360](square/wire#3360) by
\[Dimitris Koutsogiorgas]\[dnkoutso])

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 6pm every weekday,before 2am
every weekday" in timezone Australia/Melbourne, Automerge - At any time
(no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://github.com/renovatebot/renovate).

GitOrigin-RevId: f26d0f3a5bf8e0f695433640efc9d6e93850ab60
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