Skip to content

Detach terminated children, onTerminate() unsubscribe, saturating withTimeout(); release 0.2.0 - #5

Merged
rasuvaeff merged 2 commits into
masterfrom
feat/context-0.2
Oct 11, 2026
Merged

rasuvaeff merged 2 commits into
masterfrom
feat/context-0.2

Conversation

@rasuvaeff

Copy link
Copy Markdown
Owner

Fixes #1
Fixes #2
Fixes #3
Fixes #4

Release 0.2.0 folded in (CHANGELOG.md ## 0.2.0 — 2026-10-11).

Changes

#1 — detach terminated children; unsubscribe

  • A terminated ContextState detaches from its parent and drops its listeners and children, so a long-lived parent no longer retains every cancelled/expired child it derived. A child derived from an already-terminated parent is terminated and not retained.
  • withValue() shares its parent's state (it has no controller), instead of attaching one new child per call.
  • onTerminate() returns an unsubscribe \Closure(): void (idempotent; no-op once the listener ran). roave reports no break (final class, callers ignoring the value unaffected); released as 0.2.0 by decision.

#2 — withTimeout() overflow

  • Non-positive timeout → immediate deadline (now); a timeout beyond the representable range saturates at PHP_INT_MAX instead of overflowing via an out-of-range float→int cast.

#4 — portable deadline: documented the pattern (send (int) remainingMs(), rebuild with withTimeout($ms / 1000) capped by the receiver's limit) and pinned it with a test. No new API.

#3 — docs and tests

  • README/llms.txt placeholders replaced with the real API reference; README.ru.md added; leftover migration template removed from AGENTS.md; CHANGELOG 0.1.0 entry now says what 0.1.0 contains.
  • Property tests: cancelling a node terminates exactly its subtree (random trees, Classify::cover, examples); value lookup finds the nearest ancestor. Existing deadline properties kept.

Also: ContextExpiredException takes an optional $previous (for context-http to keep the transport timeout as the cause); regression-corpus restore/PROPERTY_DB/save steps in the coverage job (zizmor clean); multi-line @api docblocks.

Verification (local)

  • composer build: green (38 tests).
  • Mutation: covered MSI 92 % (minMsi 85). New code leaves only the two equivalent mutants at the saturation boundary (>=/> and a float cast); the other 5 survivors predate this PR.
  • composer rector: clean. composer bc-check: Detected last version: v0.1.0, no backwards-incompatible changes.
  • php -l on PHP 8.3: clean. bin/package-audit: 0 errors. zizmor --persona=auditor .github/: no findings.

@coderabbitai

coderabbitai Bot commented Oct 11, 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: cb0f0e37-5b7d-407d-b17b-f950474764f9

  • 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 8d825ec into master Oct 11, 2026
10 checks passed
@rasuvaeff
rasuvaeff deleted the feat/context-0.2 branch October 11, 2026 09:18
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