graflo.cli.inverses¶
graflo inverses -- see, realize, repair, switch and withdraw declared edge inverses.
A thin shell over the audit
(:func:~graflo.architecture.profile.inverses.audit_inverses) and the planners
(:mod:graflo.architecture.evolution.inverse_plan). Every verb that changes
anything follows graflo lift: it plans primitive ops, shows them, and --
unless asked only to show them -- applies them and writes the result.
--emit-ops writes the plan as YAML, which is the reviewable artifact: a plan
is a list of ordinary evolution ops, so it can be read, diffed, checked in and
replayed without this command.
A manifest that does not load can still be audited and repaired. That is the case the command exists for: a manifest assembled from several sources is exactly where a declaration and the edges it names stop agreeing.
Attributes¶
EXIT_CONFLICTS = 1
module-attribute
¶
__all__ = ['inverses']
module-attribute
¶
Classes¶
Functions:¶
audit(manifest, as_json, exit_zero)
¶
Report how MANIFEST realizes each declared inverse, and what is wrong.
Findings are repairable (one place omits what another states; repair
propagates it), conflict (two places disagree; only you can settle it) or
note. Exits 1 when conflicts are found.
Source code in graflo/cli/inverses.py
inverses()
¶
Declared edge inverses: how they are realized, and what to do about it.
Declaring a pair in edge_config.inverses stores nothing, and is usually
enough: the inverse name reads the forward edge backwards, which is free on
most backends. Storing the inverse is optional, one way per pair. native:
the database maintains the reverse type (TigerGraph). materialized: the
inverse is a declared edge, written from the same rows by edge steps that
set emit_inverse.
Source code in graflo/cli/inverses.py
realize(manifest, strategy, relations, output, ops_path, dry_run)
¶
Realize declared pairs of MANIFEST; every pair left alone comes with a reason.
Source code in graflo/cli/inverses.py
repair(manifest, output, ops_path, dry_run)
¶
Propagate what MANIFEST under-reports; contradictions are listed, never touched.
Typical after merging sources: the inverse edge exists but one resource that writes the forward relation feeds nothing into it; one mirror declares a property the other lacks; a relation is undirected everywhere but not declared symmetric. Each repair is kept only if it removes its finding and introduces no other.
Source code in graflo/cli/inverses.py
switch(manifest, to, relations, output, ops_path, dry_run)
¶
Move pairs of MANIFEST from one realization to another: withdraw, then add.
A pair is realized one way. Eligibility for the new realization is checked before anything is planned, so a pair is never left withdrawn and unrealized.
Source code in graflo/cli/inverses.py
withdraw(manifest, relations, output, ops_path, dry_run)
¶
Stop storing the inverse of pairs of MANIFEST; the declaration stays.
Undoes a realization: a native inverse is withdrawn from the profile, and
the declared edges of a materialized inverse are removed together with the
emit_inverse flags that fed them. The inverse name keeps resolving on
reads wherever the backend can follow an edge from its target.