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
    • Simplified assertion messages for clarity.
    • Added Content-Type checks for key routes (application/json; charset=UTF-8 for site/index, text/html; charset=UTF-8 for site/statuscode and site/cookie).
    • Updated expected status code for site/statuscode to 200.
    • Tightened messaging around adapter caching and isolation, core components, start-time headers, and web aliases.
    • No changes to public APIs.
  • Chores
    • No user-facing changes; improvements are limited to test coverage and readability.

@coderabbitai
Copy link

coderabbitai bot commented Aug 23, 2025

Warning

Rate limit exceeded

@terabytesoftw has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 23 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between bf8b467 and 6d25361.

📒 Files selected for processing (1)
  • tests/http/stateless/ApplicationCoreTest.php (12 hunks)

Walkthrough

This PR updates tests in tests/http/stateless/ApplicationCoreTest.php: simplifies assertion messages, adjusts expected status codes for a route, and adds/updates Content-Type header assertions for specific routes. No public API signatures are changed.

Changes

Cohort / File(s) Summary
Test assertion updates
tests/http/stateless/ApplicationCoreTest.php
Shortened assertion messages; updated expected status for site/statuscode from 201 to 200; added/explicitly asserted Content-Type headers for site/index (application/json; charset=UTF-8), site/statuscode (text/html; charset=UTF-8), and site/cookie (text/html; charset=UTF-8); tightened wording around adapter caching/isolation, core components, start-time header, and web alias checks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

I thump my paws on JSON snow,
Headers crisp, status codes in tow.
Shorter squeaks, no fluff to spare,
Cookies crumble, content-type declare.
In stateless burrows, tests align—
A tidy warren, sleek by design. 🐇✨

✨ 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-115

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.

@terabytesoftw terabytesoftw added the bug Something isn't working label Aug 23, 2025
@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 (c7f6fe7) to head (6d25361).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##                main      #134   +/-   ##
===========================================
  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.

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: 1

🧹 Nitpick comments (4)
tests/http/stateless/ApplicationCoreTest.php (4)

59-86: Assertion message simplification looks good; consider trimming redundancy.

The shorter messages read cleaner and align with the PR goal. Minor nit: you can drop the explanatory “ensuring PSR-7 … available” suffixes to keep them even tighter, since the asserted condition already communicates intent.


110-116: Content-Type assertions added — consider making them robust to case and parameter order.

Header parameter case and ordering can vary by emitter (e.g., “utf-8” vs “UTF-8”, or swapped param order). To avoid brittle tests, prefer a case-insensitive regex match (or parse and compare media type + charset). Example for site/index:

-        self::assertSame(
-            'application/json; charset=UTF-8',
-            $response1->getHeaderLine('Content-Type'),
-            "Expected Content-Type 'application/json; charset=UTF-8' for route 'site/index'.",
-        );
+        self::assertMatchesRegularExpression(
+            '/^application\/json(?:\s*;\s*charset\s*=\s*utf-8)?$/i',
+            $response1->getHeaderLine('Content-Type'),
+            "Expected Content-Type application/json with UTF-8 charset for route 'site/index'.",
+        );

Apply similarly for the text/html assertions.

Also applies to: 154-157, 208-212, 327-331


135-136: Tone/style consistency in messages.

For a crisper tone, consider removing quotes around method names and phrases like “confirming … behavior.” The assertion name and condition already convey that. Example: “Adapter instance should be cached across multiple getPsr7Response() calls.”

Also applies to: 189-190, 246-247, 299-301


364-365: Trailing comma in assertion message.

Minor punctuation nit: end the message with a period instead of a comma.

-            "'@webroot' alias should be set to the parent directory of the test directory after handling a request,",
+            "'@webroot' alias should be set to the parent directory of the test directory after handling a request.",
📜 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 c7f6fe7 and bf8b467.

📒 Files selected for processing (1)
  • tests/http/stateless/ApplicationCoreTest.php (12 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-08-03T16:24:09.241Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#53
File: src/http/ErrorHandler.php:258-272
Timestamp: 2025-08-03T16:24:09.241Z
Learning: In yii2-extensions/psr-bridge, the StatelessApplication creates a new Response instance for each request in the reset() method (line 408: `$this->response = new Response($this->components['response'] ?? []);`), then passes it to ErrorHandler::setResponse(). This means the template response is not shared across requests, so calling clear() on it in createErrorResponse() is safe and doesn't cause side effects.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-08-03T16:24:09.241Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#53
File: src/http/ErrorHandler.php:258-272
Timestamp: 2025-08-03T16:24:09.241Z
Learning: In yii2-extensions/psr-bridge, the StatelessApplication creates a new Response instance for each request in the reset() method, then passes it to ErrorHandler::setResponse(). This means the template response is not shared across requests, so calling clear() on it in createErrorResponse() is safe and doesn't cause side effects.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-08-06T22:52:05.608Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#64
File: tests/http/StatelessApplicationTest.php:1939-1967
Timestamp: 2025-08-06T22:52:05.608Z
Learning: In yii2-extensions/psr-bridge tests, when testing specific component methods like Request::resolve(), it's necessary to call $app->handle($request) first to initialize all application components before testing the method in isolation. This ensures proper component lifecycle initialization.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-07-22T00:50:26.546Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#21
File: tests/http/PSR7ResponseTest.php:0-0
Timestamp: 2025-07-22T00:50:26.546Z
Learning: In yii2-extensions/psr-bridge, the ResponseAdapter::formatCookieHeader() method uses `$expire !== 1` to skip validation for Yii2's special deletion cookies, but this should be extended to handle all expired cookies, not just the special case where expire=1.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
🔇 Additional comments (1)
tests/http/stateless/ApplicationCoreTest.php (1)

162-166: Statelessness and adapter isolation checks are on-point.

Asserting different Response instances per request and different adapters per request aligns with the project’s stateless application model we’ve seen previously. Good coverage here.

Also applies to: 221-225

@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.

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