Skip to content

fix!: write storage data with camelCase keys - #2320

Merged
vdusek merged 2 commits into
v2from
camelcase-storage
Oct 13, 2026
Merged

vdusek merged 2 commits into
v2from
camelcase-storage

Conversation

@vdusek

@vdusek vdusek commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

The storage clients wrote their JSON with snake_case keys because model_dump() was called without by_alias=True, although the models declare camelCase aliases matching Crawlee JS. This PR dumps by alias everywhere data is persisted:

  • FileSystemStorageClient: dataset, KVS and RQ metadata files, request files and KVS record metadata files.
  • RedisStorageClient and SqlStorageClient: request JSON, plus the KVS record metadata in Redis.

The Redis storage metadata documents stay snake_case. The client updates them in place through RedisJSON paths such as $.item_count, so renaming those keys would break existing Redis data.

Data written by v1 still loads, because the models validate by field name as well as by alias. A new test rewrites an RQ's files in the v1 format, reopens it and checks the metadata and requests. The v2 upgrade guide has a section on the change.

Closes: #1844

✍️ Drafted by Claude Code

BREAKING CHANGE: Storage clients write metadata and request JSON with camelCase keys. Data written by v1 still loads.
@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 13, 2026
@vdusek vdusek self-assigned this Oct 13, 2026
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (v2@f3483e5). Learn more about missing BASE report.

Additional details and impacted files
@@          Coverage Diff          @@
##             v2    #2320   +/-   ##
=====================================
  Coverage      ?   94.12%           
=====================================
  Files         ?      183           
  Lines         ?    13558           
  Branches      ?        0           
=====================================
  Hits          ?    12762           
  Misses        ?      796           
  Partials      ?        0           
Flag Coverage Δ
unit 94.12% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek marked this pull request as ready for review October 13, 2026 13:13

@apify-factory apify-factory left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good, nothing blocking.

@Mantisus Mantisus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@apify-approval-mirror apify-approval-mirror Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Mirroring approval from @Mantisus.

@vdusek
vdusek merged commit 24ea410 into v2 Oct 13, 2026
30 checks passed
@vdusek
vdusek deleted the camelcase-storage branch October 13, 2026 15:25
vdusek added a commit that referenced this pull request Oct 16, 2026
The storage clients wrote their JSON with snake_case keys because
`model_dump()` was called without `by_alias=True`, although the models
declare camelCase aliases matching Crawlee JS. This PR dumps by alias
everywhere data is persisted:

- `FileSystemStorageClient`: dataset, KVS and RQ metadata files, request
files and KVS record metadata files.
- `RedisStorageClient` and `SqlStorageClient`: request JSON, plus the
KVS record metadata in Redis.

The Redis storage metadata documents stay snake_case. The client updates
them in place through RedisJSON paths such as `$.item_count`, so
renaming those keys would break existing Redis data.

Data written by v1 still loads, because the models validate by field
name as well as by alias. A new test rewrites an RQ's files in the v1
format, reopens it and checks the metadata and requests. The v2 upgrade
guide has a section on the change.

Closes: #1844

*✍️ Drafted by Claude Code*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileSystemStorageClient writes snake_case data on disk instead of camelCase

4 participants