Skip to content

Comments

Refactor: Replace RoomAuthService with Laravel Context#2812

Merged
samuelwei merged 3 commits intodevelopfrom
copilot/refactor-room-auth-service
Feb 17, 2026
Merged

Refactor: Replace RoomAuthService with Laravel Context#2812
samuelwei merged 3 commits intodevelopfrom
copilot/refactor-room-auth-service

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Closes #2811

Type

  • Bugfix
  • Feature
  • Documentation
  • Refactoring (e.g. Style updates, Test implementation, etc.)
  • Other (please describe):

Checklist

  • Code updated to current develop branch head
  • Passes CI checks
  • Is a part of an issue
  • Tests added for the bugfix or newly implemented feature, describe below why if not
  • Changelog is updated
  • Documentation of code and features exists

Changes

  • Replaced custom RoomAuthService singleton with Laravel 12's native Context feature
  • Used Context::addHidden() for storing room authentication state and tokens (excluded from logs per security requirement)
  • Updated middleware, form requests, services, resources, and models to retrieve data via Context::getHidden()
  • Removed service registration from AppServiceProvider
  • Deleted app/Services/RoomAuthService.php (99 LOC removed)
  • Updated unit tests to use Context API

Before:

$roomAuthService->setAuthenticated($room, $authenticated);
$token = $roomAuthService->getRoomToken($room);

After:

Context::addHidden("room.{$room->id}.authenticated", $authenticated);
$token = Context::getHidden("room.{$room->id}.token");

Other information

Net reduction of 131 lines. Context keys use pattern room.{room_id}.{attribute} for per-room scoping.

Uses Context::getHidden() method to properly retrieve values stored with Context::addHidden(), ensuring hidden context values remain excluded from logs while maintaining proper API usage.

Original prompt

This section details on the original issue you should resolve

<issue_title>Refactoring</issue_title>
<issue_description>We have RoomAuthService as a helper to store data for the duration of a request. Data is set in the middleware and can be accessed by other components later during the request. Laravel added the same feature but more generic called Context

We should refactor our codebase to remove the custom solution and use Context. We can think about hiding it from the logs using Hidden Context</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Refactor RoomAuthService to use Laravel Context Refactor: Replace RoomAuthService with Laravel Context Feb 11, 2026
Copilot AI requested a review from samuelwei February 11, 2026 09:38
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.76%. Comparing base (c62619d) to head (b3090ca).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #2812      +/-   ##
=============================================
- Coverage      96.77%   96.76%   -0.02%     
+ Complexity      1851     1839      -12     
=============================================
  Files            445      444       -1     
  Lines          12601    12570      -31     
  Branches        2063     2063              
=============================================
- Hits           12195    12163      -32     
- Misses           406      407       +1     

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

@cypress
Copy link

cypress bot commented Feb 11, 2026

PILOS    Run #2825

Run Properties:  status check passed Passed #2825  •  git commit b3090ca6cc: Refactor: Replace RoomAuthService with Laravel Context
Project PILOS
Branch Review copilot/refactor-room-auth-service
Run status status check passed Passed #2825
Run duration 07m 27s
Commit git commit b3090ca6cc: Refactor: Replace RoomAuthService with Laravel Context
Committer Copilot
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 613
View all changes introduced in this branch ↗︎

@samuelwei samuelwei force-pushed the copilot/refactor-room-auth-service branch from c3c811f to 3eaaf17 Compare February 17, 2026 14:05
@samuelwei samuelwei marked this pull request as ready for review February 17, 2026 14:05
Copilot AI and others added 3 commits February 17, 2026 17:35
Co-authored-by: samuelwei <4281791+samuelwei@users.noreply.github.com>

# Conflicts:
#	app/Http/Controllers/api/v1/RoomController.php
#	app/Http/Middleware/RoomAuthenticate.php
#	app/Http/Requests/JoinMeeting.php
#	app/Http/Requests/StartMeeting.php
#	app/Http/Resources/Room.php
#	app/Models/Room.php
#	app/Services/MeetingService.php
#	app/Services/RoomAuthService.php
#	tests/Backend/Unit/MeetingTest.php

# Conflicts:
#	app/Http/Resources/Room.php
#	tests/Backend/Unit/MeetingTest.php
@samuelwei samuelwei force-pushed the copilot/refactor-room-auth-service branch from fd7123c to b3090ca Compare February 17, 2026 16:37
@samuelwei samuelwei merged commit 9258b55 into develop Feb 17, 2026
20 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.

Refactoring RoomAuthService

2 participants