fix(record-add): populate field labels from record type schema#1842
Merged
fix(record-add): populate field labels from record type schema#1842
Conversation
Records created via Commander were missing field label metadata because the record-add command used an empty string as default when the schema field had no explicit label override. This caused blank field names when records were retrieved via KSM. Use the field $ref type as the default label when no explicit label is defined in the record type schema, matching the behavior of the web vault which consistently populates labels for all schema-defined fields. Affected paths: - RecordAddCommand.execute() in commands/record_edit.py - prepare_record_add_or_update() in importer/imp_exp.py Refs: KC-1163
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.
Summary
record-addused an empty string as default label when the schema had no explicit label overrideRoot cause
The record type schema for standard fields (e.g. login, password, url) has entries like
{"$ref": "login"}with no explicitlabel. The old code defaulted to'', producing blank labels. The web vault uses the field type as the label in this case.Fix:
rf.get('label', '')→rf.get('label') or ref— use$refas the default label when no override is defined.Explicit label overrides (e.g.
{"$ref": "text", "label": "cardholderName"}for bank cards) are preserved unchanged.Files changed
keepercommander/commands/record_edit.py—RecordAddCommand.execute()keepercommander/importer/imp_exp.py—prepare_record_add_or_update()tests/test_kc1163_record_field_labels.py— unit tests (7 passing, verified in Docker)Test plan
docker run --entrypoint python ... -m pytest tests/test_kc1163_record_field_labels.py -v→ 7 passedlabel == $refwhen no overrideRefs: KC-1163