Files
ARCADIA-Studio/harness/experiments/analysis-ordinary-index-20260924/ORDINARY-ORACLE.md
T

18 KiB
Raw Blame History

Independently authored ordinary-index oracle

2026-09-24. Base fixture: rich_bundle(layer) at private 93eb6117f95353d25d594d59780018f197c51672, crates/oa-core/src/language/analysis_source/mixed/project/tests.rs:253; full expected model is the existing independently authored rich_model(layer). This report uses literal source and byte arithmetic only, not parser/index/lowerer/formatter output. No Cargo/source edits. Supplement to the typed ORACLE.md and accepted ordinary-index contract.

Exact complete ordinary map for the rich fixture

Use the existing id(n) helper, which formats decimal digits inside a UUID string; do not substitute Id::from_u128(n). All records below belong to canonical file 2 = main.arcadia. Canonical files 0=a.arcadia and 1=b.arcadia contain only typed calculations and contribute zero ordinary records. Entry remains main.arcadia, while include order is b then a. Targets below are global IDs, never calculation-scoped parameters.

Physical key is (2, alias_start, alias_end). Value is (owner id, global target id, Header|Reference, full extent). For Header the extent equals alias span. All endpoints are full-original-file byte offsets, half-open.

Record Layers Owner Target Role Full extent Alias token Spelling / unique source anchor
project OA, SA 1 1 Header 19..20 19..20 p; project p, offset8
node OA, SA 4 4 Header 122..123 122..123 n; node n, offset5
node diagram OA, SA 4 5 Reference 176..178 177..178 d; diagram @d, alias offset9
node element OA, SA 4 3 Reference 188..190 189..190 v; element @v, alias offset9
work OA, SA 2 2 Header 350..351 350..351 w; oa_activity w / sa_function w, offset12
diagram OA, SA 5 5 Header 412..413 412..413 d; diagram d, offset8
system SA only 6 6 Header 490..491 490..491 s; sa_system s, offset10

This is the entire map, not a sample. OA: D=3 ordinary declarations, A=2 references, N=1+D+A=6. SA: D=4,A=2,N=7. Typed global headers f/g/v, typed subject @w, calculation parameters/uses and call labels remain exclusively in the existing typed family. Combining ordinary and typed global-header roles gives exactly the 7 OA or 8 SA catalog globals. Parameter x/id(1) is not the Project p/id(1), and scoped names are absent from ordinary resolution.

OA main is 474 bytes, SA main is 548 bytes; a/b remain 213 bytes each. The header offsets before the SA system are unchanged because oa_property/sa_property and oa_activity/sa_function have equal lengths; diagram's layer field affects only later positions. Full Project equality remains rich_model(layer), with all prior warnings/admission metadata and typed maps unchanged.

Unicode/CRLF exact map

Use the accepted transformation independently on every file: prefix // 雨\r\n (8 UTF-8 bytes), and replace each original LF with CRLF. An original endpoint b maps to 8 + b + number_of_LF_bytes_in_original[..b]. This arithmetic is over original literals, not index output. Alias intervals in the transformed main are:

Record Full extent Alias token
project 28..29 28..29
node 133..134 133..134
node diagram 187..189 188..189
node element 199..201 200..201
work 363..364 363..364
diagram 426..427 426..427
SA system 505..506 505..506

Owner/target/role/file keys do not change. Only these token spans are replacement authority; the marker bytes remain in full reference extent only. Exhaustively compare both entire maps and original source slices, and preserve actual complete bundle pointer/entry/files.

Retained and agreed live-scratch accounting

Implementation phase policy communicated independently by the implementer: build borrowed reverse-global map G with inline header-seen flags; build typed physical set T and mark typed headers; keep G/T until all ordinary records and final header coverage are checked. Per canonical file visit Project header first, then paired ordinary declarations. Insert each declaration header, then walk its synthetic root's actual field values via a Vec of borrowed value/parent-span items. The synthetic root itself consumes no work slot. Reserve every push; pop releases its slot before handling; drain one declaration before the next. Drop G/T last.

For the existing rich fixture T=21, G=7 OA /8 SA. Added retained ordinary delta is exactly (entries:N, occurrences:0, text:0) = (6,0,0) OA or (7,0,0) SA. No catalog name strings or typed data are copied.

Actual prefix peaks (not loose final-N+max-W bounds):

  • OA: scratch G+T=28. Project+node headers yield new-map count2; node's diagram/element fields yield W2, so this phase peaks32. Two references finish at map4,W0 (32 total). Work header reaches33; final diagram header reaches 34. Thus ordinary-stage peak is incoming indexed baseline+34, with final retention baseline+6.
  • SA: scratch G+T=29. Node phase peaks33; work header34; diagram header35 then its sole layer Sa Atom work slot reaches 36; system header later also reaches36. Final retention is baseline+7. Maximum W remains2, but never coincides with final N, so the loose N+G+T+W bound38 is not an actual peak.

Do not use rich fixture +33/+34 as an end-to-end cap oracle. Its preceding typed-index peak is resolved-baseline+98 and retained typed delta59. Incoming-indexed-baseline+34 is only resolved-baseline+93, so such a global profile fails at the earlier typed stage. A test that replaces/tightens the Budget after acceptance would evade the inherited policy and is not an adequate fix.

A candidate isolating fixture appends three empty ordinary OA activity declarations with distinct IDs/aliases to rich_bundle. Then G=10,N=9,T=21; final ordinary-stage peak becomes incoming-indexed-baseline+40, i.e. resolved-baseline+62+40=resolved-baseline+102. Earlier typed owner/physical peak is resolved-baseline+101, syntax peak96. Under the stated implementation phases, total cap102 and101 distinguish the new final-header growth after the typed stage can fit. The earlier resolver peak must also be verified below101 before using this as the acceptance cap case; these are design arithmetic, not runtime results. An ordinary-heavy category fixture can serve instead once its exact literals/lifetimes are agreed.

Coverage expansion coordination

The rich fixture supplies only project/node/work/diagram/system ordinary headers and two node references, so it cannot alone certify all ordinary categories. The additional frozen category literal below supplies nested explicit/implicit parents with marker comments, relation/context chains, route/view-option references, artifacts, live trace endpoints and historical UUID exclusions. Expectations are authored from literal roles and raw source anchors, never inferred by scanning the produced ordinary map.

Complete category map

Exact implementer-authored fixture: crates/oa-core/src/language/analysis_source/mixed/project/ordinary_index/tests/fixtures/categories.arcadia, 2152 UTF-8 bytes, SHA256 A220AE836C38E7F1568749EDC50891C43F7F34A4152E7224A125AE05618C8E05. The report-only ordinary_category_bytes.ps1 verifies that pin and independently authored unique source anchors. All following entries have canonical file 0. H=Header, R=Reference. Numeric owner/target IDs use the same decimal UUID helper as above. Unicode 雨 appears before the first ordinary declaration: all numbers below count UTF-8 bytes, not UTF-16 characters. This is the entire ordinary map.

