Skip to main content

Module graph

Module graph 

Source
Expand description

Graph construction + community detection for the validator.

Builds a Store from validated entities using the same stub + edge rules as the runtime loader (entity::store_builder), then runs Louvain with a fixed seed. Defence-in-depth cross-mem guard rejects any relationship whose target lives in another mem (structurally impossible inside a single archive because parse_markdown tags every relationship with the archive’s single mem, but the guard stays to catch engine refactors).

Structs§

DanglingCrossMemEdge
One relationship whose target lives in a different mem than the one being validated/exported — i.e. an edge that cannot travel inside a single-mem archive. install refuses on these (ARCHIVE_VALIDATION_FAILED); export warns on them (DANGLING_CROSS_MEM_EDGE_IN_EXPORT) so the operator sees the install-time failure before sharing — one predicate, two postures.
GraphCheckResult
Result of running graph checks — Store + communities, ready for downstream stats + canonical re-pack.

Constants§

VALIDATOR_LOUVAIN_SEED
Fixed seed for Louvain — published once so both the validator and any downstream reproducibility checker can assert on the same value. Value 1 is arbitrary but pinned.
VALIDATOR_RESOLUTION
Default resolution parameter for Louvain at ingress. Matches the community.resolution default used by every shipped schema so validator-built stores land at the same modularity the runtime would produce for the same bytes.

Functions§

build_and_check
Build a Store from parse results and run community detection. Rejects any parse-result relationship whose target lives in a different mem (defense-in-depth: parse_markdown already tags every relationship with the entity’s own mem via wiki_link_to_id, so this should never fire on a well-formed archive — but any refactor that weakens that invariant will be caught here instead of silently diverging from runtime semantics).
dangling_cross_mem_edges_in
The shared cross-mem predicate: every relationship in parse_results whose target lives in a mem other than mem_name. build_and_check (install/load) refuses on the first; the export side warns on all of them — both go through this one function so the surfaces can’t drift.
resolve_fallback_type
Resolve the fallback type for Store construction given a config. Picks the first entry of config.types and falls back to the engine-wide fallback if unresolvable — the config checker has already confirmed every listed type resolves post-validation.
tally
Walk the store and count entities and all out-edges. Used for MemStats post-validation.