Skip to content

feat(gust): Kani-proven wrap-safe time-seam math (VER-OS-TIME-MATH-001, v0.5.1) - #222

Merged
avrabe merged 1 commit into
mainfrom
feat/gust-os-time-math-kani
Jul 23, 2026
Merged

feat(gust): Kani-proven wrap-safe time-seam math (VER-OS-TIME-MATH-001, v0.5.1)#222
avrabe merged 1 commit into
mainfrom
feat/gust-os-time-math-kani

Conversation

@avrabe

@avrabe avrabe commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What

v0.5.1 formal-hardening of the gust:os time capability, over the already-verified (test-level) VER-OS-SYSCALL-001. Extracts the deadline/elapsed arithmetic into a small Kani-proven verified core (drivers/os-time-math) that the time-provider binds to, instead of carrying the math inline.

Also fixes a latent correctness gap

The WIT documents time.elapsed as wrap-safe ("elapsed once now has passed it"), but the inline impl was now >= deadline — only correct in the non-wrapping window. The verified core uses the wrapping-difference half-range test (now.wrapping_sub(deadline) < 2^63) that is genuinely wrap-safe, and is a strict superset of >= in the practical non-wrapping regime (proven). At u64-µs the wrap is ~584,000 years out, so this is not a behavior change for real values — it just makes the impl match its documented contract, with a proof.

Kani (5/5, cargo kani)

  • deadline_total_and_zero_is_nowdeadline never panics/overflows; deadline(now,0)==now.
  • fresh_deadline_not_elapsed — a just-set deadline is not elapsed for any real (0 < ticks < 2^63) delay.
  • at_deadline_is_elapsedelapsed(d,d) is true.
  • advanced_to_deadline_is_elapsed — once now advances by the full delay, elapsed holds (wrap-safe across the domain).
  • matches_plain_compare_without_wrap — agrees with >= whenever no wrap occurs.

Oracles

  • cargo kani on os-time-math5/5 SUCCESSFUL.
  • time-provider still builds for wasm32-unknown-unknown; the gale#214 provider drift gate stays green (8/8 crates).
  • rivet validatePASS (333 warnings, no new diagnostics); adds VER-OS-TIME-MATH-001 (verifies REQ-OS-SYSCALL-001).

Honest scope

Source-level proof over the pure math; the wasm→native dissolve of the provider remains differentially trusted, not proven equivalent (docs/safety/verification-honesty.md). This is additional evidence, not a claim that the whole seam is now formally verified end-to-end.

🤖 Generated with Claude Code

…MATH-001 (v0.5.1)

Extracts the gust:os time capability's deadline/elapsed arithmetic into a verified
core crate (drivers/os-time-math), Kani-proven 5/5, that the time-provider binds to
instead of carrying the math inline — additional formal evidence over the test-level
VER-OS-SYSCALL-001.

Also fixes a latent gap: the inline elapsed was 'now >= deadline', only correct in the
non-wrapping window despite the WIT documenting the helper as wrap-safe. The verified
core uses the wrapping-difference half-range test that is genuinely wrap-safe (and a
strict superset of >= in the practical non-wrapping regime — proven).

Kani 5/5: deadline totality + deadline(now,0)==now; fresh-deadline-not-elapsed;
at-deadline-elapsed; advanced-to-deadline-elapsed (wrap-safe); matches->= without wrap.
Provider still builds for wasm32; gale#214 provider drift gate stays green (8/8);
rivet validate PASS (333 warnings, no new diagnostics).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe
avrabe merged commit d781e1f into main Jul 23, 2026
62 checks passed
@avrabe
avrabe deleted the feat/gust-os-time-math-kani branch July 23, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant