Skip to content

Conversation

@JacobCoffee
Copy link
Owner

Summary

This PR completes Phase 1.1 of the microservices migration, extracting the web/API service from the monolith into a dedicated services/api package.

Changes

Service Structure

  • ✅ Created services/api/ directory with src/byte_api/ package structure
  • ✅ Moved all code from byte_bot/server/ to services/api/src/byte_api/
  • ✅ Updated 46 import statements from byte_bot.server to byte_api
  • ✅ Created services/api/pyproject.toml with proper dependencies and workspace configuration
  • ✅ Created production Dockerfile for API service deployment

Dependencies & Configuration

  • ✅ Updated workspace configuration to include services/api
  • ✅ Configured shared byte-common package as workspace dependency
  • ✅ Updated models to use byte_common.models instead of local definitions
  • ✅ Fixed circular import in settings.py (removed byte_bot.__metadata__ dependency)
  • ✅ Added ruff per-file ignore rules for API service

File Summary

  • 78 files changed, 13,033 insertions, 29 deletions
  • Created complete API service package structure
  • All database migrations copied to new service
  • All web templates and static resources migrated
  • All domain logic and controllers migrated

Testing Notes

⚠️ Full runtime testing is blocked until Phase 1.4 (removal of old structure) due to:

  1. SQLAlchemy MetaData conflicts between old and new model definitions
  2. Litestar CLI auto-discovering entry points from both monolith and new service

What was tested:

  • ✅ Python syntax validation (AST parsing)
  • ✅ TOML configuration validation
  • ✅ All pre-commit hooks passing (ruff, ty, codespell, prettier, etc.)
  • ✅ Workspace dependency resolution with uv sync

Full testing will be possible after:

  • Phase 1.2: Bot service extraction
  • Phase 1.3: Database migration updates
  • Phase 1.4: Old structure removal

Related

Test Plan

  • Pre-commit hooks pass
  • Python syntax is valid
  • pyproject.toml is valid TOML
  • Workspace dependency resolution works
  • Ruff linting passes with appropriate ignores
  • Type checking passes
  • Runtime testing (blocked until Phase 1.4)

🤖 Generated with Claude Code

This commit extracts the web/API service from the monolith into a dedicated
services/api package as part of the microservices migration.

Changes:
- Created services/api/ directory structure with src/byte_api/
- Moved byte_bot/server/ code to services/api/src/byte_api/
- Updated all imports from byte_bot.server to byte_api
- Updated models to use byte_common shared package
- Created services/api/pyproject.toml with dependencies
- Created production Dockerfile for API service
- Updated workspace configuration to include services/api
- Fixed circular import in settings.py (removed byte_bot.__metadata__)
- Added ruff per-file ignores for API service

Note: Full runtime testing blocked until Phase 1.4 (old structure removal)
due to SQLAlchemy MetaData conflicts and Litestar entry point discovery.

Related to #103

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @JacobCoffee, your pull request is larger than the review limit of 150000 diff characters

@railway-app
Copy link

railway-app bot commented Nov 23, 2025

🚅 Deployed to the byte-pr-107 environment in byte

Service Status Web Updated (UTC)
byte ◻️ Removed (View Logs) Nov 23, 2025 at 12:37 am

@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-107) November 23, 2025 00:31 Destroyed
Update ty type checker configuration to include the new API service path
so it can resolve byte_api imports during type checking.

Fixes CI validation failure in PR #107

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-107) November 23, 2025 00:34 Destroyed
@JacobCoffee JacobCoffee merged commit 85dd63c into main Nov 23, 2025
5 checks passed
@JacobCoffee JacobCoffee deleted the feature/phase1-extract-api-service branch November 23, 2025 00:37
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.

2 participants