Skip to content

Conversation

@soxft
Copy link
Owner

@soxft soxft commented Oct 31, 2025

Summary

  • describe how each Redis data type is persisted into the SQLite snapshots in both READMEs
  • annotate the snapshotRecord model with comments explaining the normalisation strategy

Testing

  • go test ./... (fails because go mod tidy would need to download modules in the offline environment)

https://chatgpt.com/codex/tasks/task_b_68edbb370704832cac805263cf5d1a29

Copy link

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

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.

ℹ️ 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 on lines +586 to +593
var rows []struct {
Key string `json:"key"`
Category string `json:"category"`
SiteUnique string `json:"site_unique"`
PathUnique *string `json:"path_unique"`
Count int64 `json:"count"`
Payload string `json:"payload"`
PayloadTyp string `json:"payload_type"`

Choose a reason for hiding this comment

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

P0 Badge Allow NULL payloads when unmarshalling snapshots

The restore query returns payload as null for counter snapshots where no payload is stored. Unmarshalling that JSON into the Payload string field fails with json: cannot unmarshal null into Go value of type string, causing RestoreLatest to abort and skip restoring any keys. Use a nullable field (e.g. *string or json.RawMessage) so counter rows can be decoded and restoration proceeds.

Useful? React with 👍 / 👎.

Comment on lines +673 to +677
case categorySiteUV, categoryPageUV:
if len(rec.Payload) == 0 {
return errors.New("empty payload for hyperloglog restore")
}
return client.RestoreReplace(ctx, rec.Key, ttl, rec.Payload).Err()

Choose a reason for hiding this comment

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

P0 Badge RestoreReplace called with []byte payload

rec.Payload is a []byte, but redis.Client.RestoreReplace takes the serialized value as a string. Passing a byte slice will not compile and prevents the persistence module from building. Convert the payload to a string (or store it as a string) before calling RestoreReplace.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants