3.1 KiB
Mixed CLI core discovery implementation
Base bab6f96a; selected root contract f810fb40. This contribution owns core only.
source_files::load_mixed_source returns opaque MixedSourceSnapshot with immutable
bundle/diagnostics views. It consumes a fresh private DiskProject after final
checks and drops root/expectations/reachability; no reachable-bundle clone, model,
index, save or recovery authority escapes. The byte allowance is clamped to the
existing64MiB ceiling before disk reads; other caller fields are preserved.
The existing discovery loop has a private borrowed ordinary/mixed selector. Ordinary overlays, aggregation, limits, final compilation and journal behavior are preserved. Mixed selects a shared Budget/ModelCounts phase and skips ordinary compilation. Syntax/budget failure records the original file diagnostic and stops parsing later siblings, while final disk/physical/journal checks still execute. Disk/encoding/path failures retain existing classifications and safeguards.
Both producer modes start once at zero. Each inspected file reserves its phase slot before scanning. Bytes/tokens/references/numeric/syntax/model work accumulate across units. Remaining text/value/owner reservations remain conservative after unit destruction; in-parser temporary/UUID/key releases are unchanged. No edit positions or complete model are constructed during discovery. Final public semantic checking is a separate pass with the original caller policy.
A narrow shared parse_unit helper centralizes exactly the existing Parser setup, unit(entry,true) call, state extraction and Parser drop. Complete mixed parsing keeps all subsequent metadata/projection/traversal/accounting operations. Source review finds no semantic blocker; helper-frame effects still require parent's actual existing stack gates and prologue comparison, not a source-only claim.
Three internal discovery tests cover exact132-byte/31-token/3-event chain totals, conservative text32/metadata3 after unit drops, all temporary balances, original policy capture, cumulative6/5 entry boundary with no later-file remapping, syntax failure terminality and positive cumulative numeric/reference work. The tight entry profile is explicitly a fresh internal fixture, not a public policy knob.
Five external mixed_source_files tests exercise real filesystem capture and independently authored complete model equality (nested ordinary participants, cross-file calculations and scoped parameters), original bytes, four missing-ID classes, malformed syntax, unparsed later sibling plus preserved pending journal, missing/escaping/cyclic includes, file/byte/depth/edge boundaries, invalid UTF-8, nonregular files, case collisions and hard-link aliases. CLI worker separately owns OA/SA rich command fixtures/report/actual executable tests and documentation. No old test body or expected outcome was changed.
Only owned Rust files were formatted directly with skip_children=true. No Cargo, Rust compiler, rustdoc, CLI execution or remote operation ran in this contribution. Parent owns all runtime, production ordinary-regression, stack, lint and combined source acceptance. Existing depth/platform/accounting limitations remain intact.