Repository navigation
Fix common key shapes - #24
Merged
Merged
Conversation
`links` was keyed by `link_to`, which only Workspace links have, so any DocType with Document Links (link_doctype/link_fieldname) died with KeyError: 'link_to' and stopped `git diff`. DocType `states` (title, not state), fixtures without `name`, lists with no unique key and unhashable values crashed the same way, and Print Format format_data went through a pf_diff that referenced undefined names. Each parent now has candidate keys, checked against both lists: the first field must be set in every dict, and the first candidate that is unique wins. Workspace links fall back to (label, link_to) for Card Breaks, DocType links use (link_doctype, link_fieldname, parent_doctype), permissions add permlevel and if_owner, transitions are (state, action, next_state[, allowed]). Copies of a repeated known key are aligned by content. With no key, lists are aligned with difflib instead of compared by index. Auto-detected keys are now chosen in a fixed order rather than set order. Also: format_data is diffed as a parsed list, list/dict type changes no longer crash, scalar lists tolerate unhashable elements, and an added key is reported at its own path and line instead of the previous key's. Checked against the last 150 JSON commits of nine Frappe apps and 200 each of frappe, erpnext and hrms: no new crashes, 134 fixed, and every other output change reviewed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keys, values and labels were interpolated into rich markup unescaped, so data that looks like a tag was rendered instead of printed: Jinja such as `itemunitprice[i]` lost its `[i]` (italics), and an unmatched closing tag such as `[/x]` raised MarkupError and stopped `git diff`. Everything taken from the JSON is now passed through rich.markup.escape, in tree and table mode. Against the previous commit, output is byte-identical on the same commit history except where the data contains tag-like brackets. Co-Authored-By: Claude Opus 5.5 <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.
No description provided.