Skip to content

refactor: Extract shared base classes to eliminate duplication#50

Merged
barneyjackson merged 1 commit into
mainfrom
refactor-base
May 22, 2026
Merged

refactor: Extract shared base classes to eliminate duplication#50
barneyjackson merged 1 commit into
mainfrom
refactor-base

Conversation

@barneyjackson

Copy link
Copy Markdown
Contributor
  • Add _EntityBase with shared id, created_at, eq, hash for Entity and ImmutableEntity
  • Add _RepositoryBase with shared session, create, ID extraction, and pagination methods
  • BaseRepository and ImmutableBaseRepository become thin subclasses with only their specific behaviour
  • Zero breaking changes: all public class names, signatures, and imports unchanged

…ation

- Add _EntityBase with shared id, created_at, __eq__, __hash__ for Entity and ImmutableEntity
- Add _RepositoryBase with shared session, create, ID extraction, and pagination methods
- BaseRepository and ImmutableBaseRepository become thin subclasses with only their specific behaviour
- Zero breaking changes: all public class names, signatures, and imports unchanged
@github-actions

Copy link
Copy Markdown
Contributor
Name Stmts Miss Cover
src/leadr/infra/webhooks/services/dependencies.py 7 7 0%
src/leadr/auth/services/nonce_tasks.py 20 7 65%
src/leadr/infra/email/__init__.py 15 5 67%
src/leadr/accounts/services/repositories.py 73 15 79%
src/leadr/registration/services/dependencies.py 25 5 80%
src/leadr/accounts/domain/account.py 42 7 83%
src/leadr/infra/cache/services/dependencies.py 7 1 86%
src/leadr/registration/services/repositories.py 117 16 86%
src/leadr/common/domain/cursor.py 71 9 87%
src/leadr/accounts/api/account_routes.py 60 7 88%
src/leadr/auth/api/identity_session_routes.py 35 4 89%
src/leadr/auth/services/repositories.py 198 22 89%
src/leadr/infra/email/adapters/repositories.py 36 4 89%
src/leadr/infra/email/adapters/smtp.py 36 4 89%
src/leadr/auth/api/device_routes.py 47 5 89%
src/leadr/scores/services/score_service.py 180 19 89%
src/leadr/games/services/repositories.py 38 4 89%
src/leadr/common/repositories.py 193 19 90%
src/leadr/accounts/api/user_routes.py 51 5 90%
src/leadr/scores/api/score_routes.py 139 13 91%
src/leadr/boards/services/board_tasks.py 78 7 91%
src/leadr/scores/api/score_event_routes.py 56 5 91%
src/leadr/auth/api/identity_routes.py 46 4 91%
src/api/routes.py 25 2 92%
src/leadr/games/api/game_routes.py 64 5 92%
src/leadr/common/utils/ip.py 13 1 92%
src/leadr/boards/api/board_state_routes.py 27 2 93%
src/leadr/boards/api/board_template_routes.py 54 4 93%
src/leadr/boards/api/run_entry_routes.py 27 2 93%
src/leadr/accounts/domain/user.py 42 3 93%
src/leadr/common/geoip.py 141 10 93%
src/leadr/auth/bootstrap.py 29 2 93%
src/leadr/boards/services/repositories.py 558 37 93%
src/leadr/boards/services/board_state_service.py 106 7 93%
src/leadr/common/domain/ids.py 93 6 94%
src/leadr/scores/api/score_schemas.py 94 6 94%
src/leadr/scores/api/score_submission_meta_routes.py 32 2 94%
src/leadr/scores/services/score_submission_meta_service.py 16 1 94%
src/leadr/boards/services/run_entry_service.py 38 2 95%
src/leadr/scores/api/score_flag_routes.py 66 3 95%
src/leadr/common/api/hooks.py 67 3 96%
src/leadr/auth/api/api_key_routes.py 47 2 96%
src/leadr/boards/domain/board.py 71 3 96%
src/leadr/boards/api/board_routes.py 123 4 97%
src/leadr/infra/webhooks/services/repository.py 31 1 97%
src/leadr/auth/services/nonce_service.py 34 1 97%
src/leadr/logging.py 69 2 97%
src/leadr/games/services/game_service.py 39 1 97%
src/leadr/registration/api/schemas.py 82 2 98%
src/leadr/registration/api/routes.py 83 2 98%
src/leadr/common/services.py 42 1 98%
src/leadr/accounts/services/account_service.py 45 1 98%
src/leadr/auth/services/api_key_service.py 100 2 98%
src/leadr/auth/services/device_service.py 52 1 98%
src/leadr/boards/services/board_service.py 68 1 99%
src/leadr/boards/domain/board_template.py 72 1 99%
src/leadr/infra/email/service.py 81 1 99%
src/leadr/registration/services/verification_service.py 90 1 99%
src/leadr/config.py 107 1 99%
src/leadr/scores/services/score_flag_service.py 173 1 99%
src/leadr/auth/dependencies.py 174 1 99%
TOTAL 7885 322 96%

137 files skipped due to complete coverage.

@github-actions

Copy link
Copy Markdown
Contributor

🐳 Docker Image Built

The Docker image for this PR has been built and pushed:

ghcr.io/leadr-official/leadr-oss:fd43be7

@barneyjackson barneyjackson merged commit 981095a into main May 22, 2026
4 checks passed
@barneyjackson barneyjackson deleted the refactor-base branch May 22, 2026 11:57
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.

1 participant