Skip to content

Conversation

@robholland
Copy link

What was changed

Added example of claim check pattern.

Checklist

  1. Closes

  2. How was this tested:
    Run locally.

  3. Any docs updates needed?

robholland added a commit to temporalio/documentation that referenced this pull request Oct 7, 2025
robholland added a commit to temporalio/documentation that referenced this pull request Oct 7, 2025
Make sure we mention the codec server in the README as well as the recipe.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ robholland
❌ jssmith
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Collaborator

@jssmith jssmith left a comment

Choose a reason for hiding this comment

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

I pushed some changes to the README to clarify that this for both large payloads and for compliance.

A few of notes for discussion:

  • Does this fail without the Claim Check codec?
  • Could we make the example more AI-relevant?
  • Should we add S3 and PostgreSQL/SQLAlchemy to this recipe, or should we do that separately?
  • Should we add compression to this recipe?

@jssmith
Copy link
Collaborator

jssmith commented Oct 13, 2025

Also, we should discuss lifecycle management, e.g., how to set the TTL for Redis.

@robholland
Copy link
Author

I don't think including S3 or Postgres adds any value. The codec system needs the simplest of PUT/GET style operations from whichever datastore is used.

Copy link

@drewhoskins-temporal drewhoskins-temporal left a comment

Choose a reason for hiding this comment

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

Awesome! I think users will get a lot out of this and its really helpful to see this for the payload storage workstream as well.


## Claim Check Codec Implementation

The `ClaimCheckCodec` implements `PayloadCodec` and adds an inline threshold to keep small payloads inline for debuggability.
Copy link

@drewhoskins-temporal drewhoskins-temporal Oct 22, 2025

Choose a reason for hiding this comment

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

debuggability and latency presumably. Also, I might infer from this that one can't debug the payloads that you're offloading, but having read the rest of the PR, that's not what you mean.


```python
class ClaimCheckCodec(PayloadCodec):
def __init__(self, redis_host: str = "localhost", redis_port: int = 6379, max_inline_bytes: int = 20 * 1024):

Choose a reason for hiding this comment

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

max_inline_bytes: Say why you chose this number. Or admitting that you didn't have a great reason is valuable too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's important that we give a reason / help people think through how they can set this number.

*File: claim_check_plugin.py*

```python
class ClaimCheckPlugin(Plugin):

Choose a reason for hiding this comment

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

Use SimplePlugin here

self._next_plugin = next_plugin

def configure_client(self, config: ClientConfig) -> ClientConfig:
default_converter_class = config["data_converter"].payload_converter_class

Choose a reason for hiding this comment

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

Why is this being called the "default" in this context?

return out

# Endpoint to view raw payload data
async def view_raw_data(req: web.Request) -> web.Response:

Choose a reason for hiding this comment

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

For the debugging-in-temporal-UI use case, I'm thinking users would want to have a JSON pretty printer when the content-type was that?

Copy link
Author

Choose a reason for hiding this comment

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

Not sure what you mean here, within the Temporal UI we only show this summary for externally stored payloads. Do you mean when they follow the link the codec server should pretty print the raw payload if it was JSON?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, for some reason my editor shows your comments against the wrong line number :/ I think pretty printing or otherwise should be left to the reader.

payload_codec=claim_check_codec
)

# Delegate to next plugin if it exists

Choose a reason for hiding this comment

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

@Quinn-With-Two-Ns check on composability

Choose a reason for hiding this comment

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

left a comment above , will recheck if we switch to SimplePlugin


config["data_converter"] = DataConverter(
payload_converter_class=default_converter_class,
payload_codec=claim_check_codec

Choose a reason for hiding this comment

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

If there is already a payload_codec I think you are dropping it

Choose a reason for hiding this comment

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

Copy link
Collaborator

@jssmith jssmith left a comment

Choose a reason for hiding this comment

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

Added comments.

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.

6 participants