External services · rule
test.round_trip_failed
Field's decode and encode don't round-trip a recorded value.
Area 11, External services; not declinable; the next step is usually the agent's.
A field's encode: that doesn't give back what its decode: read from a
recording, so what the app sends isn't what the provider sent: here the
package reads the courier's EVE as the afternoon, and writes the
afternoon back as PM.
/// The courier's part of the days, which it writes as "AM" and "PM".library dayparts { /// The part of the day the courier's code names. function read_daypart(code: DaypartCode) fails DaypartUnknown -> Daypart { if (code == "AM") { return Daypart.morning } if (code == "PM" or code == "EVE") { return Daypart.afternoon } reject DaypartUnknown } /// The courier's code for a part of the day. function write_daypart(daypart: Daypart) -> DaypartCode { if (daypart == Daypart.morning) { return "AM" } return "PM" }}
{ "data": { "id": "{Text}", "daypart": "EVE" }}
FAIL bookings.create's recording decodes --> shared/providers/acme_couriers/v1/recordings/bookings.create.json:1 decode: `dayparts.read_daypart` and `dayparts.write_daypart` don't round-trip `bookings.create`'s recording recorded: "EVE" written: "PM" reason: A field's `encode:` writes back what its `decode:` read, so what the app sends is what the provider sent; `dayparts.write_daypart` doesn't give back the value `dayparts.read_daypart` read from the recording. next: Correct `dayparts.read_daypart` or `dayparts.write_daypart` so each undoes the other (agent) rule: test.round_trip_failed rerun: jadpo test shared/providers/acme_couriers/v1/recordings/bookings.create.json:1 --seed 1test failed: 1 failed, 1 recording test
Markdown for agents: /docs/errors/test.round_trip_failed.md.Built from Jadpo main at a707efb.