Skip to main content

Module structure

Module structure 

Source
Expand description

Structure ingest: the working tree, read as graph.

ingest_git builds the history half of a codebase graph — who touched what, when. This module builds the present half from the files on disk: what each file defines, what it imports, what its definitions call, and what the prose says about it.

It never writes an edge itself. Every relationship is stored as a list property and left to a rule, so the engine owns retraction: rewrite a file’s imports and the stale IMPORTS edges retract in the same commit.

Written onPropDerives
Fileimports: [File key]IMPORTS File → File
Filementions: [File key]MENTIONS File → File
Symbolcalls_to: [Symbol key]CALLS Symbol → Symbol
Symbolfile_id: File keyDEFINES Symbol → File

Beside each list sits its evidence: import_lines and call_lines hold "<key>\t<line>" strings, so a tool can quote the line a link came from.

§What is read

Only the working tree. The candidates are the File nodes git already put in the graph — so exclusion patterns have been applied — narrowed to those that exist on disk right now. A path that lives only in history keeps whatever git recorded about it and is skipped here.

§What is written

Only differences. Each file’s stored props are compared field by field against the freshly extracted ones, and its Symbol nodes against the symbols just found in it. A file whose bytes have not changed produces no write at all, which is what makes a re-run byte-identical.

Structs§

StructureReport
What one refresh saw. Counts cover every file scanned, including those that needed no write, so the numbers are stable across re-runs.

Constants§

DEFINES_RULE
Name of the Symbol.file_id foreign-key rule. Identical to the name zero-config FK inference would choose, so the two never both create it — and declaring it here is what makes the edge DEFINES rather than the FILE that inference would derive from the field name.
FULLTEXT
(label, field) pairs this module indexes for full-text search.
MAX_SYMBOLS_PER_FILE
Most Symbol nodes kept for one file. A generated or vendored file can define tens of thousands; past this the file is still hashed and its imports still resolve, it just stops contributing definitions.

Functions§

ensure_rules_and_fulltext
Declare the structure rules and full-text fields that are missing, and return the names of the rules created.
importers_of
The File keys whose imports or mentions list still names one of keys.
refresh_all
Refresh every working-tree file under prefix.
refresh_files
Refresh exactly paths — those of them that are still files on disk.
rules
Every rule this module declares, in creation order.

Type Aliases§

Db
GraphDb over the real filesystem, named without spelling out RealFs — which core-api does not re-export. Both an open core_api::GraphDb and a core_api::WriteGuard (through its Deref) are one of these.