Skip to content

Fix unbounded interval sampling, persistence, and Allen relations - #6

Merged
script3r merged 1 commit into
mainfrom
codex/fix-temporal-overflow
Sep 5, 2026
Merged

Fix unbounded interval sampling, persistence, and Allen relations#6
script3r merged 1 commit into
mainfrom
codex/fix-temporal-overflow

Conversation

@script3r

@script3r script3r commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Unbounded intervals currently overflow overlap subtraction: debug builds panic, and release builds can silently reject every sampled candidate. This change saturates oversized overlap and finite-duration calculations at i64::MAX, while preserving None for infinite durations. It also corrects the reversed Finishes / FinishedBy relations.

Persistent ingestion exposed a related failure before sampling: the temporal index tries to allocate one entry per day across the entire interval. Intervals spanning more than 4,096 daily buckets now use one reserved bucket. Narrow queries include that bucket; broad queries scan existing index entries and filter by actual overlap. Existing day-indexed records remain readable without an index rebuild. Broad queries remain proportional to the stored index size.

Regression coverage includes all 13 Allen relations, extreme finite and infinite endpoints, deterministic sampling with PersistentStore, temporal queries after restart, and unbounded batch ingestion and queries through a router and two persistent shards.

Validation completed locally:

  • cargo test: 321 passed, two existing doctests ignored.
  • cargo test --test distributed_e2e: both tests passed, including the subsequently added distributed regression.
  • Release temporal unit tests and cargo test --release --test temporal_sampling passed.
  • cargo clippy --all-targets, cargo fmt --check, and git diff --check passed.
  • Before/after load test: five persistent shards, 1,000,000 records, 16 streams, batches of 5,000, 10% overlap, seed 42. Both runs acknowledged every record with zero stream errors. Throughput was 42,646 → 42,782 records/sec; average RPC latency was 1,614.68 → 1,610.93 ms. This is a same-machine comparison; the historical 410K records/sec baseline was not reproduced.

Fixes #4
Fixes #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant