Skip to content

fix(record-add): populate field labels from record type schema#1842

Merged
sk-keeper merged 1 commit intoreleasefrom
fix/KC-1163-record-field-labels
Mar 5, 2026
Merged

fix(record-add): populate field labels from record type schema#1842
sk-keeper merged 1 commit intoreleasefrom
fix/KC-1163-record-field-labels

Conversation

@maksimu
Copy link
Collaborator

@maksimu maksimu commented Mar 4, 2026

Summary

  • Records created via Commander were missing field label metadata, causing blank field names when retrieved through KSM
  • record-add used an empty string as default label when the schema had no explicit label override
  • Apply the same fix to the importer path for consistency

Root cause

The record type schema for standard fields (e.g. login, password, url) has entries like {"$ref": "login"} with no explicit label. 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 $ref as 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.pyRecordAddCommand.execute()
  • keepercommander/importer/imp_exp.pyprepare_record_add_or_update()
  • tests/test_kc1163_record_field_labels.py — unit tests (7 passing, verified in Docker)

Test plan

  • Unit tests pass in Docker (Python 3.11): docker run --entrypoint python ... -m pytest tests/test_kc1163_record_field_labels.py -v → 7 passed
  • Standard fields get label == $ref when no override
  • Explicit label overrides are preserved
  • Regression guard confirms old behavior produced blank labels

Refs: KC-1163

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
@sk-keeper sk-keeper merged commit 7f8cf38 into release Mar 5, 2026
2 of 4 checks passed
@sk-keeper sk-keeper deleted the fix/KC-1163-record-field-labels branch March 5, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants