π§βπ» chore(logging): say which field failed to decode, not just that one did - #53
Open
hub2rock wants to merge 1 commit into
Open
π§βπ» chore(logging): say which field failed to decode, not just that one did#53hub2rock wants to merge 1 commit into
hub2rock wants to merge 1 commit into
Conversation
β¦ne did `DecodingError.localizedDescription` is always the same sentence β "the data couldn't be read because it isn't in the correct format" β so a schema drift between PLANKA versions arrived as an unfalsifiable "couldn't read the server's response", both on screen and in the log. Everything needed to locate it was already in the error's context; it was simply discarded. Both decode sites now log the diagnosis: `missing key 'role' at included.users[3]`, `expected Bool at included.users[0].isDeactivated`, and so on. The generic copy stays on screen β this is for the log. Only the shape is reported: coding path, expected type, reason. No decoded value reaches the log, so nothing a user typed can leak through it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Twice now a PLANKA schema drift has arrived as "couldn't read the server's response" β once for the terms payload, once on the projects screen β and both times finding the culprit meant querying the API by hand and diffing payloads against the models.
That guesswork was never necessary.
DecodingErrorknows exactly which key failed and where; it was being thrown away, becauselocalizedDescriptionon it is always the same sentence regardless of the cause.Change
Both decode sites now log the diagnosis alongside the type and path:
The generic copy stays on screen β this is for the log, where
BoardlyLog.tag(.network)already reports decode failures.Privacy
Only the shape is reported: coding path, expected type, reason. No decoded value is included, so nothing a user typed can reach the log through this. (
dataCorruptedcarries the decoder's owndebugDescription, which describes a format problem β a malformed date, say β not user content.)Tests
181 passing, 5 new, covering each
DecodingErrorkind, a failure at the root object, and non-decoding errors keeping their own description.Context
The projects-screen decode failure that prompted this is not fixed here β it is still unidentified, because the models match
planka-openapi.jsonexactly, so the drift is between the spec and the live server. This is what makes the next report diagnosable from a log line instead of a round of API archaeology.π€ Generated with Claude Code