Skip to content

Fix context changes doc#3650

Merged
ReneWerner87 merged 2 commits intomainfrom
codex/2025-08-01-10-34-10
Aug 1, 2025
Merged

Fix context changes doc#3650
ReneWerner87 merged 2 commits intomainfrom
codex/2025-08-01-10-34-10

Conversation

@ReneWerner87
Copy link
Member

Summary

  • clarify removal of Context() and SetContext() in whats_new.md
  • mention that Ctx implements the context.Context interface

Testing

  • go list -m -mod=readonly all
  • make test

https://chatgpt.com/codex/tasks/task_e_688c930877ac83269d417e451c2c7b1e

Copilot AI review requested due to automatic review settings August 1, 2025 10:34
@ReneWerner87 ReneWerner87 requested a review from a team as a code owner August 1, 2025 10:34
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 1, 2025

Walkthrough

The migration guide documentation for Fiber v3 has been updated to clarify the removal of the Context() and SetContext() methods. The new guidance explains that Ctx now directly implements the context.Context interface, and recommends using Locals or middleware for attaching additional context information.

Changes

Cohort / File(s) Change Summary
Fiber v3 Migration Guide Documentation
docs/whats_new.md
Updated documentation to clarify removal of Context() and SetContext() methods, and revised guidance for context usage in Fiber v3.

Sequence Diagram(s)

No sequence diagram generated, as the change is documentation-only.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested labels

📒 Documentation, v3

Suggested reviewers

  • gaby
  • sixcolors

Poem

In docs where context once did roam,
Now Ctx stands tall, all on its own.
No more SetContext(), no more fuss,
Just Locals or middleware—easy for us!
With every hop, the guide grows clear,
Fiber v3’s new path is here!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b7988d and c925eb8.

📒 Files selected for processing (1)
  • docs/whats_new.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/whats_new.md
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/2025-08-01-10-34-10

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @ReneWerner87, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

I've updated the whats_new.md documentation to provide clearer information regarding the removal of the Context() and SetContext() methods. The changes clarify that Ctx now directly implements the context.Context interface, simplifying how context is handled and passed within the application. Additionally, I've added guidance on how to manage additional context information using Locals or middleware, replacing the functionality previously offered by SetContext().

Highlights

  • Documentation Clarification for Context Methods: The docs/whats_new.md file has been updated to clarify that Context() and SetContext() methods have been removed. It now explicitly states that Ctx directly implements the context.Context interface, guiding users to pass c anywhere a context.Context is needed.
  • Guidance on Replaced Functionality: The documentation now provides guidance for the removed SetContext(), suggesting the use of Locals or middleware for attaching additional context information.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the documentation in whats_new.md by clarifying the removal of Context() and SetContext() methods and explaining how Ctx now directly implements the context.Context interface.

  • Clarifies that Context() and SetContext() methods were removed rather than just replaced
  • Provides clearer guidance on how to handle context operations after these method removals
  • Explains that Ctx directly implements context.Context interface

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request provides a good clarification on the removal of the Context() and SetContext() methods in whats_new.md. The updated text is accurate and will be helpful for developers migrating to v3.

To further improve the document's consistency, I recommend removing the outdated entries for these methods from the "Changed Methods" section (lines 503-505). Since these methods are now removed, listing them as changed could be confusing.

Here's a suggested change to address this:

