graflo.architecture.evolution.merge_types¶
Merged property types: declared on a merge, refused when they disagree undeclared.
A merge folds every member of a group into one class, and every edge that
lands on one edge_id into one edge, so their property types must agree.
:attr:~graflo.architecture.evolution.ops.MergeManifestsOp.field_types states
the merged type once, by merged names. This module lowers it per side onto the
members' own names (a change_field_types applied ahead of the side's
canonicalize), and reports every undeclared disagreement at once, naming
the declarations that carry each type.
Merge, the merge commit and the preview all call it, so the three cannot disagree on what a declaration retypes.
Attributes¶
MERGE_RETYPE_REMEDY = "Declare the merged type in the merge's field_types."
module-attribute
¶
Classes¶
Composite
¶
Bases: Protocol
The composite relabel per side (SideMaps, or a dict of both sides).
Source code in graflo/architecture/evolution/merge_types.py
FieldTypeDeclarationError
¶
UnionNames
dataclass
¶
Each side's class and relation names, and the property renames per class.
Source code in graflo/architecture/evolution/merge_types.py
Attributes¶
maps
instance-attribute
¶
properties
instance-attribute
¶
Methods:¶
__init__(maps, properties)
¶
edge_id(side, edge)
¶
Source code in graflo/architecture/evolution/merge_types.py
name(side, kind, own)
¶
of(manifests, composite, *, index, name_conflict)
classmethod
¶
Source code in graflo/architecture/evolution/merge_types.py
Functions:¶
field_type_clashes(declared, manifests, union)
¶
Every merged property whose members disagree on a type no declaration settles.
Groups each typed property of each side by the merged class (or merged
edge_id) and merged property it lands on, so a disagreement among one
side's members and one between the two sides are reported alike, with the
declarations carrying each type. Untyped properties take the other side's
type and never clash; units are left to the fold.
Source code in graflo/architecture/evolution/merge_types.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | |
field_type_ops(declared, manifests, union)
¶
The retype each side needs ahead of its canonicalize, by its own names.
Every member whose merged name is declared, and that carries a declared property under any spelling renamed onto it, is retyped; a member that already has the type, or does not carry the property, is left alone.
Raises:
| Type | Description |
|---|---|
FieldTypeDeclarationError
|
An entry no member on either side reaches, all listed at once. |
Source code in graflo/architecture/evolution/merge_types.py
union_name_map(composite, names, *, index, name_conflict, side, kind)
¶
Where a name on side ends up, as the union sees it.
Merge applies the composite relabel first and the right side's
name-conflict policy second, so the map the union sees is the policy
merged onto the relabel. The policy comes from the function merge calls,
over the post-relabel names, so prefix_right cannot drift out of sync.
Under error and union_right the policy is empty by construction;
a refusal it raises is merge's to report, so it reads as no renames here.
Source code in graflo/architecture/evolution/merge_types.py
with_declared_types(fields, specs)
¶
fields, already under their merged names, with the declared types applied.