Skip to content

fix: Keep vendor relation hints in step with the Card - #25

Merged
odolbeau merged 3 commits into
mainfrom
fix/vendor-relation-hints
Oct 3, 2026
Merged

odolbeau merged 3 commits into
mainfrom
fix/vendor-relation-hints

Conversation

@odolbeau

@odolbeau odolbeau commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Importing a contact, editing it, then exporting it for the same address book gave stale or broken labels.

  • RawProperty ignored a value set after reading. Apple's built-in labels kept in vCardProps were written back in their readable form (spouse instead of _$!<Spouse>!$_), even without any edit. Apple then showed them as custom labels.
  • A kept hint outlived a change of the relation. Change a spouse to a friend in place: Apple still showed a spouse, and the library read back ["friend", "spouse"]. Android kept writing the old X-ANDROID-TYPE, so the edit was lost entirely. A kept label or type now stays only while it agrees with the Card: a mother stays for a parent, a spouse goes for a friend. Apple keeps a custom label such as "Godmother", since TYPE holds the relation anyway. An Android row holds a single type, so it keeps a custom label only for a relation with no type.
  • Orphan labels. Remove a relation or an anniversary, and its X-ABLabel stayed alone in its group forever. The encoder now leaves it out and reports it as an issue.

Each point has its own commit and tests. The round-trip tests on the cozy-vcard exports still pass.

Not covered: an Apple anniversary whose kind changes keeps its _$!<Anniversary>!$_ label.

🤖 Generated with Claude Code

odolbeau and others added 3 commits October 3, 2026 16:55
Properties kept in vCardProps are written with their raw value, and a value
a dialect set afterwards was ignored: Apple's built-in labels, such as
_$!<Spouse>!$_, came back as the readable labels they are read as.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Apple label and the Android type a relation was read with were written
back as they were, even when the Card had changed the relation since: a
spouse turned friend stayed a spouse for the address book, and came back
as both.

A kept label or type now stays only while it agrees with the Card: a
mother stays for a parent, a spouse goes for a friend. Apple keeps a label
of the user's own, such as "Godmother", since TYPE holds the relation
anyway; an Android row holds a single type, so it keeps one only for a
relation with no type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An X-ABLabel kept in vCardProps outlived the property it labeled: remove a
relation or an anniversary read from Apple, and its label stayed alone in
its group, read and written again forever. The encoder now leaves it out,
and reports it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@odolbeau
odolbeau merged commit bb75de3 into main Oct 3, 2026
4 checks passed
@odolbeau
odolbeau deleted the fix/vendor-relation-hints branch October 3, 2026 14:57
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.

1 participant