-
Notifications
You must be signed in to change notification settings - Fork 8
feat: Add NewContext.withRequest convenience method #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add NewContext.withRequest convenience method #198
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds a convenience method NewContext.withRequest(Request) to create a new context with a different Request while preserving the token, and introduces unit tests covering request rewriting and subsequent context transitions (respond, hijack, connect) and token propagation. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant Middleware
participant InnerHandler
participant NewContext as NewContext
Client->>Middleware: HTTP Request
Middleware->>NewContext: ctx (req, token)
note over Middleware,NewContext: Rewrite incoming request
Middleware->>NewContext: ctx.withRequest(rewrittenReq)
activate NewContext
NewContext-->>Middleware: newCtx (rewrittenReq, same token)
deactivate NewContext
Middleware->>InnerHandler: invoke with newCtx
InnerHandler-->>Middleware: Response / Transition (respond / hijack / connect)
Middleware-->>Client: Final outcome
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Co-authored-by: nielsenko <22237677+nielsenko@users.noreply.github.com>
NewContext.withRequest(Request req) convenience method
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #198 +/- ##
=======================================
Coverage 91.85% 91.85%
=======================================
Files 85 85
Lines 3155 3156 +1
Branches 1630 1631 +1
=======================================
+ Hits 2898 2899 +1
Misses 257 257 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
|
@SandPod As I'm listed as participant I cannot merge this myself. This is my first attempt using co-pilot to fix an issue. |
|
@nielsenko Yes, an external review is always required. I guess that is still good. I'll take a look! |
Yes, only I feel kind of external already, as this was all @copilot . |
SandPod
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The groups are not really connected to the tests. I think copilot could probably fix my comments.
Please assert that the tests adhere to our test guidelines.
|
@copilot Address the feedback. |
Co-authored-by: nielsenko <22237677+nielsenko@users.noreply.github.com>
Restructured all tests to follow the repository's test guidelines. Groups now include both Given and When in descriptions, shared actions are in setUp blocks, and each test validates a single requirement. Commit: db1ca2f
Addressed all feedback. Tests now follow the Given-When-Then pattern with shared setup in setUp blocks and separate tests for each requirement. Commit: db1ca2f |
SandPod
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
|
That went better than I feared 😄 |
Co-authored-by: nielsenko <22237677+nielsenko@users.noreply.github.com>
Updated
Updated |
|
@copilot Address new review comments |
Co-authored-by: nielsenko <22237677+nielsenko@users.noreply.github.com>
NewContext.withRequest(Request req)convenience methodwithRequestmethod toNewContextclass inlib/src/adapter/context.dartsetUpblocksSummary
Refined the testing guidelines in
.github/copilot-instructions.mdto be more flexible:Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
Summary by CodeRabbit
New Features
Tests