Skip to content

Conversation

@terabytesoftw
Copy link
Member

@terabytesoftw terabytesoftw commented Aug 23, 2025

Q A
Is bugfix? ✔️
New feature?
Breaks BC?

Summary by CodeRabbit

  • Tests
    • Consolidated duplicate tests for the unlimited-memory scenario into a single, unified test.
    • Renamed the test to better reflect its scope and updated assertion messages for clarity (pre/post checks now in one test).
    • Ensured environment cleanup and restoration remain intact.
    • No changes to runtime behavior, configuration, or public interfaces for end-users.

…for unlimited memory limit in `ApplicationMemoryTest` class.
@codecov
Copy link

codecov bot commented Aug 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f8d8342) to head (3e27c72).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##                main      #130   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity       318       318           
===========================================
  Files             12        12           
  Lines            808       808           
===========================================
  Hits             808       808           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@terabytesoftw
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Aug 23, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Aug 23, 2025

Walkthrough

Renamed and consolidated unlimited-memory tests in ApplicationMemoryTest: removed a duplicate test, merged pre- and post-handle assertions into a single test method, and updated assertion messages and method name.

Changes

Cohort / File(s) Summary
Stateless HTTP memory tests
tests/http/stateless/ApplicationMemoryTest.php
Renamed testGetMemoryLimitHandlesUnlimitedMemoryCorrectly()testMemoryLimitHandlesUnlimitedValues(); removed testReturnPhpIntMaxWhenMemoryLimitIsUnlimited(); combined pre-handle and post-clean assertions, updated assertion messages, retained handle()/clean() calls and ini restoration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

bug

Poem

I twitch my nose at bytes that play,
Set mem to -1 and watch it stay.
One test now checks before and after,
Clean the trail, restore, then scatter.
Hoppity-hop — assertions pass today. 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 526863b and 3e27c72.

📒 Files selected for processing (1)
  • tests/http/stateless/ApplicationMemoryTest.php (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/http/stateless/ApplicationMemoryTest.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: mutation / PHP 8.3-ubuntu-latest
  • GitHub Check: mutation / PHP 8.3-ubuntu-latest
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-mini-111

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/http/stateless/ApplicationMemoryTest.php (1)

171-195: Guard ini_set with try/finally and isolate the test in its own process

PHPUnit 10.5 includes the #[RunInSeparateProcess] attribute for method-level process isolation (docs.phpunit.de). To ensure your global memory_limit change can never leak (even if an assertion fails), you should:

  • Wrap the ini_set('memory_limit', '-1') call in a try { … } finally { … } so that the original value is always restored.
  • Annotate the test with #[RunInSeparateProcess] (or /** @runInSeparateProcess */ if you prefer the docblock form).
  • Add the necessary import for the attribute.

Suggested diff:

--- a/tests/http/stateless/ApplicationMemoryTest.php
+++ b/tests/http/stateless/ApplicationMemoryTest.php
@@
-use PHPUnit\Framework\Attributes\{DataProviderExternal, Group, TestWith};
+use PHPUnit\Framework\Attributes\{DataProviderExternal, Group, TestWith, RunInSeparateProcess};

     #[RunInSeparateProcess]
     public function testMemoryLimitHandlesUnlimitedValues(): void
     {
         $originalLimit = ini_get('memory_limit');
-        ini_set('memory_limit', '-1');
-
-        $app = $this->statelessApplication();
-
-        self::assertSame(
-            PHP_INT_MAX,
-            $app->getMemoryLimit(),
-            "Memory limit should be 'PHP_INT_MAX' when set to '-1' (unlimited) in 'StatelessApplication'.",
-        );
-
-        $app->handle(FactoryHelper::createServerRequestCreator()->createFromGlobals());
-        $app->clean();
-
-        self::assertSame(
-            PHP_INT_MAX,
-            $app->getMemoryLimit(),
-            "Memory limit should be 'PHP_INT_MAX' when set to '-1' (unlimited) in 'StatelessApplication'.",
-        );
-
-        ini_set('memory_limit', $originalLimit);
+        try {
+            ini_set('memory_limit', '-1');
+
+            $app = $this->statelessApplication();
+
+            self::assertSame(
+                PHP_INT_MAX,
+                $app->getMemoryLimit(),
+                "Before handle(): Memory limit should be 'PHP_INT_MAX' when set to '-1' (unlimited).",
+            );
+
+            $app->handle(FactoryHelper::createServerRequestCreator()->createFromGlobals());
+            $app->clean();
+
+            self::assertSame(
+                PHP_INT_MAX,
+                $app->getMemoryLimit(),
+                "After clean(): Memory limit should remain 'PHP_INT_MAX' when set to '-1'.",
+            );
+        } finally {
+            ini_set('memory_limit', $originalLimit);
+        }
     }

If you’re on an older PHPUnit that doesn’t support attributes, replace #[RunInSeparateProcess] with a docblock:

/**
 * @runInSeparateProcess
 */

No import is needed for the annotation.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f8d8342 and 526863b.

📒 Files selected for processing (1)
  • tests/http/stateless/ApplicationMemoryTest.php (2 hunks)
🔇 Additional comments (1)
tests/http/stateless/ApplicationMemoryTest.php (1)

171-195: Rename + consolidation looks good

The renamed test reads clearer and the consolidation of the unlimited-memory assertions into one method makes sense.

@terabytesoftw terabytesoftw merged commit 3741fce into main Aug 23, 2025
29 checks passed
@terabytesoftw terabytesoftw deleted the fix-mini-111 branch August 23, 2025 12:02
@terabytesoftw terabytesoftw added the bug Something isn't working label Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants