Skip to content

Make MetaDataProtoEditor always rename the canonically named union field - #4731

Open
robert-brunel wants to merge 1 commit into
apple/robert-brunel/renameRecordTypes-5from
apple/robert-brunel/renameRecordTypes-6
Open

robert-brunel wants to merge 1 commit into
apple/robert-brunel/renameRecordTypes-5from
apple/robert-brunel/renameRecordTypes-6

Conversation

@robert-brunel

@robert-brunel robert-brunel commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

When several union fields reference a renamed record type, renameRecordType() and renameRecordTypes() now always rename the one that is canonically named. Previously, a field with a higher number could “displace” it, which would result in the canonical field keeping its old name. This could also cause a batch rename that swaps two type names to be spuriously rejected with “Cannot rename union field because a field of the new name already exists”.

RecordMetaDataBuilder writes the records of a type under its canonically named union field if there is one, and otherwise under the one with the highest number. So the old behavior also effectively moved the records of the renamed type to the higher-numbered field. With this change, the editor now selects the union field by the same rule as RecordMetaDataBuilder, so that records keep getting written under the original field.

Follow-up to #4536. Resolves #4732.

@robert-brunel robert-brunel added the bug fix Change that fixes a bug label Oct 9, 2026
@robert-brunel
robert-brunel added this pull request to stack #4538 October 9, 2026 18:13
@robert-brunel robert-brunel self-assigned this Oct 9, 2026
@robert-brunel
robert-brunel force-pushed the apple/robert-brunel/renameRecordTypes-6 branch from 6333e4e to 6e1907c Compare October 9, 2026 18:47
@robert-brunel
robert-brunel force-pushed the apple/robert-brunel/renameRecordTypes-6 branch from 6e1907c to 8a7cc09 Compare November 3, 2026 13:10
@robert-brunel
robert-brunel force-pushed the apple/robert-brunel/renameRecordTypes-6 branch 2 times, most recently from 2883cd5 to f56806c Compare November 9, 2026 13:29
@robert-brunel
robert-brunel force-pushed the apple/robert-brunel/renameRecordTypes-6 branch 2 times, most recently from 9d190d8 to 7fca050 Compare November 9, 2026 14:37
@robert-brunel
robert-brunel force-pushed the apple/robert-brunel/renameRecordTypes-6 branch 2 times, most recently from 9b3c4fb to 0d189bc Compare November 9, 2026 15:31
@robert-brunel
robert-brunel marked this pull request as ready for review November 9, 2026 15:32
…field

When several union fields reference a renamed record type, `renameRecordType()` and `renameRecordTypes()` now always rename the one that is canonically named. Previously, a field with a higher number could “displace” it, which would result in the canonical field keeping its old name. This could also cause a batch rename that swaps two type names to be spuriously rejected with “Cannot rename union field because a field of the new name already exists”.

`RecordMetaDataBuilder` writes the records of a type under its canonically named union field if there is one, and otherwise under the one with the highest number. So the old behavior also effectively moved the records of the renamed type to the higher-numbered field. With this change, the editor now selects the union field by the same rule as `RecordMetaDataBuilder`, so that records keep getting written under the original field.

Follow-up to #4536. Resolves #4732.
@robert-brunel
robert-brunel force-pushed the apple/robert-brunel/renameRecordTypes-6 branch from 0d189bc to f051ae2 Compare November 9, 2026 15:37

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Change that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MetaDataProtoEditor record type renames can leave the canonical union field unrenamed

1 participant