--- a/docs/whats_new.md
+++ b/docs/whats_new.md
@@ -500,6 +500,3 @@
   specified by [RFC 6266](https://www.rfc-editor.org/rfc/rfc6266) and
   [RFC 8187](https://www.rfc-editor.org/rfc/rfc8187).
- **Context**: Renamed to `RequestCtx` to correspond with the FastHTTP Request Context.
- **UserContext**: Renamed to `Context`, which returns a `context.Context` object.
- **SetUserContext**: Renamed to `SetContext`.
 
 ### SendStreamWriter

Copy link
Contributor

@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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8770286 and 8b7988d.

📒 Files selected for processing (1)
  • docs/whats_new.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
docs/**

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Review and update the contents of the docs folder if necessary when modifying code

Files:

  • docs/whats_new.md
🧠 Learnings (8)
📓 Common learnings
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/cache/cache_test.go:897-897
Timestamp: 2024-11-08T04:10:42.990Z
Learning: In the Fiber framework, `Context()` is being renamed to `RequestCtx()`, and `UserContext()` to `Context()` to improve clarity and align with Go's context conventions.
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
Learnt from: sixcolors
PR: gofiber/fiber#3446
File: docs/middleware/logger.md:44-44
Timestamp: 2025-05-13T00:19:16.407Z
Learning: In documentation files for the Fiber framework, code examples are often partial and don't repeat import statements that were shown in earlier examples, focusing instead on demonstrating specific usage patterns.
Learnt from: mdelapenya
PR: gofiber/fiber#3434
File: docs/api/services.md:39-43
Timestamp: 2025-05-07T13:07:33.899Z
Learning: When documenting Go interface methods in the Fiber project, avoid showing method signatures with the interface type as the receiver (e.g., `func (d *Service) Method()`) since interfaces cannot be used as receivers in Go. Instead, show just the method signature without a receiver or use a placeholder implementation name.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/csrf/csrf_test.go:188-193
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In the Fiber framework tests, using `ctx.Response.Header.Cookie` may not be suitable for parsing cookies from the response header, as it requires a `*Cookie` and fills it rather than returning a string value; thus, manual parsing of the `Set-Cookie` header may be necessary.
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/csrf/csrf_test.go:188-193
Timestamp: 2024-09-25T15:57:10.221Z
Learning: In the Fiber framework tests, using `ctx.Response.Header.Cookie` may not be suitable for parsing cookies from the response header, as it requires a `*Cookie` and fills it rather than returning a string value; thus, manual parsing of the `Set-Cookie` header may be necessary.
Learnt from: ckoch786
PR: gofiber/fiber#3230
File: docs/whats_new.md:944-951
Timestamp: 2024-12-15T19:56:45.935Z
Learning: Detailed usage examples and explanations for new methods like `RemoveRoute` and `RemoveRouteByName` are documented in `docs/api/app.md`, so it's unnecessary to duplicate them in `docs/whats_new.md`.
Learnt from: sigmundxia
PR: gofiber/fiber#3151
File: middleware/adaptor/adaptor_test.go:226-230
Timestamp: 2024-09-26T03:08:50.917Z
Learning: In Fiber, the `c.Set` method does not return an error.
Learnt from: sigmundxia
PR: gofiber/fiber#3151
File: middleware/adaptor/adaptor_test.go:226-230
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In Fiber, the `c.Set` method does not return an error.
📚 Learning: in the fiber framework, `context()` is being renamed to `requestctx()`, and `usercontext()` to `cont...
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/cache/cache_test.go:897-897
Timestamp: 2024-11-08T04:10:42.990Z
Learning: In the Fiber framework, `Context()` is being renamed to `RequestCtx()`, and `UserContext()` to `Context()` to improve clarity and align with Go's context conventions.

Applied to files:

  • docs/whats_new.md
📚 Learning: in the fiber framework, breaking changes are acceptable when moving from version 2 to version 3, inc...
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.

Applied to files:

  • docs/whats_new.md
📚 Learning: in the `middleware/adaptor/adaptor.go` file of the fiber framework, when updating context handling, ...
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.

Applied to files:

  • docs/whats_new.md
📚 Learning: in documentation files for the fiber framework, code examples are often partial and don't repeat imp...
Learnt from: sixcolors
PR: gofiber/fiber#3446
File: docs/middleware/logger.md:44-44
Timestamp: 2025-05-13T00:19:16.407Z
Learning: In documentation files for the Fiber framework, code examples are often partial and don't repeat import statements that were shown in earlier examples, focusing instead on demonstrating specific usage patterns.

Applied to files:

  • docs/whats_new.md
📚 Learning: when documenting go interface methods in the fiber project, avoid showing method signatures with the...
Learnt from: mdelapenya
PR: gofiber/fiber#3434
File: docs/api/services.md:39-43
Timestamp: 2025-05-07T13:07:33.899Z
Learning: When documenting Go interface methods in the Fiber project, avoid showing method signatures with the interface type as the receiver (e.g., `func (d *Service) Method()`) since interfaces cannot be used as receivers in Go. Instead, show just the method signature without a receiver or use a placeholder implementation name.

Applied to files:

  • docs/whats_new.md
📚 Learning: detailed usage examples and explanations for new methods like `removeroute` and `removeroutebyname` ...
Learnt from: ckoch786
PR: gofiber/fiber#3230
File: docs/whats_new.md:944-951
Timestamp: 2024-12-15T19:56:45.935Z
Learning: Detailed usage examples and explanations for new methods like `RemoveRoute` and `RemoveRouteByName` are documented in `docs/api/app.md`, so it's unnecessary to duplicate them in `docs/whats_new.md`.

Applied to files:

  • docs/whats_new.md
📚 Learning: in fiber, the `c.set` method does not return an error....
Learnt from: sigmundxia
PR: gofiber/fiber#3151
File: middleware/adaptor/adaptor_test.go:226-230
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In Fiber, the `c.Set` method does not return an error.

Applied to files:

  • docs/whats_new.md

Comment on lines 113 to 115
- **Context()**: Removed. `Ctx` now directly implements `context.Context`, so pass `c` anywhere a `context.Context` is required.
- **SetContext()**: Removed. Attach additional context information using `Locals` or middleware if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

❓ Verification inconclusive

Contradicting claims – are Context() / SetContext() removed or just renamed?

These two bullets state that both methods were removed, yet the “Changed Methods” list later in the same document (Line 503 ff.) still advertises:

  • ContextRequestCtx
  • UserContextContext
  • SetUserContextSetContext

Having the same API element marked as removed and renamed in one guide will mislead users during migration.

Please reconcile the sections and pick one story:

  1. If the functions are truly deleted, delete/adjust the “Changed Methods” entries.
  2. If they were only renamed (as earlier PR discussions & learnings suggest), rewrite the bullet here to “Renamed” instead of “Removed”.

Until this inconsistency is fixed, developers cannot reliably update their codebase.


Update “Removed” bullets to “Renamed” in docs/whats_new.md

The methods in question were renamed, not deleted—please adjust the bullets at lines 113–115:

• File: docs/whats_new.md
• Lines: 113–115

Suggested diff:

--- a/docs/whats_new.md
+++ b/docs/whats_new.md
@@ -113,7 +113,7 @@
- **Context()**: Removed. `Ctx` now directly implements `context.Context`, so pass `c` anywhere a `context.Context` is required.
+ **Context()**: Renamed to `RequestCtx()`. `Ctx` now directly implements `context.Context`, so pass `c` anywhere a `context.Context` is required.

- **SetContext()**: Removed. Attach additional context information using `Locals` or middleware if needed.
+ **SetContext()**: Renamed from `SetUserContext()`. Attach additional context information using `Locals` or middleware if needed.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **Context()**: Removed. `Ctx` now directly implements `context.Context`, so pass `c` anywhere a `context.Context` is required.
- **SetContext()**: Removed. Attach additional context information using `Locals` or middleware if needed.
- **Context()**: Renamed to `RequestCtx()`. `Ctx` now directly implements `context.Context`, so pass `c` anywhere a `context.Context` is required.
- **SetContext()**: Renamed from `SetUserContext()`. Attach additional context information using `Locals` or middleware if needed.
🤖 Prompt for AI Agents
In docs/whats_new.md around lines 113 to 115, update the bullet points from
"Removed" to "Renamed" to accurately reflect that the methods were renamed
rather than deleted. Change the wording to indicate the methods have new names
or implementations instead of stating they were removed.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: Context() context.Context was removed from v3.0.0-beta.5

2 participants