fix(rivetkit): decode legacy v4 actor schedule args#4976
Conversation
|
🚅 Deployed to the rivet-pr-4976 environment in rivet-frontend
|
Code Review: fix(rivetkit): decode legacy v4 actor schedule argsOverviewTargeted production hotfix adding a fallback decoder for v4 actor persist payloads written by a short-lived buggy writer that stored ScheduleEvent.args as raw data instead of optional Cbor. The fix is well-scoped and the approach is sound. What Works Well
Issues / Suggestions1. Ambiguous error when v4 decodes non-canonically and legacy also fails When current v4 decodes successfully but is non-canonical (current_error = None) and the legacy decoder also fails, the returned error is legacy_error. This gives no signal that v4 did decode but failed the round-trip check. A tracing::warn! when the non-canonical case is hit would make the path visible in production logs. 2. Missing happy-path and error-path test coverage The two tests cover the production legacy payload and the non-canonical v4 acceptance case. Missing:
3. serde_bare::to_vec failure is silently treated as non-canonical If serialization fails (e.g. OOM), is_ok_and returns false and falls through to the legacy decoder. This is safe but silently discards the serialization error. A tracing::warn from point 1 would cover this case too. SummaryThe fix is correct and safe for the stated production issue. The three points above are minor: the logging suggestion would improve debuggability, and the additional test cases would harden the regression suite. None are blockers for a production mitigation. LGTM with the logging suggestion as a nice-to-have. |
73e063a to
4ae780f
Compare
4ae780f to
33cc9e7
Compare
Preview packages published to npmInstall with: npm install rivetkit@pr-4976All packages published as Engine binary is shipped via Docker images: docker pull rivetdev/engine:slim-554eccf
docker pull rivetdev/engine:full-554eccfIndividual packagesnpm install rivetkit@pr-4976
npm install @rivetkit/react@pr-4976
npm install @rivetkit/rivetkit-napi@pr-4976
npm install @rivetkit/workflow-engine@pr-4976 |
25f115a to
e745719
Compare
33cc9e7 to
1f35f57
Compare

Stack Context
This PR mitigates a persisted Rivet Actor startup failure caused by a reused v4 actor-persist layout.
What?
Adds a v4 decode fallback for the short-lived legacy layout where scheduled event
argswas encoded as raw BAREdata, then normalizes it to the currentoptional<Cbor>shape.The current-v4 path is only accepted when it round-trips to canonical bytes. This avoids accidentally accepting legacy raw-v4 payloads that
serde_barecan decode because nonzero bool bytes are treated astrue.Adds raw-byte regression tests for:
01 80schedule-args payload found in production.Why?
Some production actors were written by an older v4 writer and later decoded by the fixed v4 schema. Because the persisted version stayed
4, startup failed withunexpected end of inputwhen decoding scheduled event args.Verification
cargo test -p rivetkit-actor-persistpassed.