Skip to content

Backend layer domain should not use other layers#2864

Merged
Lionqueen94 merged 4 commits intomainfrom
change-committee-session-status
Feb 5, 2026
Merged

Backend layer domain should not use other layers#2864
Lionqueen94 merged 4 commits intomainfrom
change-committee-session-status

Conversation

@oliver3
Copy link
Contributor

@oliver3 oliver3 commented Feb 5, 2026

Move non-domain usages out of domain::committee_session_status and domain::file, in separate commits:

  • Separate change_committee_session_status() into new layer service because it is more orchestration than domain logic, including audit logging.
  • Move file::create_file() to its only usage, and inline file::delete_file() into delete_committee_session_files()
  • Move CommitteeSessionError out of api into domain, so that it can be used there and add a ProviderError variant

Questions:

  • Are services a new layer or should it somehow live under the api layer?

@oliver3 oliver3 self-assigned this Feb 5, 2026
@oliver3 oliver3 requested a review from a team as a code owner February 5, 2026 15:46
@oliver3 oliver3 added the backend Issues or pull requests that relate to the backend label Feb 5, 2026
@oliver3 oliver3 moved this from Options to In Progress in Abacus Development Feb 5, 2026
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

Sigrid maintainability feedback

↗️ You improved your code towards your objective of 3.5 stars.

Show details

Sigrid compared your code against the baseline of 2026-02-05.

👍 What went well?

You fixed or improved 41 refactoring candidates.

Risk System property Location
🔴 Duplication
(Fixed)
backend/src/api/report.rs line 543-559
backend/src/api/document.rs line 198-214
🔴 Duplication
(Fixed)
backend/src/api/committee_session.rs line 178-189
backend/src/api/election.rs line 185-196
🔴 Duplication
(Fixed)
backend/src/api/data_entry.rs line 426-432
backend/src/api/data_entry.rs line 577-583
backend/src/api/data_entry.rs line 549-555
+ 1 occurrences
🔴 Duplication
(Fixed)
backend/src/api/polling_station.rs line 338-346
backend/src/api/polling_station.rs line 417-425
🔴 Duplication
(Fixed)
backend/src/api/investigation.rs line 115-121
backend/src/api/polling_station.rs line 262-268
🔴 Duplication
(Fixed)
backend/src/api/investigation.rs line 396-402
backend/src/api/polling_station.rs line 290-296
backend/src/api/investigation.rs line 328-334
🔴 Duplication
(Fixed)
backend/src/domain/committee_session_status.rs line 163-170
backend/src/domain/committee_session_status.rs line 188-195
🔴 Duplication
(Fixed)
backend/src/api/election.rs line 102-109
backend/src/api/data_entry.rs line 1007-1014
⚫️ + 33 more

👎 What could be better?

Unfortunately, 43 refactoring candidates were introduced or got worse.

Risk System property Location
🔴 Duplication
(Introduced)
backend/src/api/polling_station.rs line 143-160
backend/src/api/investigation.rs line 153-170
🔴 Duplication
(Introduced)
backend/src/api/report.rs line 489-505
backend/src/api/document.rs line 39-55
backend/src/api/document.rs line 118-134
🔴 Duplication
(Introduced)
backend/src/api/report.rs line 560-576
backend/src/api/document.rs line 198-214
🔴 Duplication
(Introduced)
backend/src/api/investigation.rs line 427-442
backend/src/api/report.rs line 560-575
backend/src/api/document.rs line 198-213
🔴 Duplication
(Introduced)
backend/src/api/data_entry.rs line 817-831
backend/src/api/data_entry.rs line 941-955
🔴 Duplication
(Introduced)
backend/src/api/data_entry.rs line 382-393
backend/src/api/data_entry.rs line 519-530
🔴 Duplication
(Introduced)
backend/src/api/data_entry.rs line 424-436
backend/src/api/data_entry.rs line 575-591
🔴 Duplication
(Introduced)
backend/src/api/polling_station.rs line 318-333
backend/src/api/investigation.rs line 409-424
⚫️ + 35 more

📚 Remaining technical debt

83 refactoring candidates didn't get better or worse, but are still present in the code you touched.

View this system in Sigrid to explore your technical debt

⭐️ Sigrid ratings

System property System on 2026-02-05 Before changes New/changed code
Volume 3.4 N/A N/A
Duplication 3.7 3.1 3.1
Unit Size 2.2 1.7 1.7
Unit Complexity 3.2 4.2 4.2
Unit Interfacing 3.0 0.6 0.7
Module Coupling 3.4 3.9 4.6
Component Independence 2.0 N/A N/A
Component Entanglement 2.4 N/A N/A
Maintainability 2.9 3.1 3.3

💬 Did you find this feedback helpful?

We would like to know your thoughts to make Sigrid better.
Your username will remain confidential throughout the process.


View this system in Sigrid

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 93.80531% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.37%. Comparing base (ee1c92c) to head (9a32251).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
backend/src/error.rs 42.85% 4 Missing ⚠️
...end/src/service/change_committee_session_status.rs 96.38% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2864   +/-   ##
=======================================
  Coverage   91.37%   91.37%           
=======================================
  Files         379      380    +1     
  Lines       17639    17654   +15     
  Branches     1987     1987           
=======================================
+ Hits        16117    16131   +14     
- Misses       1424     1425    +1     
  Partials       98       98           

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

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

PDF Diff Summary

Comparing against base branch: main

File Status
model-n-10-2.pdf ✅ No changes
model-na-14-2-bijlage1.pdf ✅ No changes
model-na-14-2.pdf ✅ No changes
model-na-31-2-bijlage1.pdf ✅ No changes
model-na-31-2-inlegvel.pdf ✅ No changes
model-na-31-2.pdf ✅ No changes
model-p-2a.pdf ✅ No changes

@Lionqueen94 Lionqueen94 added this pull request to the merge queue Feb 5, 2026
Merged via the queue into main with commit 8b2d991 Feb 5, 2026
20 checks passed
@Lionqueen94 Lionqueen94 deleted the change-committee-session-status branch February 5, 2026 20:34
@github-project-automation github-project-automation bot moved this from In Progress to Done in Abacus Development Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Issues or pull requests that relate to the backend

Projects

Development

Successfully merging this pull request may close these issues.

3 participants