graflo.architecture.schema.identity_funnel¶
Identity funnel: ordered fallback branches for synthetic vertex keys.
A funnel is schema policy: an ordered list of branches, each naming the fields that identify a vertex when they are all present. The first complete branch wins and its field values are digested into the synthetic identity. When no branch is complete the vertex has no identity — the caller leaves it empty rather than inventing one, and the caster drops the document.
This generalizes :attr:~graflo.architecture.schema.vertex.Vertex.hash_identity_properties,
which is the single-branch case. Both authored forms are accepted; neither is
rewritten into the other, so legacy digests stay byte-identical.
Example
funnel = IdentityFunnel( ... branches=[ ... {"id": "email", "fields": ["email"]}, ... {"id": "phone", "when_all_present": ["phone", "country"], ... "fields": ["phone", "country"]}, ... ] ... ) ", ".join(funnel.branch_ids) 'email, phone'
Attributes¶
BRANCH_PAYLOAD_KEY = '_branch'
module-attribute
¶
DigestCodec = Literal['sha256']
module-attribute
¶
Classes¶
IdentityBranch
¶
Bases: ConfigBaseModel
One fallback branch of an identity funnel.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Branch name. Unique within the funnel; part of the digest payload
when the funnel sets |
fields |
list[str]
|
Field names whose values are digested when this branch wins. |
when_all_present |
list[str] | None
|
Fields that must all be present and non-empty for this
branch to fire. Defaults to |
Source code in graflo/architecture/schema/identity_funnel.py
Attributes¶
all_field_names
property
¶
Every field this branch references, deduped, order preserved.
fields = PydanticField(..., min_length=1, description='Field names digested when this branch wins.')
class-attribute
instance-attribute
¶
id = PydanticField(..., description='Branch name, unique within the funnel.')
class-attribute
instance-attribute
¶
required_fields
property
¶
Fields that must be present for this branch to fire.
when_all_present = PydanticField(default=None, description='Fields that must all be present and non-empty for this branch to fire. Defaults to ``fields``.')
class-attribute
instance-attribute
¶
IdentityFunnel
¶
Bases: ConfigBaseModel
Ordered fallback branches producing a synthetic vertex identity.
Attributes:
| Name | Type | Description |
|---|---|---|
digest |
DigestCodec
|
Digest codec. Only |
include_branch_id |
bool
|
Include the winning branch id in the digest payload. On by default so two branches over the same values cannot collide. |
branches |
list[IdentityBranch]
|
Ordered branches; the first complete one wins. |
Source code in graflo/architecture/schema/identity_funnel.py
Attributes¶
branch_ids
property
¶
Branch ids in order.
branches = PydanticField(..., min_length=1, description='Ordered fallback branches; the first complete one wins.')
class-attribute
instance-attribute
¶
digest = PydanticField(default='sha256', description='Digest codec used to derive the synthetic identity.')
class-attribute
instance-attribute
¶
field_names
property
¶
Every field referenced by any branch, deduped, order preserved.