Skip to main content

Module source_scope

Module source_scope 

Source
Expand description

Source scope enumeration — the declaration-layer walk that turns a binding source’s scope patterns (allow / deny globs over a medium, entity selectors over a graph) plus a binding’s ingest-level deny paths into the set of artifacts the binding answers for, S(D).

Kernel, not loop: the anchors health axis enumerates a mem’s source artifacts to report the unclaimed ones, and the facet read surface reports a scope’s enumeration, so the walk lives beside the binding store it reads and never behind the maintenance loop that also consumes it. Moved here from ingest::cursor on 2026-09-10; the loop reaches these items through ingest::cursor’s re-exports.

Structs§

ScopeEnumeration
What an enumeration of a source’s scope selected, and what it could not speak for.
ScopePatternNote
One scope pattern still written in the retired workspace-relative dialect.

Enums§

EntitySelector
One parsed entry of a graph facet’s scope — the entity-namespace counterpart of a path glob. A graph source selects entities, and an entity is not a path: matching id-shaped globs against mem--slug invites the “looks scoped, selects nothing” failure the dead-deny lint exists to catch on paths, so the vocabulary is explicit about which axis it selects on.

Constants§

VCS_INTERNAL_DIRS
VCS metadata directories — never source artifacts. Pruned from source enumeration (S(D), mtime slices, advance) and from the dead-deny scan.

Functions§

allow_could_match_under
Whether any allow pattern could match a file somewhere under the directory at dir_rel (source-relative). True when, for some pattern’s literal prefix, the directory’s segments and the prefix agree over their common length: the directory is either an ancestor of the literal region (the walk must pass through it) or inside the pattern’s glob region. An empty prefix (pattern starts with a glob segment) matches every directory — no pruning for unanchored scopes.
build_glob_set
Build a GlobSet from glob patterns, or None if any pattern is malformed. The namespace the patterns are written in is the caller’s business — scope patterns are source-relative, ingest denies workspace-relative.
build_glob_set_reporting
build_glob_set, plus the patterns that would not compile.
engine_state_denies
Workspace-relative deny globs excluding the engine’s own state from every strategy’s input set. Unconditional and non-configurable: a binding can never legitimately model .memstead/, .memstead.cache/, or a mount’s resolved storage location as source artifacts — an allow glob covering them does not admit them. The dot-directories key on their names (the names are the contract, and a foreign workspace’s .memstead/ is still engine state); the mount storage locations key on their resolved paths because their directory names are configurable. Fail-open on an unreadable mount list: the name-based excludes stay in force.
enumerate_facet_files
Enumerate the workspace-relative file paths a primary source’s facet scope selects — the mtime strategy’s input set. Mirrors the plugin’s enumerateFacetFiles: the path-shaped mediums (codebase / filesystem / git — a git source’s artifacts are paths pinned at a commit, so the walk is identical and only the anchor namespace differs); the facet’s allow globs minus its deny globs, evaluated over the medium’s directory tree. Returns a sorted, de-duplicated list. An unscoped facet (no allows) yields an empty list here — but callers must not treat that as signal: the strategy layer (compute_mtime_slice / current_primary_token) refuses an unscoped facet via facet_unscoped before enumerating, so the empty list is only ever reached for a genuinely-empty scoped enumeration.
enumerate_facet_files_reported
enumerate_facet_files, carrying what the enumeration could not speak for: patterns that would not compile, and patterns still in the retired workspace-relative dialect. Any surface that reduces the set to a figure must consult ScopeEnumeration::is_partial first.
enumerate_graph_entities
Enumerate the entity ids a graph source’s facet scope selects — the graph medium’s S(D), the exact counterpart of enumerate_facet_files for a path medium. The source’s pointer names the source mem; the store already holds every mounted mem’s entities, so this is a filter over memory rather than any kind of walk.
enumerate_source_artifacts
Enumerate one primary source’s in-scope artifacts, whatever its medium — the single entry point every S(D) consumer uses. Path-shaped mediums (codebase / filesystem / git) walk the file tree; a graph source filters the source mem’s entities. A medium the matrix marks non-enumerable yields nothing, and its callers render the non-enumerable basis rather than a denominator.
enumerate_source_artifacts_reported
enumerate_source_artifacts, carrying what the enumeration could not speak for. Any surface reducing S(D) to a figure consults ScopeEnumeration::is_partial first.
glob_literal_prefix
The longest run of leading path segments in a glob pattern that carry no glob metacharacter — the literal region a match must live under. dev/**/ *.md → ["dev"]; VISION.md → ["VISION.md"]; **/*.rs → [].
medium_base
The medium pointer resolved to an absolute base directory. Public so init-time surfaces (CLI projection init) can resolve a medium base exactly as the strategies do — e.g. to warn when it falls outside the workspace root.
normalize_lexical
Lexically normalize a path — resolve . and .. without touching the filesystem (no symlink resolution), matching Node’s path.resolve on an already-absolute path.
parse_entity_selector
Parse one graph scope pattern. None for an unrecognised form — the caller decides whether that is a validation refusal (declaration time) or a skipped rule (run time, already refused at declaration).
relative_path
The relative path from from to to (both normalized), matching Node’s path.relative.
scope_migration_notes
Name every scope pattern of source that reads as the retired workspace-relative dialect: one that begins with the source’s own pointer, so it selected artifacts before the 2026-08-27 join and selects nothing after it.
selector_matches
Does selector select this entity?