Skip to content

Refactor MetaDataProtoEditor.renameRecordType() - #4537

Draft
robert-brunel wants to merge 1 commit into
apple/robert-brunel/renameRecordTypes-2from
apple/robert-brunel/renameRecordTypes-3
Draft

Refactor MetaDataProtoEditor.renameRecordType()#4537
robert-brunel wants to merge 1 commit into
apple/robert-brunel/renameRecordTypes-2from
apple/robert-brunel/renameRecordTypes-3

Conversation

@robert-brunel

@robert-brunel robert-brunel commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Remove redundant code from the original renameRecordType() implementation by reusing the primitives introduced for the batched version renameRecordTypes(). Both public methods now delegate to a shared applyRecordTypeRenames() method, which orders the steps so that every validation happens before the first mutation.

This refactoring does not affect the behavior, with two exceptions:

  • Renaming the canonical union field to a name that collides with another field now results in a MetaDataException being thrown from validateUnionFieldRenames(), instead of silently leaving the field under its old name.
  • The check that rejects a rename colliding with an imported record type now runs for every usage, where previously it ran only for RECORD-usage types. Renaming a NESTED type, or the union type, onto the name of an imported record type used to succeed, leaving the metadata with a name that resolves ambiguously.

Remove redundant code from the original `renameRecordType()` implementation by reusing the primitives introduced for the batched version `renameRecordTypes()`. Both public methods now delegate to a shared `applyRecordTypeRenames()` method, which orders the steps so that every validation happens before the first mutation.

This refactoring does not affect the behavior, with two exceptions:

* Renaming the canonical union field to a name that collides with another field now results in a `MetaDataException` being thrown from `validateUnionFieldRenames()`, instead of silently leaving the field under its old name.
* The check that rejects a rename colliding with an imported record type now runs for every usage, where previously it ran only for `RECORD`-usage types. Renaming a `NESTED` type, or the union type, onto the name of an imported record type used to succeed, leaving the metadata with a name that resolves ambiguously.
@robert-brunel robert-brunel added the breaking change Changes that are not backwards compatible label Aug 28, 2026
@robert-brunel robert-brunel self-assigned this Aug 28, 2026
@robert-brunel robert-brunel added the enhancement New feature or request label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Changes that are not backwards compatible enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant