graflo.architecture.evolution.rewrite¶
Structured rewrite of vertex names in pipeline dicts and related resource fields.
Functions:¶
cast_step(x)
¶
collect_endpoint_selectors(pipeline)
¶
(vertex_name, selector) for every endpoint matched on a secondary identity.
Endpoints resolving through the primary identity are omitted — they carry no dependency on a named secondary identity.
Source code in graflo/architecture/evolution/rewrite.py
materialize_router_renames(type_map, mapping)
¶
type_map with an entry for every class mapping renames away.
A router routes an unmapped discriminator value as the class name, so
before the rename a raw old reached old with no table entry; after
it only an entry can send it to new, or the value names a class that
no longer exists and the record is skipped at runtime without a word.
Keys the table already has were rewritten in place. None when there is
no table and nothing to add.
Source code in graflo/architecture/evolution/rewrite.py
pipeline_mentions_any_vertex(steps, names)
¶
Return True if any pipeline step references a vertex name in names.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_edge_endpoints_in_pipeline(pipeline, mapping)
¶
Repoint edge steps whose EdgeId appears in mapping at new endpoints.
Keyed on the full (source, target, relation) triple rather than on vertex
names, so an edge step between the same pair of types under a different relation
is left alone.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_edge_properties_in_pipeline(pipeline, *, renames_by_relation=None, removals_by_relation=None)
¶
Rewrite edge actor properties declarations by relation.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_endpoint_selectors_in_pipeline(pipeline, selectors)
¶
Pin primary-identity edge endpoints of selectors keys to a secondary identity.
selectors maps a vertex name to the secondary identity name its endpoints
should select. Used by ReplaceIdentityOp with endpoints: pin_to_retired so
edge steps keep matching on the identity that was just retired.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_entity_names_in_pipeline(step, *, vertices=None, edges=None)
¶
Mutate a pipeline payload in place to rename vertices/relations.
Source code in graflo/architecture/evolution/rewrite.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
rewrite_extra_weights_vertex_field_names(entries, renames_by_vertex)
¶
Rewrite extra_weights[*].vertex_weights for vertex field renames.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_remove_edge_ids_in_pipeline(pipeline, removed_edge_ids)
¶
Drop edge/create_edge steps (and links) targeting removed edge triples.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_remove_relations_in_pipeline(pipeline, removed_relations)
¶
Drop edge/create_edge steps (and links) targeting removed relations.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_remove_vertex_properties_in_pipeline(pipeline, removals)
¶
Remove references to dropped vertex fields from pipeline steps.
Source code in graflo/architecture/evolution/rewrite.py
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 | |
rewrite_remove_vertices_in_pipeline(pipeline, removed)
¶
Trim pipeline to what survives removing the classes in removed.
Step-wise, never resource-wise. A vertex or edge step naming a
removed class goes. A vertex_router loses only the type_map and
vertex_from_map entries for it and keeps routing the rest: a raw
discriminator value naming a class the schema no longer declares is
skipped at ingestion, which is the removal, so a pass-through router
needs no edit at all. A descend stays while anything survives under
it; transforms are left as authored. Untouched steps keep their authored
spelling; a trimmed router is edited in place, and a descend that lost
a step comes back normalized.
Source code in graflo/architecture/evolution/rewrite.py
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | |
rewrite_vertex_field_names_in_pipeline(pipeline, renames, *, available_vertices=None)
¶
Rewrite vertex field names across a resource pipeline.
Walks the dict pipeline (no runtime tree mutation):
vertexsteps: ensurefrom:covers the rename. Existing{old_field: doc_col}becomes{new_field: doc_col}; missing entries are injected as{new_field: old_field}so the doc can still address the property by its original name.transformsteps withrename: rewrite values that pointed at renamed vertex fields.callsteps are unchanged.edgesteps: rewritevertex_weightsfield/map/filter keys perWeight.name.descendsteps: recurse with an extendedavailable_verticesset.
available_vertices is the set of vertex names visible from the parent
scope. Vertex names introduced at the current level are added automatically.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_vertex_names_in_pipeline(pipeline, mapping)
¶
Rewrite all steps in a resource pipeline.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_vertex_names_in_step(step, mapping)
¶
Return a deep-copied step with vertex names rewritten per mapping.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_vertex_names_in_value(obj, mapping)
¶
Deep-rewrite obj (pipelines, infer specs, extra_weights, nested dicts).
Source code in graflo/architecture/evolution/rewrite.py
rewrite_vertex_weight_names(payload, vertex_name)
¶
Rewrite vertex_weights[].name in place.
Weight.name on an edge step is a vertex name — it selects which endpoint's
observation columns the weight reads — and collect_vertex_names_from_pipeline
counts it as a vertex reference. Missing it leaves a pipeline pointing at a type
the schema no longer has.
Source code in graflo/architecture/evolution/rewrite.py
rewrite_vertex_weights_vertex_field_names(weights, renames_by_vertex)
¶
Rewrite :class:~graflo.architecture.graph_types.Weight field/map/filter keys.
Each weight's name selects the logical vertex whose renames_by_vertex[name]
map applies (old field name -> new field name).