Alias Owner Target Role Full extent Alias token Unique literal anchor
p 1 1 H 19..20 19..20 project p "Authored
a 2 2 H 168..169 168..169 oa_activity a "Parent
child 3 3 H 249..254 249..254 oa_activity child "Explicit
a 3 2 R 323..345 344..345 parent @ /* @noise child */ a;
implicit 4 4 H 369..377 369..377 oa_activity implicit "Implicit
s 5 5 H 487..488 487..488 sa_function s "Selected
link 6 6 H 561..565 561..565 interaction link "Link
child 6 3 R 624..630 625..630 source @child;
implicit 6 4 R 639..648 640..648 target @implicit;
d 7 7 H 664..665 664..665 diagram d "View
link 7 6 R 740..745 741..745 routes [{ edge @link; }];
link 7 6 R 788..793 789..793 hidden_edges [@link]
note 8 8 H 818..822 818..822 artifact note "Evidence
link 8 6 R 884..889 885..889 owner @link;
t 9 9 H 925..926 925..926 trace t "Review
child 9 3 R 991..997 992..997 oa @child;
s 9 5 R 1002..1004 1003..1004 sa @s;
q 10 10 H 1328..1329 1328..1329 oa_process q "Caller
use 10 12 R 1390..1394 1391..1394 steps [@use, @right]
right 10 14 R 1396..1402 1397..1402 steps [@use, @right]
sub 11 11 H 1422..1425 1422..1425 oa_process sub "Callee
left 11 13 R 1486..1491 1487..1491 steps [@left]
use 12 12 H 1514..1517 1514..1517 oa_occurrence use "Call
q 12 10 R 1576..1578 1577..1578 parent @q; body { SequenceReference
sub 12 11 R 1616..1620 1617..1620 sequence @sub;
left 13 13 H 1648..1652 1648..1652 oa_occurrence left "Left
sub 13 11 R 1711..1715 1712..1715 parent @sub;
child 13 3 R 1740..1746 1741..1746 action @child;
right 14 14 H 1789..1794 1789..1794 oa_occurrence right "Right
q 14 10 R 1854..1856 1855..1856 parent @q; body { Action
implicit 14 4 R 1881..1890 1882..1890 action @implicit;
context 15 15 H 1935..1942 1935..1942 contextual_link context "Context
q 15 10 R 2003..2005 2004..2005 owner @q;
use 15 12 R 2028..2032 2029..2032 references [@use]
left 15 13 R 2046..2051 2047..2051 occurrence @left;
right 15 14 R 2091..2097 2092..2097 occurrence @right;

N=36 = 15 headers +21 references (D14,A21). G15,T0. All global catalog names total49 UTF-8 bytes; ordinary storage adds zero owned text and zero occurrence counters, exactly36 retained entries. There are no typed declarations in this category fixture; Field { Type ... Named uuid ... } is historical trace content, not a typed declaration. The historical UUID equals the live child ID deliberately but contributes no ordinary occurrence. The implicit child's lexical parent contributes no authored reference. Project/display/description strings, comment @noise child, artifact URI and contextual guard prose contribute no records. The explicit child's parent occurrence belongs to child/id3, never enclosing activity/id2.

The original draft's two routes for the same edge would fail admission (validation.rs:738–748, duplicate_edge_route). The frozen fixture has one route plus a view-option hidden-edge reference, retaining repeated-target coverage across valid separate fields. SA function without a System produces the existing missing_system warning rather than an admission error. These are source-derived checks; admission/runtime verification belongs to the parent and is not claimed here.

For the agreed phase policy the category stage reaches incoming indexed baseline +52 entries, not the loose bound G15+N36+maxW5=56. Before the final contextual declaration there are31 retained ordinary entries; its header raises this to32. Pushing its four actual root field values raises total to15+32+4=51. Pop target then push its occurrence and references values: W5,total52. The empty references list drains; target occurrence raises map33. Source traversal and its one-item references list reach map33,W4 or map34,W3,total52. Source occurrence finishes at map35,W2,total52; purpose's nested Precedence/guard values also reach52. Final owner reference completes map36,W0,total51. Earlier trace traversal reaches only36 (map17,W4,G15). No recursive work frame is added: numeric/static policy and typed Budget usage must remain exactly inherited.

Cap51 first refuses the target.references empty List push: after popping target, push occurrence reaches51, then push references would reach52. The value span is 2076..2078 ([]), not the encompassing field or contextual declaration. language.rs:1067–1085 derives the List extent from matching delimiters; ordinary_index.rs:377–388 charges field.value.span before each push. Cap52 fits this stage. Like the rich+3header cap pair, these global-cap tests must enter through the same accepted limits and demonstrate earlier admission/resolver/typed stages fit; replacing a Budget after acceptance is excluded.

Cross-file ordinary reference supplement

The existing equal-offset canonical-file fixture checks only headers. A minimal authored extension changes only b.arcadia to oa_activity bb "Same @aa @bb" id "00000000-0000-0000-0000-000000000003" { parent @aa; } (87 bytes). Its entire ordinary map has four records: existing (0,12,14) H owner/target2, (1,12,14) H owner/target3, (2,19,20) H owner/target1, plus (1,82,84) R owner3,target2,extent81..84. Thus the reference target lives in canonical a.arcadia while ownership and replacement authority remain in b.arcadia; the display-name occurrences of @aa/@bb remain excluded. This supplement is suggested to the implementer, not claimed implemented or run.

Oracle verification boundary

Both report-only scripts completed successfully on 2026-09-24. ordinary_oracle_bytes.ps1 checked13 original and13 Unicode/CRLF rich records; ordinary_category_bytes.ps1 checked all36 pinned category records and unique physical keys. Scripts use authored tuples and UTF-8 source arithmetic only; neither runs nor imports the parser, lowerer, formatter or index. They establish literal-byte expectations, not semantic admission, implementation correctness, editing parity or runtime acceptance. All source/build/test ownership remains with the implementer and parent.

Final cap-fixture refinement, source147b247398cdae4b0fbbf977e301fffcaa450108

This section supersedes the proposed rich+3 global-cap isolation and unexpanded-category52/51 global-cap pair above. Their ordinary-stage peaks remain correct, but earlier resolver phases can refuse those global caps before ordinary indexing. The exhaustive semantic maps and pinned category literal are unchanged. Source-only review of final test helpers confirms these two selected variants; no Cargo or source edits were performed by this reviewer.

Retained-growth variant: rich OA plus six empty activities, IDs/aliases20..25 (tests.rs:173–229). G13,T21,N12. Typed retained delta65 over the new resolved baseline Rnew; ordinary stage delta46 over incoming indexed baseline Inew. Exact failing/succeeding inherited entry caps are Inew+45/+46 = Rnew+110/+111. Refusal is the last header extra25 (seven-byte alias); successful new retention is12 entries. Plain-empty fields add no simultaneous ordinary work beyond the final header.

Earlier-phase justification uses the already verified93eb test (mixed/project/tests/index_tests.rs:339–375): the original resolver succeeded under Rold+97, with refusal later inside typed indexing. In project.rs:233–253,300–344, each new global contributes alias1+owner1+typed table2; its per-declaration pointer adds1 at :452–500. Therefore the catalog/ordinary-construction phase gains30 for six activities, but its concrete original peak is S+38 (G7*4 + scoped6 + ordinary D3 + node1), so the new phase is Snew+68, comfortably below Rnew+110. This separate phase is not incorrectly bounded by the smaller lower-phase delta18.

After alias and declaration-pointer releases (project.rs:498–503), lowering retains owner1+table2 per extra global, so the relevant overlap grows18. Typed expressions/arguments/all_lower remain unchanged. Each added unattached leaf contributes a retained unallocated_leaf warning (validation.rs:434–446, one entry admitted in project.rs:599–613), while existing relationships/warnings are unchanged; Rnew therefore includes six more warning entries in addition to changed syntax storage. Relative to Rnew the old proven97 upper bound grows at most18-6=12, yielding <=109, below the failing cap110. Warning accumulation itself coexists only with ownerG and retained sites, hence is also lower. The typed index's old98 owner/physical peak grows only six retained name entries to104; its old90 syntax/reverse-name overlap grows12 to102. Thus both previous index phases fit110. All limits are supplied at parse time and the same inherited ledger reaches ordinary indexing.

Live-work variant: category plus64 route waypoints, test-only replacement (tests.rs:638–687), each literal point { x 0; y 0; }, joined with comma-space. The original2152-byte fixture is untouched. Expanded literal is 3124 UTF-8 bytes; no new aliases/references, so N36,G15,T0 and final ordinary retention36 remain unchanged. Because root field order is routes then view_options and traversal is LIFO, view.hidden_edges is indexed first: diagram has map11 when its route is walked. Route fields edge/waypoints retain pendingedge W1 while the waypoint List pushes64 children, reachingW65. Pop the last point toW64; x Atom push reachesW65; y Atom push reachesW66. Hence the exact new peak is map11+G15+W66=92 above Inew. Cap91 refuses the last point's y Atom before its push; independent raw UTF-8 arithmetic locates that 0 at 1712..1713. ordinary_index.rs:377–388 charges the value span before push, consistent with this diagnostic. Cap92 fits; later remaining points and original contextual declaration stay below that peak.

Earlier category catalog/ordinary-pointer overlap is4G+D=60+14=Snew+74 (project.rs:233–344,452–500); no scoped signatures or nodes exist. Source-accounting traversal at accounting.rs:155–183,272–294 walks one declaration/value at a time and reaches at most W66 for the expanded route, hence <=Snew+66. Typed lowering has no nodes/arguments, and its typed-name-only index is small. These earlier bounds are below Inew+91, since Inew retains Snew plus warnings and15 name entries. The64 waypoints remain within the existing route bound128; parent admission/runtime verification is still required.

Final selected counts and bounds were sent to parent and implementer before runtime gates. This is the completed source/arithmetic audit, not a claim that the new13 tests or full suite have passed.