Skip to content

Conversation

@nielsenko
Copy link
Collaborator

@nielsenko nielsenko commented Oct 28, 2025

Description

Renames core context types for improved clarity and consistency:

  • NewContextRequestContext
  • ConnectContextConnectionContext
  • HijackContextHijackedContext

Additionally:

  • Base class RequestContext renamed to Context
  • Extension RequestContextEx renamed to match new naming
  • Removes unused final parameter modifiers in lambda expressions
  • Updates all in-code documentation, examples, and tests. Docusaurus site not touched.

Related Issues

Pre-Launch Checklist

  • This update focuses on a single feature or bug fix.
  • I have read and followed the Dart Style Guide and formatted the code using dart format.
  • I have referenced at least one issue this PR fixes or is related to.
  • I have updated/added relevant documentation (doc comments with ///), ensuring consistency with existing project documentation. BUT NOT DOCUSAURUS SITE
  • I have added new tests to verify the changes.
  • All existing and new tests pass successfully.
  • I have documented any breaking changes below.

Breaking Changes

  • Includes breaking changes.

Type Renames

Old Name New Name
NewContext RequestContext
ConnectContext ConnectionContext
HijackContext HijackedContext
RequestContext (sealed base) Context (sealed base)

All handler signatures must be updated to use the new type names.

Additional Notes

This is a pure rename refactor with no behavioral changes. The rename improves semantic clarity—RequestContext better describes the initial request state, while Context serves as the appropriate base class name.

Docusaurus site is not updated as to avoid excessive conflicts with inflight doc PRs.

Summary by CodeRabbit

  • New Features

    • Added structured route lookup results with improved error differentiation for missing paths versus unsupported methods.
  • Refactor

    • Updated request handler context type hierarchy with improved naming conventions.
    • Simplified context state transitions and response handling patterns.
    • Reorganized context property accessors to work with the updated context types.

@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.41%. Comparing base (a36d5fc) to head (4e463ab).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/src/middleware/middleware_logger.dart 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #251   +/-   ##
=======================================
  Coverage   91.41%   91.41%           
=======================================
  Files          89       89           
  Lines        3458     3459    +1     
  Branches     1763     1763           
=======================================
+ Hits         3161     3162    +1     
  Misses        297      297           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 28, 2025

📝 Walkthrough

Walkthrough

Systematic refactoring renaming NewContext to RequestContext, HijackContext to HijackedContext, and ConnectContext to ConnectionContext throughout the codebase. Restructures context hierarchy with new base Context sealed class. Introduces LookupResult sealed class hierarchy for router lookups. Updates all handler signatures, extensions, middleware, and examples to reflect new type names while preserving behavioral logic.

Changes

Cohort / File(s) Summary
Context Hierarchy Restructuring
lib/src/adapter/context.dart
Introduces sealed Context base class; RequestContext now extends Context; renames HijackContextHijackedContext, ConnectContextConnectionContext; adds state classes ResponseContext, HandledContext; updates method signatures (respond() moves to ResponseContext); removes withRequest(), replaces with Request.toContext() extension.
Handler and Router Lookup Types
lib/src/handler/handler.dart, lib/src/router/lookup_result.dart
Handler typedef updated to accept RequestContext instead of NewContext; HijackHandler return type renamed to HijackedContext. New sealed class hierarchy: LookupResult<T> base, Miss<T>, PathMiss<T>, MethodMiss<T>, RouterMatch<T> with LookupResultExtension for casting.
Core Library Files
lib/src/io/static/static_handler.dart, lib/src/middleware/context_property.dart, lib/src/middleware/routing_middleware.dart, lib/src/router/router_handler_extension.dart
Renamed context parameter types from NewContext to RequestContext across method signatures; ContextProperty methods updated to use Context instead of RequestContext; RequestContextEx extension retargeted from RequestContext to Context; static handler handler signature updated.
Middleware and Logging
lib/src/middleware/middleware.dart, lib/src/middleware/middleware_logger.dart, lib/src/relic_server.dart
Documentation examples updated to reflect RequestContext; middleware logger switch cases updated to use HijackedContext and ConnectionContext; server hijack/connect handling adjusted for new context type names.
Examples
example/basic/body_example.dart, example/context/*.dart, example/middleware/*.dart, example/example.dart
All handler functions updated to accept RequestContext instead of NewContext; context type references in comments and documentation updated; StreamHandler updated to use yield pattern.
Tests
test/handler/pipeline_test.dart, test/hijack/relic_hijack_test.dart, test/middleware/routing_middleware_test.dart, test/router/router_inject_test.dart, test/src/adapter/context_test.dart, test/src/middleware/context_property_test.dart, test/util/test_util.dart
Test handler signatures updated to use RequestContext; test context variable types updated; type assertions adjusted to use renamed context types (HijackedContext, ConnectionContext).
Documentation
lib/src/middleware/middleware.dart, lib/src/router/router.dart
Code examples and inline documentation updated to reference new context type names without behavioral changes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention:

  • lib/src/adapter/context.dart – Core context hierarchy restructuring; verify all constructor signatures, extension methods, and token propagation through the new sealed class hierarchy are correct
  • lib/src/router/lookup_result.dart – New sealed class hierarchy; ensure LookupResult, Miss, PathMiss, MethodMiss, and RouterMatch properly model 404/405 error semantics and LookupResultExtension.asMatch casting is sound
  • Handler typedef and extension changes – Cross-file consistency of Handler, HijackHandler, HandlerObject.call, and RouterHandlerEx.call signatures must align across lib/src/handler/handler.dart, lib/src/router/router_handler_extension.dart, and lib/src/io/static/static_handler.dart
  • ContextProperty API changes – Verify all operator[], getOrNull, operator[]=, exists, clear methods correctly accept Context and maintain backward compatibility with internal token-based lookup via Expando
  • Test coverage – Ensure test fixtures and helper functions in test/util/test_util.dart and test files correctly reflect new context types; verify context type assertions in test/src/adapter/context_test.dart validate state transitions

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "refactor!: Context renaming" accurately and concisely summarizes the primary change in the changeset. The title clearly indicates that this is a breaking refactor (denoted by the !) focused on renaming context types for improved clarity. It's specific enough for teammates to understand the main objective when scanning commit history, and it directly corresponds to the comprehensive context type renames throughout the codebase (NewContext → RequestContext, ConnectContext → ConnectionContext, HijackContext → HijackedContext, and the base RequestContext → Context).
Out of Scope Changes Check ✅ Passed The changeset is focused and in-scope with the linked issue objectives. The primary changes are the context type renames throughout the codebase affecting handler signatures, middleware, routing, extensions, and tests. Additionally, the PR includes minor style improvements by removing unused final parameter modifiers in lambda expressions (e.g., (final _, final __)(_, _)). These lambda simplifications, while technically beyond strict renaming scope, are reasonable refinements disclosed in the PR description and represent minor code quality improvements during the refactor. No substantive out-of-scope or unrelated changes were detected that would indicate feature creep or scope creep beyond the documented objectives.
Description Check ✅ Passed The PR description follows the template structure and includes all major required sections: a clear and specific description of the changes, linked related issues, a completed pre-launch checklist (with most items checked), breaking changes documented in a helpful table format, and additional context. The description clearly explains the renaming of context types and their purpose. However, one pre-launch checklist item is unchecked: "I have added new tests to verify the changes," though the author did verify that all existing tests pass. The author also notes that Docusaurus documentation was intentionally not updated to avoid conflicts with other PRs in progress, which provides reasonable context for the partial documentation update. These minor gaps do not significantly detract from an otherwise comprehensive and well-structured description.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@nielsenko nielsenko force-pushed the context-rename branch 2 times, most recently from 065f443 to c6271fc Compare October 29, 2025 06:18
@nielsenko
Copy link
Collaborator Author

@CodeRabbit review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 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
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

🧹 Nitpick comments (7)
lib/src/router/lookup_result.dart (1)

5-12: Typed lookup outcomes are clear and well‑documented.

The sealed hierarchy and RouterMatch integration look solid. Consider adding a small helper to avoid explicit casts at call sites.

Example ergonomic helper:

extension LookupResultWhen<T> on LookupResult<T> {
  R when<R>({
    required R Function(RouterMatch<T>) match,
    required R Function(PathMiss<T>) pathMiss,
    required R Function(MethodMiss<T>) methodMiss,
  }) {
    final self = this;
    if (self is RouterMatch<T>) return match(self);
    if (self is PathMiss<T>) return pathMiss(self);
    return methodMiss(self as MethodMiss<T>);
  }
}

Also applies to: 16-22, 24-33, 34-43, 45-49, 50-57

lib/src/middleware/routing_middleware.dart (1)

112-117: Extension correctly broadened to Context base type.

The extension now operates on Context instead of RequestContext, making routing information accessible to all context subtypes. This is a logical improvement given the new context hierarchy.

Optional: Consider renaming the extension for clarity.

The extension name RequestContextEx may be slightly misleading now that it operates on the base Context type. Consider renaming to ContextEx or RoutingContextEx in a future update to better reflect its scope, though this is a minor naming concern and may have been kept for backward compatibility.

example/middleware/example.dart (2)

43-45: Extension receiver updated to Context — correct.

Makes the property available on all Context variants. Consider naming the extension to avoid anonymous-extension collisions in larger apps.

-extension on Context {
+extension ContextUserEx on Context {
   User get user => _auth[this];
 }

11-25: Use a top‑level entrypoint for Isolate.spawn.

Passing an async closure can fail at runtime; prefer a top‑level/static function.

-  final server = await Isolate.spawn((_) async {
-    final app =
-        RelicApp()
-          ..use(
-            '/api',
-            AuthMiddleware().asMiddleware,
-          )
-          ..get(
-            '/api/user/info',
-            (final ctx) =>
-                ctx.respond(Response.ok(body: Body.fromString('${ctx.user}'))),
-          );
-    await app.serve();
-  }, null);
+  final server = await Isolate.spawn(_serverEntry, null);
+
+void _serverEntry(Object? _) async {
+  final app = RelicApp()
+    ..use('/api', AuthMiddleware().asMiddleware)
+    ..get(
+      '/api/user/info',
+      (final ctx) => ctx.respond(Response.ok(body: Body.fromString('${ctx.user}'))),
+    );
+  await app.serve();
+}
test/src/middleware/context_property_test.dart (1)

11-12: Update test descriptions for consistency.

Several group titles still say “RequestContext” while the code uses the base “Context.” Consider updating the strings for clarity; no code changes needed.

Also applies to: 96-99, 141-145, 185-187, 215-215

lib/src/handler/handler.dart (2)

114-118: Prefer explicit parameter typing in respondWith for clarity.

Adding the param type improves readability and catches accidental signature drift.

-Handler respondWith(final Responder responder) {
-  return (final ctx) async {
+Handler respondWith(final Responder responder) {
+  return (final RequestContext ctx) async {
     return ctx.respond(await responder(ctx.request));
   };
 }

126-130: Ditto for hijack helper.

Make the parameter type explicit.

-HijackHandler hijack(final HijackCallback callback) {
-  return (final ctx) {
+HijackHandler hijack(final HijackCallback callback) {
+  return (final HijackableContext ctx) {
     return ctx.hijack(callback);
   };
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a36d5fc and c6271fc.

📒 Files selected for processing (27)
  • example/basic/body_example.dart (9 hunks)
  • example/context/context_example.dart (7 hunks)
  • example/context/context_property_example.dart (1 hunks)
  • example/example.dart (1 hunks)
  • example/middleware/auth_example.dart (2 hunks)
  • example/middleware/cors_example.dart (2 hunks)
  • example/middleware/example.dart (1 hunks)
  • example/middleware/middleware_example.dart (4 hunks)
  • example/middleware/pipeline_example.dart (3 hunks)
  • lib/src/adapter/context.dart (5 hunks)
  • lib/src/handler/handler.dart (8 hunks)
  • lib/src/io/static/static_handler.dart (12 hunks)
  • lib/src/middleware/context_property.dart (4 hunks)
  • lib/src/middleware/middleware.dart (2 hunks)
  • lib/src/middleware/middleware_logger.dart (1 hunks)
  • lib/src/middleware/routing_middleware.dart (1 hunks)
  • lib/src/relic_server.dart (1 hunks)
  • lib/src/router/lookup_result.dart (1 hunks)
  • lib/src/router/router.dart (1 hunks)
  • lib/src/router/router_handler_extension.dart (1 hunks)
  • test/handler/pipeline_test.dart (1 hunks)
  • test/hijack/relic_hijack_test.dart (1 hunks)
  • test/middleware/routing_middleware_test.dart (8 hunks)
  • test/router/router_inject_test.dart (1 hunks)
  • test/src/adapter/context_test.dart (4 hunks)
  • test/src/middleware/context_property_test.dart (2 hunks)
  • test/util/test_util.dart (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.dart

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.dart: All Dart code must pass static analysis using dart analyze --fatal-infos with no issues
All Dart files must be formatted with dart format (CI enforces dart format --set-exit-if-changed .)

Files:

  • example/example.dart
  • lib/src/router/router.dart
  • example/context/context_property_example.dart
  • lib/src/middleware/routing_middleware.dart
  • example/middleware/example.dart
  • lib/src/router/router_handler_extension.dart
  • example/middleware/middleware_example.dart
  • example/middleware/cors_example.dart
  • example/middleware/auth_example.dart
  • test/src/middleware/context_property_test.dart
  • example/middleware/pipeline_example.dart
  • test/middleware/routing_middleware_test.dart
  • test/hijack/relic_hijack_test.dart
  • test/src/adapter/context_test.dart
  • test/router/router_inject_test.dart
  • test/util/test_util.dart
  • lib/src/middleware/middleware.dart
  • lib/src/middleware/middleware_logger.dart
  • lib/src/router/lookup_result.dart
  • test/handler/pipeline_test.dart
  • lib/src/handler/handler.dart
  • example/basic/body_example.dart
  • lib/src/io/static/static_handler.dart
  • example/context/context_example.dart
  • lib/src/middleware/context_property.dart
  • lib/src/adapter/context.dart
  • lib/src/relic_server.dart
lib/**/*.dart

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

lib/**/*.dart: Use Uint8List for request/response bodies for performance; avoid List for body payloads
Use type-safe HTTP header parsing and validation when accessing headers
Use router with trie-based matching and symbol-based path parameters (e.g., #name, #age) for routing
Ensure WebSocket handling includes proper lifecycle management (e.g., ping/pong for connection health)

Files:

  • lib/src/router/router.dart
  • lib/src/middleware/routing_middleware.dart
  • lib/src/router/router_handler_extension.dart
  • lib/src/middleware/middleware.dart
  • lib/src/middleware/middleware_logger.dart
  • lib/src/router/lookup_result.dart
  • lib/src/handler/handler.dart
  • lib/src/io/static/static_handler.dart
  • lib/src/middleware/context_property.dart
  • lib/src/adapter/context.dart
  • lib/src/relic_server.dart
test/**/*.dart

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

test/**/*.dart: Tests should follow the Given-When-Then pattern in descriptions (flexible structuring allowed)
Use Arrange-Act-Assert pattern within test bodies
Provide clear, descriptive test titles; prefer single responsibility per test unless related assertions improve clarity
Place tests in the test/ directory mirroring the lib/ structure

Files:

  • test/src/middleware/context_property_test.dart
  • test/middleware/routing_middleware_test.dart
  • test/hijack/relic_hijack_test.dart
  • test/src/adapter/context_test.dart
  • test/router/router_inject_test.dart
  • test/util/test_util.dart
  • test/handler/pipeline_test.dart
🧠 Learnings (2)
📚 Learning: 2025-05-23T04:15:01.420Z
Learnt from: nielsenko
PR: serverpod/relic#76
File: lib/src/handler/handler.dart:20-20
Timestamp: 2025-05-23T04:15:01.420Z
Learning: In the relic codebase, ResponseContext is a subtype of HandledContext, making functions with signature ResponseContext Function(RequestContext) assignable to the Handler typedef (FutureOr<HandledContext> Function(NewContext ctx)) due to covariant return types and contravariant parameter types in Dart's type system.

Applied to files:

  • example/example.dart
  • example/context/context_property_example.dart
  • example/middleware/middleware_example.dart
  • example/middleware/cors_example.dart
  • example/middleware/auth_example.dart
  • example/middleware/pipeline_example.dart
  • test/util/test_util.dart
  • test/handler/pipeline_test.dart
  • lib/src/handler/handler.dart
  • example/basic/body_example.dart
  • example/context/context_example.dart
  • lib/src/adapter/context.dart
📚 Learning: 2025-10-09T16:21:09.310Z
Learnt from: CR
PR: serverpod/relic#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-10-09T16:21:09.310Z
Learning: Applies to lib/**/*.dart : Use router with trie-based matching and symbol-based path parameters (e.g., `#name`, `#age`) for routing

Applied to files:

  • lib/src/router/lookup_result.dart
🔇 Additional comments (25)
lib/src/middleware/middleware_logger.dart (1)

25-27: Rename alignment in logger switch is correct.

Matches the new HijackedContext and ConnectionContext types; behavior unchanged. LGTM.

test/handler/pipeline_test.dart (1)

31-35: Signature update to RequestContext is correct.

Test remains valid; aligns with Handler using RequestContext. LGTM.

lib/src/router/router.dart (1)

320-323: Doc rename verification passed - no issues found.

The documentation examples correctly reference RequestContext and ResponseContext, which are properly defined in the codebase. The legacy name search found no stragglers. The type signatures in the doc examples are consistent with the actual Handler typedef.

example/example.dart (1)

25-25: LGTM! Clean type rename.

The parameter type update from NewContext to RequestContext is consistent with the repository-wide context refactoring. Function behavior is preserved.

lib/src/relic_server.dart (1)

128-132: LGTM! Consistent context type updates.

The switch cases correctly use the renamed context types (HijackedContext and ConnectionContext). The adapter method calls maintain the same behavior, passing the appropriate callbacks as before.

lib/src/middleware/middleware.dart (1)

26-26: LGTM! Documentation updated to reflect new context naming.

The documentation examples and comments have been correctly updated to use RequestContext, maintaining clarity and consistency with the refactored API.

Also applies to: 98-98

test/middleware/routing_middleware_test.dart (1)

37-37: LGTM! Test handler signatures updated consistently.

All test handlers have been updated to accept RequestContext instead of NewContext, maintaining test coverage and behavior while aligning with the refactored type hierarchy.

Also applies to: 62-62, 88-88, 129-130, 177-178, 256-257, 303-304, 348-350

lib/src/router/router_handler_extension.dart (1)

27-27: LGTM! Router handler extension updated correctly.

The call method signature now accepts RequestContext, maintaining consistency with the refactored context types while preserving all pipeline behavior.

example/context/context_property_example.dart (1)

21-21: LGTM! Handler signature updated consistently.

The parameter type change to RequestContext aligns with the repository-wide refactoring, with no changes to the handler's logic or behavior.

example/middleware/cors_example.dart (1)

10-10: LGTM! CORS example updated with new context types.

Both the middleware inner handler and the API handler signatures have been updated to use RequestContext, maintaining all CORS functionality and request handling behavior.

Also applies to: 43-43

test/router/router_inject_test.dart (1)

142-145: RequestContext rename applied correctly.

Signature now matches HandlerObject.call and Handler typedef; return remains ResponseContext (a HandledContext). Looks good. Based on learnings.

example/middleware/pipeline_example.dart (1)

8-9: Consistent RequestContext migration across middleware and handlers.

Types align with Handler(RequestContext) and ResponseContext flow. No behavior changes.

Also applies to: 26-26, 44-48

test/src/middleware/context_property_test.dart (1)

5-8: Factory now returns Context — good alignment.

Using Context for _createContextInstance and locals keeps tests compatible across RequestContext/ResponseContext transitions.

test/util/test_util.dart (1)

15-15: Typedef and handler params migrated to RequestContext — OK.

Types align with Handler(RequestContext); tests remain readable and unchanged in behavior.

Also applies to: 26-37, 42-44

example/middleware/auth_example.dart (1)

8-9: RequestContext migration applied cleanly.

Middleware and handlers now match the updated public API.

Also applies to: 25-27, 30-32

test/src/adapter/context_test.dart (1)

7-13: Tests reflect renamed context types and transitions.

Assertions cover RequestContext → ResponseContext/HijackedContext/ConnectionContext and token preservation. Looks solid.

Also applies to: 26-28, 57-63, 65-71, 76-79, 97-101

lib/src/handler/handler.dart (2)

62-62: Core Handler typedef switched to RequestContext — good.

Public API shift is consistent with downstream examples/tests; variance with ResponseContext <: HandledContext remains sound. Based on learnings.


145-149: No changes needed—RelicRouter type aliasing is correctly implemented.

RelicRouter is defined as typedef RelicRouter = Router<Handler>;, making it semantically identical to Router<Handler> at compile time. HandlerObject.injectIn correctly uses final RelicRouter router, and the type alias ensures that @override checks pass under dart analyze --fatal-infos without any compatibility issues. The code is already correct.

example/middleware/middleware_example.dart (1)

10-10: LGTM! Context type updates are consistent.

All middleware and handler signatures correctly updated from NewContext to RequestContext. The changes are pure renames with no behavioral modifications.

Also applies to: 30-30, 46-46, 61-61, 67-67

example/context/context_example.dart (1)

9-12: LGTM! Comprehensive context renaming applied correctly.

All documentation, HTML content, and handler signatures consistently updated to reflect the new context naming:

  • RequestContext for initial request state
  • ConnectionContext for WebSocket connections
  • HijackedContext for raw connection control

Also applies to: 27-28, 36-118

lib/src/middleware/context_property.dart (1)

3-7: LGTM! API correctly broadened to accept base Context type.

The update from RequestContext to Context is appropriate since Context is now the sealed base class containing the token property. This allows ContextProperty to work with all context types (RequestContext, ResponseContext, HijackedContext, ConnectionContext) while maintaining type safety.

Also applies to: 45-82

example/basic/body_example.dart (2)

53-53: LGTM! Lambda parameter simplification aligns with PR objectives.

Removal of unused final modifiers in lambda parameters is a style cleanup explicitly mentioned in the PR description.

Also applies to: 62-62


83-189: LGTM! All handler signatures consistently updated.

All handler entry points correctly updated from NewContext to RequestContext with no behavioral changes.

lib/src/io/static/static_handler.dart (1)

35-35: LGTM! Static handler signatures consistently updated.

The CacheControlFactory typedef and all internal method signatures correctly updated from NewContext to RequestContext. No behavioral changes introduced.

Also applies to: 129-428

lib/src/adapter/context.dart (1)

1-200: Refactor verification complete — all context names properly updated.

Verification results confirm:

  • ✅ No references to old context names (NewContext, HijackContext, ConnectContext)
  • ✅ New context names consistently used throughout: RequestContext in tests/examples/handlers, HijackedContext in relic_server.dart/middleware_logger.dart/handler.dart, ConnectionContext similarly deployed
  • ✅ Public API correctly exports all context types via lib/relic.dart with RequestInternal appropriately hidden
  • ✅ Pattern matching on sealed contexts in lib/src/relic_server.dart and lib/src/middleware/middleware_logger.dart demonstrates correct sealed class exhaustiveness checking
  • ✅ Tests verify state transitions work properly (RequestContext → ResponseContext/HijackedContext/ConnectionContext)
  • ✅ Examples demonstrate correct usage patterns

The context hierarchy refactor is complete and production-ready.

@nielsenko nielsenko self-assigned this Oct 29, 2025
@nielsenko nielsenko marked this pull request as ready for review October 29, 2025 06:48
@nielsenko nielsenko requested review from a team and SandPod October 29, 2025 06:48
Copy link
Contributor

@SandPod SandPod left a comment

Choose a reason for hiding this comment

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

Question regarding version support in Serverpod.

Copy link
Contributor

@SandPod SandPod left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@nielsenko nielsenko merged commit d8e15f7 into serverpod:main Oct 29, 2025
49 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find a better name for NewContext

2 participants