class RenameMap:
Identity correspondence derived by event-sourced op-log replay.
Despite the historical name, this value object no longer "folds renames":
it is the product of replaying the whole op-log over the baseline to assign
every entity a stable identity (see _replay_identities). It exposes
exactly the identity correspondence the structural diff (ADR 0001) cannot
infer from the two dict states alone — baseline name <-> current name, by
identity — plus per-op-log-position resolution of an op's call-time names to
the current name of whichever entity bore that name at the op's position.
Round-trips (A->B->A) collapse naturally (final name == baseline name => no entry) and recycles bind distinct identities (a recycled name's new identity has no baseline name => it is added, never matched to the original baseline entity).
| Method | class |
Return the current name of a class given its baseline identity. |
| Method | property |
Return the current name of a property given its baseline identity. |
| Method | resolve |
Resolve an op-log entry's call-time class name to its current name. |
| Method | resolve |
Resolve an op-log entry's call-time (class, prop) to current names. |
| Instance Variable | class |
{baseline_class_name -> Optional[final_current_name]} for EVERY class that existed at baseline. None means the class's identity was ended (deleted) during the session, so a current class of the same name is a ... |
| Instance Variable | classes |
{baseline_class_name -> current_class_name} for every class that survived to a different current name (genuine rename). A class born after baseline (no baseline name) never appears here. |
| Instance Variable | entry |
Per op-log position, the final current name of whichever class bore that entry's call-time class_name at the entry's position (None if the class did not survive, or the entry carries no class name). |
| Instance Variable | entry |
Per op-log position, the (final_class_name, final_prop_name) of the property the entry's call-time (class_name, prop_name) referred to at its position (None if absent or not surviving). |
| Instance Variable | prop |
{(baseline_class_name, baseline_prop_name) -> Optional[final_current_name]} for every property that existed at baseline; None means its identity was deleted. |
| Instance Variable | properties |
{(baseline_class_name, baseline_prop_name) -> current_prop_name} for every property that survived to a different current name. The key's class component is the owning class's baseline name, so a property rename stays correctly scoped even when its owning class was itself renamed. |
Return the current name of a class given its baseline identity.
| Parameters | |
baselinestr | The class name as it was at baseline. |
| Returns | |
str | The current class name, or baseline_class_name unchanged when the class was never renamed. |
Return the current name of a property given its baseline identity.
| Parameters | |
baselinestr | Owning class name as it was at baseline. |
baselinestr | Property name as it was at baseline. |
| Returns | |
str | The current property name, or baseline_prop_name unchanged when the property was never renamed. |
Resolve an op-log entry's call-time class name to its current name.
Recycle-safe by construction: the resolution was captured by replaying the op-log, so an op issued under a name later freed and recycled by a different entity resolves to the entity that bore the name at the op's position. Falls back to the call-time name when the entry carries no recorded resolution (covers a class deleted later, or the no-rename case).
| Parameters | |
position:int | The op-log entry's index in Schema._change_log. |
callstr | Class name as recorded in the op-log entry. |
| Returns | |
str | The class's final current name. |
int, call_time_class_name: str, call_time_prop_name: str) -> tuple[ str, str]:
¶
Resolve an op-log entry's call-time (class, prop) to current names.
| Parameters | |
position:int | The op-log entry's index in Schema._change_log. |
callstr | Owning class name as recorded in the op-log. |
callstr | Property name as recorded in the op-log. |
| Returns | |
tuple[ | (current_class_name, current_prop_name). |
{baseline_class_name -> Optional[final_current_name]} for EVERY class that existed at baseline. None means the class's identity was ended (deleted) during the session, so a current class of the same name is a different identity (recycle), not this one. This is what lets the diff match by identity and never swallow a destructive delete behind a recycled name.
{baseline_class_name -> current_class_name} for every class that survived to a different current name (genuine rename). A class born after baseline (no baseline name) never appears here.
Per op-log position, the final current name of whichever class bore that entry's call-time class_name at the entry's position (None if the class did not survive, or the entry carries no class name).
Per op-log position, the (final_class_name, final_prop_name) of the property the entry's call-time (class_name, prop_name) referred to at its position (None if absent or not surviving).
{(baseline_class_name, baseline_prop_name) -> Optional[final_current_name]} for every property that existed at baseline; None means its identity was deleted.