Skip to content

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs

Comment 1, line 1

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:1

//! Synthetic pi adapter cases, marked in directory names and file headers, for V17/V30 rejection and fallback.

Comment 2, line 2

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:2

//! Cover cases without native samples: four auxiliary usage record types, assistants without usage, inherited fork

Comment 3, line 3

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:3

//! deduplication, stopReason=error/aborted, cost mapping, version policy (reject known incompatible formats;

Comment 4, line 4

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:4

//! use latest_fallback for unlisted numeric versions), rejection of unknown formats, and unknown entry diagnostics.

Comment 5, line 5

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:5

//! Expected values are calculated manually from test data and checked with jq; see each _expectations.md.

Comment 6, line 30

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:30

// Manual calculation (synthetic-auxiliary-carriers, 8 lines and 6 events):

Comment 7, line 31

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:31

// Primary: syn-a-1 (1000/50/800/100/1050, reasoning 10) + syn-a-2 (no usage; all tokens unknown).

Comment 8, line 32

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:32

// Auxiliary: syn-u-1 (100/0/90/0/100), syn-c-1 (1000/200/0/0/1200),

Comment 9, line 33

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:33

// syn-b-1 (800/100/300/0/900), and syn-t-1 (15/5/0/10/20).

Comment 10, line 34

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:34

// Sum: call_count=6, input_total=2915, cache_read=1190, cache_write=110,

Comment 11, line 35

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:35

// output=355, total=3270; one usage_shape_deviation (syn-a-2).

Comment 12, line 59

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:59

// Category counts: pi has no sub_agent entries; 2 primary + 4 auxiliary.

Comment 13, line 74

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:74

// Check ownership and category by record key.

Comment 14, line 105

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:105

// An assistant without usage counts as a call; all tokens remain unknown.

Comment 15, line 120

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:120

// compaction/branch_summary lack model fields; use the latest preceding model_change, including equal timestamps.

Comment 16, line 143

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:143

// toolResult usage describes the tool's own consumption: an auxiliary call with an unknown model.

Comment 17, line 150

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:150

// Reasoning is a subset of output; do not add it again. Only syn-a-1 reports 10.

Comment 18, line 161

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:161

// Manual calculation (synthetic-fork-inherited): the source has 2 events (150+300); the fork copies

Comment 19, line 162

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:162

// source lines L2–L4 verbatim and adds assistant syn-fa-3 (15). There are 3 calls and input_total=350

Comment 20, line 163

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:163

// (derived input+cacheRead+cacheWrite: 100+240+10), cache_read=40, output=115, total=465.

Comment 21, line 170

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:170

// Scan the source alone first, then add the fork; each file is scanned once per round.

Comment 22, line 196

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:196

// Known difference (see test _expectations.md): copied entries have the same four-part key, but session_id/

Comment 23, line 197

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:197

// parent_session_id come from the fork header. Stored events with that key have different content: conflict

Comment 24, line 198

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:198

// handling keeps the first scanned event, rather than the capability's claimed same-key/same-content Keep.

Comment 25, line 199

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:199

// Repeated reads do not double-count; ownership remains with the first scanned source session.

Comment 26, line 206

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:206

// Derived input_total=input+cacheRead+cacheWrite: (100+0+0)+(200+40+0)+(10+0+0)=350.

Comment 27, line 212

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:212

// A new fork entry retains the fork session identity and parentSession.

Comment 28, line 225

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:225

// Copied entries keep the first scanned source session's ownership and are marked as conflicts.

Comment 29, line 242

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:242

// Manual calculation (synthetic-error-aborted): both events are primary; input_total=20,

Comment 30, line 243

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:243

// cache_read=5, cache_write=0, output=25, total=45.

Comment 31, line 280

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:280

// Manual calculation (synthetic-cost-estimated): syn-c-1 cost.total=0.005 maps to 5000 micro-USD,

Comment 32, line 281

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:281

// estimated; syn-c-2 cost.total=0 is not mapped. Sum: input_total=105, output=55, total=160.

Comment 33, line 318

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:318

// Derived input_total=input+cacheRead+cacheWrite: (100+0+0)+(5+0+0)=105.

Comment 34, line 323

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:323

// V30 policy (synthetic-unknown-version): an unlisted numeric version (version=4) uses the latest built-in

Comment 35, line 324

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:324

// parser and stores compatibility markers. The versionless legacy format is known to be incompatible:

Comment 36, line 325

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:325

// pinned v1/v2 source omitted version, id, and parentId; reject that format.

Comment 37, line 372

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:372

// v4: latest_fallback imports one event (syn-v4-1: 1/1/0/0/2).

Comment 38, line 380

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:380

// Reject the known incompatible legacy format explicitly; do not report a successful empty scan.

Comment 39, line 396

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:396

// File states: v4 active_compat with compatibility markers; legacy unsupported.

Comment 40, line 411

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:411

// Manual calculation (synthetic-version-fallback, unlisted version=4): both events are primary:

Comment 41, line 412

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:412

// syn-vf-1 (10/5/0/0/15), syn-vf-2 (20/10/0/0/30); call_count=2,

Comment 42, line 413

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:413

// input_total=30, output=15, total=45. All events use parse_basis=latest_fallback;

Comment 43, line 414

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:414

// schema_version retains the source's declared "4"; the file is active_compat with one latest_fallback diagnostic.

Comment 44, line 415

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:415

// A repeated scan adds no events.

Comment 45, line 436

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:436

// Derived input_total=input+cacheRead+cacheWrite: 10+20.

Comment 46, line 441

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:441

// Persist compatibility markers: event parse_basis=latest_fallback; schema_version retains the source declaration.

Comment 47, line 459

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:459

// File state and detection JSON: active_compat, basis/found_version/compat.

Comment 48, line 473

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:473

// A repeated scan adds no events; compatibility markers preserve deduplication.

Comment 49, line 512

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:512

// Manual calculation (synthetic-unknown-record-type): one event (syn-m-1: 7/3/0/0/10).

Comment 50, line 513

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:513

// Unknown type brand_new_thing appears twice; diagnose each type once per file.

Comment 51, line 531

desktop/src-tauri/crates/core/tests/pi_gaps_synthetic.rs:531

// An unknown entry type does not reject the file; its state remains active.