Skip to main content

Technical Debt Register

The violations below were confirmed against _documentation/6-Contributing.md as of v2.5.0. Items are tagged as pre-refactor rough edge (already known, tracked) or new finding (identified in the v2.5.0 audit). Every item carries a rule reference so the writer knows what standard it breaks.

Audience

This article is for contributors and reviewers. Operators and plugin authors do not need to read it.

Do not copy any pattern in this list. If you need to work in a listed class, follow the standard patterns for your new code even if the surrounding code does not.


HIGH — Active violations in non-deprecated code

These are targeted for the v2.x refactor cycle.

LocationViolationRuleStatus
app/Services/Profile/ProfileService.phpAuth::user(), Auth::logout() facade calls; app(AvatarStorageService::class) helper; Session::put() from a service; ServiceLocatorTrait in a service (not an API Resource)No facades in services; no session/HTTP access; ServiceLocatorTrait reserved for API ResourcesPre-refactor rough edge (explicitly flagged in Coverage Gaps)
app/Services/Profile/PasskeyService.phpAuth::user() facade; PasskeyBackup::where() and PasskeyBackup::updateOrCreate() direct Eloquent statics; Session::get() in a serviceNo facades; no Eloquent statics in services; no session accessPre-refactor rough edge (same Profile domain)
app/Services/Chat/AiConv/AiConvService.phpAuth::id() / Auth::user() facade; AiConv::create(), AiConv::where() direct Eloquent statics; Log::error() facade for loggingNo facades; no Eloquent statics; no Log:: facade (inject LoggerInterface)New finding
app/Services/Chat/Room/Traits/RoomFunctions.php, RoomMembers.php, RoomMessages.phpTrait-based service decomposition (the // ❌ Bad anti-pattern); Auth::id(), Auth::user(), Log::error(), app(AvatarStorageService::class) inside those traitsNo trait splitting of services; no facades in servicesTrait split: pre-refactor rough edge (flagged in Chat section). Facade/app() inside traits: new finding
app/Services/Announcements/AnnouncementService.phpAuth::user() facade; Session::put() in a service; now() direct time constructionNo facades; no session access; never use now() in servicesNew finding

MEDIUM — Violations in deprecated or self-acknowledged code

Mostly scheduled replacements or code with explicit self-deprecating comments. Lower urgency but still violations of documented standards.

LocationViolationRuleStatus
app/Services/Chat/Message/Handlers/GroupMessageHandler.php, PrivateMessageHandler.phpAuth::id() / Auth::user() facade calls inside message handler servicesNo facades in servicesNew finding
app/Services/Ai/UsageAnalyzerService.phpAuth::user() facade; multiple Carbon::now() calls; UsageRecord::selectRaw(), UsageRecord::whereMonth() direct Eloquent staticsNo facades; never use Carbon::now(); no Eloquent statics@deprecated class, scheduled for replacement. Violations are partly why it is deprecated
app/Models/Room.phpapp(UserKeychainRepository::class), app(GroupMessageHandler::class), app(AvatarStorageService::class) inside model methods; business logic (addMember, removeMember, deleteRoom) in the modelNo app() in models; no business logic in modelsSelf-acknowledged — the file has a "Please don't do it like this" comment at the offending lines
app/Models/User.phpnow() called directly inside model methodsNever use now() in services / value objects (models cannot use constructor injection, making this irresolvable without restructuring)Known structural limitation
app/Http/Controllers/RoomController.phpUser::find(1) direct Eloquent static; authorization + business logic inline in two methods (getAttachmentUrl, deleteAttachment); Auth::id() / Auth::user() facadeControllers call one service method; no direct DB accessNew finding
app/Http/Controllers/StreamController.phpInline validation (not delegated to FormRequest); 130-line handleGroupChatRequest private method mixing domain logic, encryption, model queries, and broadcasting; Room::where() direct Eloquent staticDelegate validation to FormRequest; no business logic in controllersNew finding

LOW — Minor style and type issues

Style/type cleanup with no correctness impact.

LocationViolationRuleStatus
app/Services/Chat/AiConv/AiConvService.php, app/Services/Chat/Room/Traits/RoomFunctions.phpLog::error() facade instead of injected Psr\Log\LoggerInterfaceNo facades in services; inject LoggerInterface via constructorNew finding
app/Services/Mail/MailService.phpsendWelcomeEmail($user) missing parameter type and return typeAlways declare parameter and return typesNew finding