DFE-Digital / DFE-Digital/check-performance-data
[Tech debt] Infrastructure references Persistence, breaking the layer rule
@davidgouge is already working on this.
Since Sep 8, 2026.
- Dominant language
- C#
- Stars
- 0
- Forks
- 1
- Avg merge
- 19h 21m
- Merged PRs (30d)
- 54
Description
Overview
CLAUDE.md states that Infrastructure and Persistence are siblings, both depending only on Application and Domain. In fact DfE.CheckPerformanceData.Infrastructure.csproj declares a ProjectReference to Persistence, and exactly one file uses it.
One class is holding open a permanent, invisible licence for every future Infrastructure class to reach into the database directly, bypassing Application entirely.
Evidence
src/DfE.CheckPerformanceData.Infrastructure/Queue/PostgresQueueService.cs:6-7 — the only two using DfE.CheckPerformanceData.Persistence.* lines in the whole project:
using DfE.CheckPerformanceData.Persistence.Contexts; // IPortalDbContext
using DfE.CheckPerformanceData.Persistence.Entities; // QueueMessageEntity
Proposed fix
Move PostgresQueueService into the Persistence project — it is a database-backed queue implementation of an Application interface, so Persistence is where it belongs by the same rule that puts repositories there. Move its DI registration from the Infrastructure DependencyManager to the Persistence one, then delete the ProjectReference from Infrastructure.csproj.
Acceptance criteria
-
PostgresQueueServicelives in Persistence and is registered byPersistence/DependencyManager.cs. -
Infrastructure.csprojno longer references Persistence. - The corresponding architecture test from the fitness-test ticket is unskipped and passing.
- Existing queue tests still pass with no behavioural change.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.