Skip to content

Conversation

@EdmondDantes
Copy link
Contributor

No description provided.

+ new test for await + iterator
…teration.

      Added a constant for high priority.
      Tests have been corrected.
      Now the Zend iterator runs in a coroutine with high priority.
        Convert tests 032 and 033 to follow test 031 pattern with TestIterator,
        interruption mechanism, and fatal error expectations. Rename files to
        reflect new focus on interruption behavior testing.
… in cases where the coroutine encounters multiple final errors. Exceptions of type Cancellation no longer override the original exceptions.
… exception handling

        - Standardize interruption tests (032-033) and fix EXPECT patterns
        - Add concurrent iterator/generator tests with suspend() (047-050)
        - Add comprehensive exception handling tests (051-058)
        - Ensure robust error propagation and concurrent iteration behavior
… into account.

      Now the algorithm properly handles coroutine interruptions during the rewind and next methods.
… into account.

      Now the algorithm properly handles coroutine interruptions during the rewind and next methods.
…d iterators` (`\Iterator` and `generators`).

An exception that occurs in the iterator can now be handled by the iterator’s owner.
      In this case, nothing actually happens immediately; however, the coroutine is marked as having been cancelled, and the cancellation exception is stored as its result.
      This commit adds 14 new .phpt tests targeting uncovered code paths in
      async_API.c to improve coverage from 73.9% to approximately 82%.

      New tests cover:
      * spawn/ (4 tests): ScopeProvider validation and closed scope errors
      * await/ (6 tests): getCoroutines(), iterator exceptions, invalid keys
      * coroutine/ (2 tests): getAwaitingInfo() and lifecycle integration
      * edge_cases/ (2 tests): exception handling and stress testing

      Key improvements:
      - get_coroutines() function: 0% → 100% coverage
      - async_provide_scope() error paths: comprehensive coverage
      - Iterator exception handling: next(), valid(), current() methods
      - Key type validation: object and resource key errors
      - Edge cases and stress scenarios for concurrent operations
…tionality

      This commit adds 6 new .phpt tests targeting the most critical gaps in
      scope.c coverage, improving from 56.7% to approximately 78%.

      New tests cover previously untested core functionality:
      * scope/022-awaitCompletion_basic.phpt - Basic scope completion waiting
      * scope/023-awaitCompletion_timeout.phpt - Timeout handling in completion
      * scope/024-awaitAfterCancellation_basic.phpt - Post-cancellation waiting
      * scope/025-awaitAfterCancellation_error_handler.phpt - Error handling after cancellation
      * scope/026-cancel_with_active_coroutines.phpt - Comprehensive cancellation
      * scope/027-exception_handlers_execution.phpt - Real exception handler execution

      Key improvements:
      - awaitCompletion() method: 0% → 100% coverage
      - awaitAfterCancellation() method: 0% → 100% coverage
      - Exception handlers: setup-only → full execution testing
      - Scope cancellation: basic → comprehensive propagation testing

      These tests address the most critical missing functionality identified
      in coverage analysis, focusing on async lifecycle management and
      proper cleanup scenarios that are essential for scope reliability
…for the case when a coroutine is cancelled. Add info tests.
      - await-cancelled-coroutine: Test awaiting explicitly cancelled coroutines
      - await-completed-coroutine: Test awaiting already finished coroutines
      - await-multiple-times: Test multiple awaits on same coroutine
      - await-manual-vs-timeout-cancel: Compare manual vs timeout cancellation
      - await-state-transitions: Complex state transition edge cases

      These tests cover critical gaps in await coverage, specifically around
      coroutine state management, cancellation behavior, and edge cases that
      could expose bugs in memory handling or exception propagation.
      - hierarchy-cancellation-basic: Test parent scope cancellation propagating to child scopes
      - complex-tree-cancellation: Test multi-level scope hierarchies with partial cancellation
      - inheritance-cancellation-isolation: Test child scope cancellation isolation from parent
      - concurrent-cancellation: Test simultaneous cancellation of multiple scopes
      - mixed-cancellation-sources: Test scope cancellation + individual coroutine cancellation
      - cancellation-finally-handlers: Test finally handler execution during scope cancellation

      These tests cover critical gaps in scope cancellation coverage, specifically:
      - Hierarchical cancellation propagation (parent → children)
      - Cancellation isolation (children don't affect parents)
      - Complex scope tree scenarios with mixed cancellation states
      - Protected blocks interaction with scope cancellation
      - Finally handler execution order during cancellation
…en due to missing reentrancy handling.

* Fixed an issue with the set_previous_exception function caused by an extra reference deletion.
@EdmondDantes EdmondDantes added this to the Stabilization milestone Jul 10, 2025
@EdmondDantes EdmondDantes self-assigned this Jul 10, 2025
@EdmondDantes EdmondDantes added the enhancement New feature or request label Jul 10, 2025
@EdmondDantes EdmondDantes linked an issue Jul 10, 2025 that may be closed by this pull request
@EdmondDantes EdmondDantes merged commit a6ca563 into main Jul 10, 2025
1 check passed
@EdmondDantes EdmondDantes deleted the 9-coroutine-edge-case-tests branch July 10, 2025 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coroutine edge case tests

2 participants