Repository navigation
fix(durable): send alarm options as camelCase - #1100
Open
PedroRosalba wants to merge 1 commit into
Open
PedroRosalba wants to merge 1 commit into
PedroRosalba wants to merge 1 commit into
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GetAlarmOptionsandSetAlarmOptionsderiveSerializewithoutrename_all = "camelCase", soget_alarm_with_options,set_alarm_with_optionsanddelete_alarm_with_optionssendallow_concurrency/allow_unconfirmedto the runtime. workerd'sGetAlarmOptions/SetAlarmOptionsreadallowConcurrency/allowUnconfirmedand 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_optionsmethods, 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.