test: preserve source bytes and isolate ordinary index budget gates
This commit is contained in:
@@ -173,7 +173,7 @@ fn rich_with_extra_headers() -> SourceBundle {
|
||||
let mut bundle = rich_bundle(Layer::Oa);
|
||||
let source = bundle.files.get_mut("main.arcadia").unwrap();
|
||||
let at = source.rfind('}').unwrap();
|
||||
let extra = (20..23)
|
||||
let extra = (20..26)
|
||||
.map(|n| format!("oa_activity extra{n} \"Extra\" id \"{}\" {{}}\n", id(n)))
|
||||
.collect::<String>();
|
||||
source.insert_str(at, &extra);
|
||||
@@ -183,9 +183,10 @@ fn rich_with_extra_headers() -> SourceBundle {
|
||||
fn exact_ordinary_peak_after_typed_peak_preserves_the_inherited_ledger() {
|
||||
let bundle = rich_with_extra_headers();
|
||||
let baseline = indexed(&bundle).resolved.storage.live;
|
||||
// G10 + T21 + N9 =40, final ordinary header. Earlier typed peak is
|
||||
// resolved baseline+101, one below ordinary resolved baseline+102.
|
||||
for (extra, fits) in [(39, false), (40, true)] {
|
||||
// G13 + T21 + N12 =46, final ordinary header. Six extra leaf activities
|
||||
// add six retained warnings and eighteen lower-catalog slots. The prior
|
||||
// passing resolver cap97 therefore needs at most109; this stage needs111.
|
||||
for (extra, fits) in [(45, false), (46, true)] {
|
||||
let profile = super::super::super::super::budget::Limits {
|
||||
entries: baseline.entries + extra,
|
||||
..super::super::super::super::budget::Limits::source8(language::ParseLimits::UNLIMITED)
|
||||
@@ -204,7 +205,7 @@ fn exact_ordinary_peak_after_typed_peak_preserves_the_inherited_ledger() {
|
||||
.resolved
|
||||
.storage
|
||||
.live,
|
||||
baseline.add(Slots::entries(9), Span::default()).unwrap()
|
||||
baseline.add(Slots::entries(12), Span::default()).unwrap()
|
||||
);
|
||||
} else {
|
||||
let diagnostic = fail(
|
||||
@@ -212,7 +213,7 @@ fn exact_ordinary_peak_after_typed_peak_preserves_the_inherited_ledger() {
|
||||
"Source8 lowering entry limit exceeded.",
|
||||
"main.arcadia",
|
||||
);
|
||||
let at = bundle.files["main.arcadia"].find("extra22").unwrap();
|
||||
let at = bundle.files["main.arcadia"].find("extra25").unwrap();
|
||||
assert_eq!(diagnostic.diagnostic.span, span(at, at + 7));
|
||||
}
|
||||
}
|
||||
@@ -636,11 +637,19 @@ fn every_authored_category_reference_excludes_trivia_prose_and_historical_uuid()
|
||||
|
||||
#[test]
|
||||
fn exact_scratch_peak_reserves_live_iterative_slots_before_growth() {
|
||||
let bundle = categories();
|
||||
let mut bundle = categories();
|
||||
let points = ["{ x 0; y 0; }"; 64].join(", ");
|
||||
let source = bundle.files.get_mut("main.arcadia").unwrap();
|
||||
*source = source.replace(
|
||||
"routes [{ edge @link; }];",
|
||||
&format!("routes [{{ edge @link; waypoints [{points}]; }}];"),
|
||||
);
|
||||
let baseline = indexed(&bundle).resolved.storage.live;
|
||||
// Context header leavesN32; G15; four root fields occupyW4. Popping
|
||||
// target then pushing its two fields reachesW5: exactly52 added slots.
|
||||
for (extra, fits) in [(51, false), (52, true)] {
|
||||
// Unexpanded category peak52 is below the earlier resolver catalog/Vec
|
||||
// overlap. Sixty-four valid route points isolate this stage: N11 + G15,
|
||||
// pending edge1 + point values64, then pop one and push x/y =>W66.
|
||||
// Exactly92 slots are live; earlier catalog overlap is only74.
|
||||
for (extra, fits) in [(91, false), (92, true)] {
|
||||
let profile = super::super::super::super::budget::Limits {
|
||||
entries: baseline.entries + extra,
|
||||
..super::super::super::super::budget::Limits::source8(language::ParseLimits::UNLIMITED)
|
||||
@@ -667,8 +676,8 @@ fn exact_scratch_peak_reserves_live_iterative_slots_before_growth() {
|
||||
"Source8 lowering entry limit exceeded.",
|
||||
"main.arcadia",
|
||||
);
|
||||
let start = CATEGORIES.find("references []; occurrence @right").unwrap() + 11;
|
||||
assert_eq!(diagnostic.diagnostic.span, span(start, start + 2));
|
||||
let start = bundle.files["main.arcadia"].rfind("y 0").unwrap() + 2;
|
||||
assert_eq!(diagnostic.diagnostic.span, span(start, start + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
# This exact-byte source fixture deliberately retains its authored CRLF.
|
||||
categories.arcadia -text whitespace=cr-at-eol
|
||||
+1
-1
@@ -26,4 +26,4 @@ project p "Authored @p child" id "00000000-0000-0000-0000-000000000001" {
|
||||
oa_occurrence left "Left" id "00000000-0000-0000-0000-000000000013" { parent @sub; body { Action { action @child; lifeline none; }; }; }
|
||||
oa_occurrence right "Right" id "00000000-0000-0000-0000-000000000014" { parent @q; body { Action { action @implicit; lifeline none; }; }; }
|
||||
contextual_link context "Context" id "00000000-0000-0000-0000-000000000015" { owner @q; source { references [@use]; occurrence @left; }; target { references []; occurrence @right; }; purpose { Precedence { guard "@child"; }; }; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
# Private authored ordinary-name index implementation
|
||||
|
||||
Before compilation, source checkpoint `50a5918f` exposed Git normalization of
|
||||
the CRLF category fixture. A narrow fixture attribute now preserves its exact
|
||||
2,152 bytes and authored span oracle. Test-only resource variants were also
|
||||
strengthened to reach this new stage after prior phases fit; the initial source
|
||||
was not built or runtime-tested. Production bytes are unchanged by these repairs.
|
||||
|
||||
Local implementation on the `93eb6117f95353d25d594d59780018f197c51672` private lineage, following the root accepted ordinary-index contract (2026-09-24). Runtime acceptance is pending the parent-owned compiler/test gates; this note records design and authored evaluators, not passing results.
|
||||
|
||||
`IndexedMixedProject::index_ordinary(self)` consumes the admitted typed owner and returns `ordinary_index::AuthoredMixedProject`. It retains that owner and one map keyed by canonical file and whole alias-token byte range. Inline records carry owner/global target, Header/Reference role and full original extent. Read-only methods expose both occurrence families, expression keys, names, complete Project, warnings and original bundle/files. No adapter to legacy Index/Plan/Composition or independently replaceable source/profile is added.
|
||||
|
||||
Construction borrows original significant tokens and the sealed ordinary AST/position pairs. Headers are checked against declaration occurrences, not enclosing ranges; the synthetic root Record includes body braces, while real field/value extents are checked within their justified parents. Every Reference leaf is visited, including nested records/lists and arbitrary ordinary fields. A Reference must start at the significant `@` and end exactly at the immediately following whole Word. HistoricalUuid, Atom and prose/include/identity strings are excluded. No reparse, lower, model copy, name copy, numeric work, admission or frame call occurs. Completeness trusts the sealed projection plus exhaustive authored oracles; per-record checks do not establish arbitrary coordinated AST/projection omission rejection.
|
||||
|
||||
The inherited ledger remains live. New retention is exactly N=1+D+A entry slots, zero occurrence slots, zero text bytes. Scratch is G borrowed global-name entries with inline header-seen flags, T typed physical tokens and W currently queued borrowed values. Reserve before every map/set/work growth; a pop releases one logical slot; globals and typed lookup release after their containers drop. Work drains per declaration; the synthetic root is not queued. Actual rich OA/SA stage peaks are incoming baseline+34/+36 (retained+6/+7), but earlier typed peaks prevent those profiles from isolating this later stage. Rich plus three empty activities uses a later-stage40/39 boundary (retained9); category fixture uses52/51 with W5 (retained36). These hand-counts still require runtime verification, including earlier-stage admission.
|
||||
The inherited ledger remains live. New retention is exactly N=1+D+A entry slots, zero occurrence slots, zero text bytes. Scratch is G borrowed global-name entries with inline header-seen flags, T typed physical tokens and W currently queued borrowed values. Reserve before every map/set/work growth; a pop releases one logical slot; globals and typed lookup release after their containers drop. Work drains per declaration; the synthetic root is not queued. Actual rich OA/SA stage peaks are incoming baseline+34/+36 (retained+6/+7), but earlier typed peaks prevent those profiles from isolating this later stage. Rich plus six empty activities uses a later-stage46/45 boundary (retained12), clearing the preceding lower-catalog overlap including retained warnings; unexpanded category fixture has stage peak52 with W5, but that can be below preceding resolver overlap. The scratch-cap test adds64 finite route waypoints to a separate in-memory variant and uses92/91 with W66 (retained36). These hand-counts still require runtime verification, including earlier-stage admission.
|
||||
|
||||
Authored tests cover complete OA/SA maps with literal numeric spans, independent Unicode/CRLF spans, exact rich Project/model metadata retention, canonical coincident offsets and cross-file references, global versus calculation parameter spelling, nested explicit/implicit parents, comment-separated markers, relation/context/route/view/artifact/trace categories, historical UUID exclusion, precise corruption diagnostics and safe fallback, retained/scratch caps without Budget replacement, and bounded-stack success/late failure. The category literal initially contained an invalid duplicate route; the independent oracle critic caught it before compilation and the duplicate was removed. The corrected fixture has36 independently enumerated records (15headers,21references). No inherited compatibility test or known failure disposition is removed.
|
||||
Authored tests cover complete OA/SA maps with literal numeric spans, independent Unicode/CRLF spans, exact rich Project/model metadata retention, canonical coincident offsets and cross-file references, global versus calculation parameter spelling, nested explicit/implicit parents, comment-separated markers, relation/context/route/view/artifact/trace categories, historical UUID exclusion, precise corruption diagnostics and safe fallback, retained/scratch caps without Budget replacement, and bounded-stack success/late failure. The category literal initially contained an invalid duplicate route; the independent oracle critic caught it before compilation and the duplicate was removed. The corrected fixture has36 independently enumerated records (15 headers, 21 references). No inherited compatibility test or known failure disposition is removed.
|
||||
|
||||
Reference in New Issue
Block a user