Skip to content

fix(durable): send alarm options as camelCase - #1100

Open
PedroRosalba wants to merge 1 commit into
cloudflare:mainfrom
PedroRosalba:fix/do-alarm-options-camelcase
Open

PedroRosalba wants to merge 1 commit into
cloudflare:mainfrom
PedroRosalba:fix/do-alarm-options-camelcase

Conversation

@PedroRosalba

Copy link
Copy Markdown

Problem

GetAlarmOptions and SetAlarmOptions derive Serialize without rename_all = "camelCase", so get_alarm_with_options, set_alarm_with_options and delete_alarm_with_options send allow_concurrency / allow_unconfirmed to the runtime. workerd's GetAlarmOptions / SetAlarmOptions read allowConcurrency / allowUnconfirmed and ignore unknown keys, so the options have been silently dropped since they were added (a61920a).

Fix

Add the serde attribute to both structs. A sweep of the other options structs in the crate found no other one with the same defect.

Tests

Binds the alarm Durable Object in the Miniflare harness and adds a route that sets, reads and deletes an alarm through the *_with_options methods, asserting the calls succeed and that the serialized options are camelCase.

Note: #1023 also touches worker/src/durable.rs (different lines, different bug); I will rebase if it lands first.

Tested on macOS (Apple Silicon) only.

`GetAlarmOptions` and `SetAlarmOptions` derive `Serialize` without
`rename_all = "camelCase"`, so `get_alarm_with_options`,
`set_alarm_with_options` and `delete_alarm_with_options` sent
`allow_concurrency` / `allow_unconfirmed` to the runtime. workerd's
`GetAlarmOptions` / `SetAlarmOptions` structs read `allowConcurrency` /
`allowUnconfirmed` and ignore unknown keys, so the options have been
silently dropped since they were added (a61920a).

Add the serde attribute to both structs. The test binds the alarm
Durable Object in the Miniflare harness and adds a route that sets, reads
and deletes an alarm through the `*_with_options` methods, asserting the
calls succeed and that the serialised options are camelCase.
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.

1 participant