Skip to content

Role merge and rename #2476

Closed as not planned
Closed as not planned

Description

@shelltr

The taxonomy-side twin of person merge (which already exists).

The situation

A scrape hits a title with no matching alias. Under the new ingest behaviour it lands as a provisional role term rather than being dropped. Later, a human recognises it as an existing canonical role under a different name — and needs to merge it.

This is structurally the same operation as merging two people, and it needs the same care: the two identities collapse into one and their histories must combine, not be lost.

Operations to support

Merge role B into role A

  • Append a merge event; do not rewrite the observation log (it is append-only).
  • Project history through the merge: first_seen_at for the merged role = the earlier of A's and B's.
  • Record the alias. role_aliases.source already has a 'learned' value in migration 095 — this is exactly what it is for. Once learned, the next scrape normalizes that title automatically without a human.

Rename role A

  • Display-string change only. Identity (role_terms.id) is preserved, so no history resets.
  • This only works if everything downstream references the term id and never the display string — enforced by the taxonomy issue.

Open question

Does a locality override create a distinct role identity?

role_terms is unique on (value, jurisdiction_ocdid), so an override is a new row. The proposal is that it must not be a new identity — otherwise every locality override forks history for the people it touches. Worth confirming the semantics we want before building the merge UI, because merge and override interact: merging a provisional local role into a state canonical is the common case.

Depends on

  • Taxonomy re-rooted, roles keyed on role_terms.id
  • Observation log exists and is merge-projectable
  • Ingest change (provisional roles must exist to be merged)

Related

Person merge is already implemented — reuse its patterns and, where possible, its UI shape. See the review/merge model in civicpatch.org/src/frontend/components/review/merge-model.ts.


Part of the temporal-roles work — see the tracking issue for ordering.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions