Skip to content

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

Comment 1, line 1

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

//! V28/M1a tests for historical source identity, partitions, and record exchange.

Comment 2, line 2

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

//! Check stable host IDs across renames and equal names, plus legacy_unknown ownership.

Comment 3, line 3

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

//! Current prerelease storage rejects older schemas; it does not migrate v3 to v4.

Comment 4, line 4

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

//! Check archive identity, ownership claims, partition rebuilding, versioned exchange fields,

Comment 5, line 5

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

//! duplicate skips, newer revision replacement, independent additions, and retained conflicts.

Comment 6, line 42

desktop/src-tauri/crates/core/tests/migration_v28.rs:42

// Renaming a host adds a name observation without creating a second local host ID.

Comment 7, line 67

desktop/src-tauri/crates/core/tests/migration_v28.rs:67

// Equal hostnames remain distinct because keys use host_id (V28).

Comment 8, line 83

desktop/src-tauri/crates/core/tests/migration_v28.rs:83

// Instance registrations under distinct host namespaces do not overwrite each other.

Comment 9, line 154

desktop/src-tauri/crates/core/tests/migration_v28.rs:154

// Verified local file ownership allows claiming the source as local.

Comment 10, line 185

desktop/src-tauri/crates/core/tests/migration_v28.rs:185

// Local scans must not change imported sources already assigned to another host.

Comment 11, line 240

desktop/src-tauri/crates/core/tests/migration_v28.rs:240

// Prerelease storage rejects older schemas; the app offers rebuilding rather than migration.

Comment 12, line 244

desktop/src-tauri/crates/core/tests/migration_v28.rs:244

// Write one event so the database is nonempty.

Comment 13, line 260

desktop/src-tauri/crates/core/tests/migration_v28.rs:260

// Set the schema version to an older value.

Comment 14, line 275

desktop/src-tauri/crates/core/tests/migration_v28.rs:275

// Two instances have separate daily partitions; queries sum their contributions.

Comment 15, line 276

desktop/src-tauri/crates/core/tests/migration_v28.rs:276

// Source registration and partition identity survive detail deletion.

Comment 16, line 315

desktop/src-tauri/crates/core/tests/migration_v28.rs:315

// Deleting details retains source identity in partitions and registrations.

Comment 17, line 336

desktop/src-tauri/crates/core/tests/migration_v28.rs:336

// Exports join source registrations; run_adapter_scan registers instances before ingestion.

Comment 18, line 388

desktop/src-tauri/crates/core/tests/migration_v28.rs:388

// Versioned exchange JSON survives serialization and parsing.

Comment 19, line 425

desktop/src-tauri/crates/core/tests/migration_v28.rs:425

// No existing record: add the independent contribution.

Comment 20, line 438

desktop/src-tauri/crates/core/tests/migration_v28.rs:438

// Same source, key, revision, and content: skip the duplicate.

Comment 21, line 444

desktop/src-tauri/crates/core/tests/migration_v28.rs:444

// Same revision with different content: retain a conflict regardless of token magnitude.

Comment 22, line 451

desktop/src-tauri/crates/core/tests/migration_v28.rs:451

// A higher revision replaces the old contribution.

Comment 23, line 459

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

// Equal revision numbers cannot identify a newer correction; changed content stays conflicting.

Comment 24, line 460

desktop/src-tauri/crates/core/tests/migration_v28.rs:460

// This matches ingest: ordinary replacement requires a higher revision number.

Comment 25, line 466

desktop/src-tauri/crates/core/tests/migration_v28.rs:466

// With neither revision number present, a later corrected lifecycle can replace final.

Comment 26, line 490

desktop/src-tauri/crates/core/tests/migration_v28.rs:490

// A lower revision retains the existing record and reports differing content as a conflict.

Comment 27, line 498

desktop/src-tauri/crates/core/tests/migration_v28.rs:498

// A different record key adds an independent contribution.

Comment 28, line 509

desktop/src-tauri/crates/core/tests/migration_v28.rs:509

// Regression: scans wrote UTC partitions while users queried Asia/Shanghai.

Comment 29, line 510

desktop/src-tauri/crates/core/tests/migration_v28.rs:510

// Different tz_version values hid retained events; rebuild partitions from those events.

Comment 30, line 512

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

// Simulate UTC partitioning: 2026-09-25 18:30 UTC is Shanghai 09-26 02:30.

Comment 31, line 543

desktop/src-tauri/crates/core/tests/migration_v28.rs:543

// Rebuild the event range in the user's timezone.

Comment 32, line 555

desktop/src-tauri/crates/core/tests/migration_v28.rs:555

// Attribute the event to Shanghai date 2026-09-26 (18:30Z = 02:30+08).

Comment 33, line 557

desktop/src-tauri/crates/core/tests/migration_v28.rs:557

// Retain UTC partitions separately under tz_version.

Comment 34, line 571

desktop/src-tauri/crates/core/tests/migration_v28.rs:571

// WAL allows one writer and concurrent read-only connections during an uncommitted

Comment 35, line 572

desktop/src-tauri/crates/core/tests/migration_v28.rs:572

// transaction; M6 queries no longer wait for a whole scan to release the writer.

Comment 36, line 592

desktop/src-tauri/crates/core/tests/migration_v28.rs:592

// Read-only connections see the committed view while the writer transaction remains open.