Skip to content

Clarify backend architecture boundaries#685

Closed
therobbiedavis wants to merge 7 commits into
canaryfrom
677-architecture-boundaries
Closed

Clarify backend architecture boundaries#685
therobbiedavis wants to merge 7 commits into
canaryfrom
677-architecture-boundaries

Conversation

@therobbiedavis

@therobbiedavis therobbiedavis commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR cleans up the backend architecture boundary work from the #677 subtask. The main goal is to make the application layer describe app behavior and contracts, while infrastructure owns framework-specific and adapter-specific details like EF/SQLite, HTML parsing, image probing, audio tag writing, Data Protection, request context access, and SignalR/realtime wiring.

Changes

Added

  • Application-owned ports for infrastructure concerns, including HTML extraction, Audible author-page parsing, cover image probing, audio tag writing, secret protection, request context access, realtime broadcasting, and realtime client inspection.
  • Infrastructure implementations for those ports using the existing concrete libraries and framework features.
  • Infrastructure endpoint/logging extensions that keep concrete realtime hub mapping and log hub initialization out of Program.cs.
  • Backend architecture documentation describing the intended layer responsibilities and dependency direction.
  • AI/contributor guidance reminding agents to review repo docs before making changes.

Changed

  • Moved infrastructure-shaped behavior out of listenarr.application and behind application interfaces.
  • Kept realtime transport details in infrastructure while Program.cs calls named infrastructure composition helpers.
  • Centralized several commonly used backend usings and removed unnecessary per-file directives.
  • Updated tests to use the new application ports instead of reaching through infrastructure details.
  • Cleaned wording so comments/logs describe realtime behavior without leaking hub implementation names outside the infrastructure setup layer.

Fixed

  • Removed package references from listenarr.application that belonged to infrastructure concerns.
  • Fixed startup lifetime/DI issues uncovered while moving these boundaries.
  • Preserved existing realtime event behavior while making the hub target explicit through the application abstraction.
  • Stopped request context snapshots from trusting raw X-Forwarded-Host / X-Forwarded-Proto headers, so outbound notification URLs only use values normalized by ASP.NET Core forwarded-header middleware.

Testing

  • dotnet build listenarr.slnx --no-restore
  • dotnet test listenarr.slnx --no-build — 696 passed
  • Push hook also ran backend format, frontend type check, and frontend tests — 378 passed
  • Verified API no longer references concrete SignalR hub/log sink types directly
  • Verified API controllers no longer reference Listenarr.Infrastructure.*

Notes

This is intentionally still a backend architecture cleanup, not a feature change. Program.cs remains the composition root, but the concrete realtime hub mapping and log sink initialization now live behind infrastructure-owned extension methods.

@therobbiedavis therobbiedavis requested a review from a team June 12, 2026 01:27
@therobbiedavis therobbiedavis added the patch patch version bump - backward compatible bug fixes label Jun 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: debb95bc0a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread listenarr.infrastructure/Web/AspNetRequestContextAccessor.cs Outdated
@therobbiedavis

Copy link
Copy Markdown
Collaborator Author

Closing this in favor of the combined foundation PR: #686. The architecture boundary changes from this PR are included there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch patch version bump - backward compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant