Skip to main content

Module slice

Module slice 

Source
Expand description

Changed-slice computation — the deterministic core of the ingest source-cursor: given a source’s stored baseline and its current state, classify the pass as reseed / unchanged / changed, and for a changed pass compute the added / modified / deleted Slice.

This is the engine-side port of the plugin’s per-facet computeSourceCursor return contract (inject.mjs). It covers the two strategies whose slice computation is pure once the inputs are in hand:

The git strategy’s slice (parse git diff --name-status, build facet-scope pathspecs) lands with its subprocess glue and the path normalization it needs — kept together rather than split here.

Load-bearing invariant preserved from the plugin: the new baseline token is only ever returned here, never written. It is recorded by the engine’s set_mem_sync_state writer when projection advance completes a full pass (D7), so an aborted pass leaves the baseline untouched and the next run re-presents the identical slice.

Structs§

Slice
The classified set of changed source artifacts in one pass. For the git and mtime strategies the entries are workspace-relative paths; for the graph strategy they are entity ids. Each class is kept sorted.

Enums§

NoSignalReason
Why a source produced no usable change signal — the classified reason a SliceOutcome::NoSignal carries so the brief can render it distinguishably from a genuinely-unchanged source (which stays silent). Every variant is a rendered state; none is dropped silently.
SliceOutcome
The outcome of computing a source’s changed slice against its baseline — the engine-side shape of the plugin’s per-facet computeSourceCursor return. The token in Reseed / Unchanged / Changed is the new baseline the agent records only after a full pass (never written here). NoSignal carries a NoSignalReason and renders in the brief; it advances no baseline (a whole re-roam or a typed refusal, per reason).

Functions§

graph_changes_to_slice
Map a graph mem’s change envelopes into a Slice of entity ids: Removed → deleted; Renamed → the new id added and the old id deleted; Added → added; Updated → modified.
graph_slice_outcome
Classify a graph source against its baseline. baseline is the token stored for this (ingest, facet); current is the source mem’s current snapshot token; changes are the source mem’s changes since baseline (only consulted when the source actually moved). Mirrors the plugin’s computeGraphSlice:
is_git_token
A git commit id / graph snapshot token: 7–64 hex characters. Mirrors the plugin’s isGitToken, distinguishing a usable baseline from a foreign token (an mtime digest JSON, an empty string, junk).
mtime_slice_outcome
Classify an mtime source against its baseline digest token. baseline is the token stored for this (ingest, facet); current_map is the freshly stat’d map; prev_map is the memo of the baseline’s stat map, if the skill cache still holds it. Mirrors the plugin’s mtime branch of computeSourceCursor: