Skip to content

Refactor repository and service composition#797

Open
cmyui wants to merge 22 commits into
masterfrom
refactor/usecase-repository-composition
Open

Refactor repository and service composition#797
cmyui wants to merge 22 commits into
masterfrom
refactor/usecase-repository-composition

Conversation

@cmyui

@cmyui cmyui commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary

  • add CODE_STYLE.md documenting the repository/service/composition direction we have been using
  • convert repository modules from module-level database reach-through to injected repository classes
  • move app/usecases to app/services and keep business logic in constructor-injected service classes
  • add FastAPI dependency providers for API routes, with each controller declaring the exact service it needs inline
  • move v1, v2, bancho login, score leaderboard, and score submission route logic behind services while keeping protocol response formatting in controllers
  • split osu-web logic into focused domain services for accounts, beatmap leaderboards, client integrity, comments, direct search, favourites, mail reads, maps/beatmaps, replays, and screenshots
  • delete the old app/services/osu_web.py catch-all service bucket
  • move public v1 API read SQL into repository Core queries and cover those public read query semantics with repository integration tests
  • replace the one-off score submission adapter with explicit composition and a consolidated BanchoAuthenticationService used by login, score submission, and inline osu-web route auth
  • keep legacy packet handlers, commands, and active-record object methods on an explicitly named legacy repository bridge until they can be moved behind dedicated service seams
  • ignore the local-only osuctl stable-client harness directory

Testing

  • uv run mypy app
  • uv run --frozen --env-file .env.test pytest tests/unit (217 passed)
  • make test (240 passed)
  • uv run pre-commit run --all-files
  • GitHub checks passing: build, mypy, run-test-suite, pre-commit.ci, task-list-completed

Manual smoke

  • stable osu! client smoke was used during this PR to verify login, leaderboard fetch, and failed taiko score submission against the local bancho/nginx stack

@cmyui cmyui changed the title Refactor repository and usecase composition Refactor repository and service composition Jun 25, 2026
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