Skip to content

Release 0.3.0: sleep, iterate, reserve, detach, join, deferred cancel, wire codec - #16

Merged
rasuvaeff merged 2 commits into
masterfrom
feat/0.3.0
Oct 15, 2026
Merged

rasuvaeff merged 2 commits into
masterfrom
feat/0.3.0

Conversation

@rasuvaeff

Copy link
Copy Markdown
Owner

Fixes #8
Fixes #9
Fixes #10
Fixes #11
Fixes #12
Fixes #13
Fixes #14
Fixes #15

Added

API Issue
Testing\FakeTimeSource, Testing\SteppingTimeSource shipped in src/ #8
Sleeper, UsleepSleeper, Context::sleep(); background(?TimeSource, ?Sleeper) #9
Context::withoutCancel() — values only, no state or parent link #10
Context::withReserve() — the parent deadline minus a reserve #11
Context::iterate() — checks before pulling each element, keeps keys, every: #12
ContextController::requestCancel() — signal-safe: records the cause, the next check applies it, listener failures surface in normal flow #13
Context::joinedWith() — the internal state becomes a DAG; a terminated node detaches from every parent #14
WireCodec + WireValue — remaining budget and allow-listed values across a process boundary; decode() never throws on untrusted input, a missing/malformed budget falls back to maxBudgetMs #15

Fixed

  • withTimeout() truncated seconds → nanoseconds: withTimeout(1.015) reported remainingMs() === 1014.0 right away. Now round() (found by the withReserve property).

Notes

  • Requested cancellations are applied ancestors-first with a visited set (joins share ancestors). A process-wide pending counter skips the walk while zero — a check costs ~0.2 µs at any depth (benchmarks/ContextBench.php: 0.9 µs → 0.22 µs at depth 10).
  • Verified on a real usleep(): SIGALRM + requestCancel() ends sleep(5) after 1.00 s; the listener runs outside the handler.
  • Docs: README (EN + RU) — new derivations, sleep/iterate, signal handlers, WireCodec, "Writing an adapter" (read the budget before assertActive()); llms.txt; AGENTS.md invariants; the agent skill rewritten for 0.3; examples/derivations.php.
  • MSI 92% (survivors are equivalent: float saturation boundaries, the always-set deadline owner, fast-path counter comparisons); minMsi 85 → 90.
  • roave: no backwards-incompatible changes vs v0.2.0. CHANGELOG 0.3.0 — 2026-10-15.

…, wire codec

- Testing\FakeTimeSource / SteppingTimeSource ship in src (#8)
- Sleeper + UsleepSleeper + Context::sleep() (#9)
- withoutCancel(): values only, no state or parent link (#10)
- withReserve(): the parent deadline minus a reserve (#11)
- iterate(): checks before pulling each element, keeps keys (#12)
- ContextController::requestCancel(): records the cause only; the next check
  of the subtree applies it, so listener failures surface in normal flow (#13)
- joinedWith(): the state becomes a DAG; a terminated node detaches from
  every parent, addChild() ignores an already terminated child (#14)
- WireCodec + WireValue: remaining budget and allow-listed values across a
  process boundary; decode() never throws on untrusted input (#15)
- withTimeout() rounds seconds to nanoseconds instead of truncating:
  withTimeout(1.015) reported remainingMs() === 1014.0
- A process-wide pending counter keeps a check at ~0.2 us at any depth
- minMsi 85 -> 90 (measured 92%)

Fixes #8
Fixes #9
Fixes #10
Fixes #11
Fixes #12
Fixes #13
Fixes #14
Fixes #15
…resh the agent skill

decode() built a context without any deadline when budget_ms was missing or
malformed, so untrusted input could lift the receiver's own limit. It now
falls back to maxBudgetMs.

The agent skill is rewritten for 0.3: safety rules (read the budget before
assertActive(), requestCancel() in signal handlers, derive vs join, untrusted
wire budgets), a decision table; it no longer mentions a scheduler that does
not exist. READMEs gain the llm/skills line.

A test pins the fast-path counter balance; a probe on a real usleep() with
SIGALRM confirmed requestCancel() wakes sleep() after 1.00 s and runs the
listener outside the handler.
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ba2b4fa3-5392-4986-8ddc-10db51a1a109
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rasuvaeff
rasuvaeff merged commit 5fd5c17 into master Oct 15, 2026
10 checks passed
@rasuvaeff
rasuvaeff deleted the feat/0.3.0 branch October 15, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment