Skip to content

Apportionment structs/functions/tests#2787

Merged
Lionqueen94 merged 26 commits intomainfrom
2767-bring-back-apportionment-functions-and-tests
Feb 6, 2026
Merged

Apportionment structs/functions/tests#2787
Lionqueen94 merged 26 commits intomainfrom
2767-bring-back-apportionment-functions-and-tests

Conversation

@stacktraceghost
Copy link
Contributor

@stacktraceghost stacktraceghost commented Jan 27, 2026

Resolves #2766
Resolves #2767

Changes:

  • Brought back apportionment code

  • Adjusted structs

    • As minimal as possible, not linked to Abacus
    • Implemented traits
  • Reorganized code

    • Structure: split seat assignment and candidate nomination into folders
    • Renamed PoliticalGroup to List
    • Extracted DisplayFraction to Abacus domain layer
  • Updated links to law articles

  • Added newtypes

  • Added apportionment crate to sigrid.yaml

  • Moved backend/src/apportionment/*, frontend and other backend changes to separate branch (bring_back_apportionment_api) for future epic.

Not in scope: #2785

@github-actions
Copy link

github-actions bot commented Jan 27, 2026

Sigrid maintainability feedback

⏸️️ Your are still below 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 0 refactoring candidates.

👎 What could be better?

Unfortunately, 24 refactoring candidates were introduced or got worse.

Risk System property Location
🔴 Duplication
(Introduced)
backend/src/domain/id.rs line 36-46
backend/apportionment/src/int_newtype_macro.rs line 12-22
🔴 Duplication
(Introduced)
backend/apportionment/src/seat_assignment/residual_seat_assignment.rs line 125-130
backend/apportionment/src/seat_assignment/mod.rs line 132-137
🔴 Duplication
(Introduced)
backend/apportionment/src/seat_assignment/residual_seat_assignment.rs line 108-113
backend/apportionment/src/seat_assignment/residual_seat_assignment.rs line 212-217
🔴 Unit Size
(Introduced)
backend/apportionment/src/seat_assignment/mod.rs
seat_assignment(T)
🔴 Unit Interfacing
(Introduced)
backend/apportionment/src/seat_assignment/residual_seat_assignment.rs
assign_remainder([ListStanding],u32,u32,u32,[SeatChangeStep],Option,any)
🟠 Unit Size
(Introduced)
backend/apportionment/src/seat_assignment/residual_seat_assignment.rs
assign_remainder([ListStanding],u32,u32,u32,[SeatChangeStep],Option,any)
🟠 Unit Size
(Introduced)
backend/apportionment/src/seat_assignment/residual_seat_assignment.rs
step_assign_remainder_using_largest_remainder([ListStanding],u32,[SeatChangeStep],[ListNumber])
🟠 Unit Size
(Introduced)
backend/apportionment/src/seat_assignment/mod.rs
reassign_residual_seat_for_absolute_majority(u32,u32,[T],[ListNumber],Vec<ListStanding>)
⚫️ + 16 more

📚 Remaining technical debt

0 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.6 5.5 4.5
Unit Size 2.2 5.5 2.5
Unit Complexity 3.2 5.5 3.9
Unit Interfacing 3.0 5.5 1.2
Module Coupling 3.4 N/A 3.0
Component Independence 2.0 N/A N/A
Component Entanglement 2.4 N/A N/A
Maintainability 2.9 5.5 3.2

💬 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 Jan 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.37%. Comparing base (1e34853) to head (692d289).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2787      +/-   ##
==========================================
- Coverage   91.38%   91.37%   -0.01%     
==========================================
  Files         380      380              
  Lines       17661    17661              
  Branches     1987     1987              
==========================================
- Hits        16139    16138       -1     
  Misses       1424     1424              
- Partials       98       99       +1     

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

@Lionqueen94
Copy link
Contributor

@praseodym Should we already add the apportionment crate to sigrid.yml in this PR?

@praseodym
Copy link
Contributor

@praseodym Should we already add the apportionment crate to sigrid.yml in this PR?

Yes!

@Lionqueen94 Lionqueen94 force-pushed the 2767-bring-back-apportionment-functions-and-tests branch from b7bd452 to 2bcdcff Compare February 5, 2026 11:34
@Lionqueen94 Lionqueen94 force-pushed the 2767-bring-back-apportionment-functions-and-tests branch from f5370eb to e1df116 Compare February 5, 2026 23:43
@Lionqueen94 Lionqueen94 requested a review from praseodym February 5, 2026 23:46
@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 dismissed rnijveld’s stale review February 6, 2026 10:57

Ruben will do an extra check and make improvements next week

@Lionqueen94 Lionqueen94 added this pull request to the merge queue Feb 6, 2026
Merged via the queue into main with commit df673ad Feb 6, 2026
19 of 20 checks passed
@Lionqueen94 Lionqueen94 deleted the 2767-bring-back-apportionment-functions-and-tests branch February 6, 2026 11:15
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.

Bring back apportionment functions and tests Add traits and structs with only what's needed for apportionment

5 participants