Skip to content

Dev 0.1.12#20

Closed
pdh0128 wants to merge 29 commits intomasterfrom
dev-0.1.12
Closed

Dev 0.1.12#20
pdh0128 wants to merge 29 commits intomasterfrom
dev-0.1.12

Conversation

@pdh0128
Copy link
Member

@pdh0128 pdh0128 commented Mar 6, 2026

  • 프로젝트 리소스 한도 조회 기능 추가
  • GetProjectResourceLimitUseCase 구현
  • 프로젝트 owner 권한 검증 로직 추가
  • 리소스 한도 조회 API 엔드포인트 구현
  • 리소스 한도 응답 스키마 추가
  • GitHub Actions deploy / rollback workflow 추가
  • Dockerfile 추가
  • app_version 기본값을 0.0.1로 설정

Summary by CodeRabbit

  • New Features

    • Added project resource limit retrieval endpoint
    • Added project ownership verification endpoint
  • API Changes

    • Updated base API path from /v1 to /
    • Restructured API response format across endpoints
    • Enhanced error messages for resource operations
  • Infrastructure

    • Added Docker containerization support
    • Configured GitHub Actions deployment workflows for development environments
  • Chores

    • Refactored internal configuration system with enhanced logging

jmj732 and others added 29 commits March 4, 2026 18:06
`GET /projects/resource-limit` 엔드포인트를 추가
@pdh0128 pdh0128 closed this Mar 6, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b6c8b51f-8536-4380-8a79-094d9598cef5

📥 Commits

Reviewing files that changed from the base of the PR and between 4ab883f and c14d87c.

📒 Files selected for processing (39)
  • .github/workflows/deploy-dev.yaml.yml
  • .github/workflows/rollback-dev.yaml.yml
  • Dockerfile
  • docs/api.md
  • main.py
  • src/api/__init__.py
  • src/api/routers/__init__.py
  • src/api/routers/routes/__init__.py
  • src/api/routers/routes/dns.py
  • src/api/routers/routes/ports.py
  • src/api/routers/routes/projects.py
  • src/api/routers/v1/__init__.py
  • src/app/port/exceptions.py
  • src/app/port/usecase/create_port.py
  • src/app/port/usecase/delete_port.py
  • src/app/port/usecase/update_port.py
  • src/app/project/exceptions.py
  • src/app/project/schemas.py
  • src/app/project/usecase/__init__.py
  • src/app/project/usecase/create_project.py
  • src/app/project/usecase/delete_project.py
  • src/app/project/usecase/get_project_resource_limit.py
  • src/app/project/usecase/update_project_resource.py
  • src/common/config/application_server.py
  • src/common/config/resource_server.py
  • src/common/config/settings.py
  • src/common/config/user_server.py
  • src/common/const/__init__.py
  • src/common/const/vault.py
  • src/core/db.py
  • src/core/exceptions.py
  • src/infra/client/asyncio_http.py
  • src/infra/client/project_resource_impl.py
  • src/infra/client/schemas.py
  • tests/test_api_available_endpoint.py
  • tests/test_api_dns_endpoints.py
  • tests/test_api_ports_endpoints.py
  • tests/test_api_projects_endpoints.py
  • tests/test_project_usecases.py

📝 Walkthrough

Walkthrough

This PR implements a significant API restructuring from v1-based routing to root-path routing, introduces a centralized configuration management system with logging, adds error handling for resource server operations, implements project resource limit endpoints, and includes deployment workflow automation via GitHub Actions.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/deploy-dev.yaml.yml, .github/workflows/rollback-dev.yaml.yml
New workflows for automated dev environment deployment and rollback to specified versions, delegating to reusable workflows in the central GitHub Actions repository with secret forwarding.
Containerization
Dockerfile
Python 3.12 Slim-based application container with uvicorn server listening on port 8000, timezone configured to Asia/Seoul, and pip dependencies installed from requirements.txt.
API Documentation
docs/api.md
Comprehensive update of all API endpoint paths from /v1/* to /* structure; adds new endpoints for project ownership checks and resource limits; expands project members, ports, and DNS management documentation with updated request/response examples.
Application Startup & Config Loading
main.py, src/api/__init__.py
Added logging initialization in main.py; modified startup to invoke load_all_configs() before creating database tables to ensure configuration state is initialized first.
Router Refactoring
src/api/routers/__init__.py, src/api/routers/v1/__init__.py, src/api/routers/routes/__init__.py
Removed v1_api_router aggregation; introduced new routes_api_router that consolidates sub-routers (projects, ports, dns) under a new routes module structure, shifting from version-based routing.
Project Endpoints
src/api/routers/routes/projects.py
Updated /available and /owner endpoints to use SuccessResponse wrapper with standardized message/data payload structure; added new /resource-limit endpoint requiring owner verification; changed endpoint parameters to use dependency injection for user context.
Port Exception Handling
src/app/port/exceptions.py, src/app/port/usecase/create_port.py, src/app/port/usecase/delete_port.py, src/app/port/usecase/update_port.py
Introduced three new port exception types (PortCreationFailed, PortDeletionFailed, PortUpdateFailed) with 502 status codes; wrapped resource server calls in each port use-case with exception handling to convert ResourceServerException into domain exceptions.
Project Exception Handling & Schemas
src/app/project/exceptions.py, src/app/project/schemas.py, src/app/project/usecase/create_project.py, src/app/project/usecase/delete_project.py, src/app/project/usecase/update_project_resource.py
Added four new exception types (OnlyOwnerCanGetResourceLimit, ProjectCreationFailed, ProjectDeletionFailed, ProjectResourceUpdateFailed) with appropriate status codes; introduced ProjectResourceLimitResponse schema; wrapped resource server calls with exception handling; replaced hardcoded project limits with ProjectConfig.LIMIT.
Project Resource Limit Use-Case
src/app/project/usecase/get_project_resource_limit.py, src/app/project/usecase/__init__.py
New GetProjectResourceLimitUseCase that fetches and returns project resource constraints (max_cpu, max_memory, max_disk) with owner-only access control; registered in public API exports.
Configuration System Overhaul
src/common/config/settings.py, src/common/config/application_server.py, src/common/config/resource_server.py, src/common/config/user_server.py, src/common/const/vault.py
Introduced LoggedSettings base class with model_post_init logging; created register_config decorator and load_all_configs function for centralized config registration; changed all config classes to inherit from LoggedSettings; replaced hardcoded .env paths with VAULT_ENV_FILE constant that selects between vault and local paths; updated DatabaseConfig.url to use quote_plus for credentials escaping; changed app_version from "v1" to "0.0.1".
Core Exception & Database
src/core/exceptions.py, src/core/db.py
Added ResourceServerException for resource server communication errors; refactored migrations data structure to support multiple SQL statements per migration with sequential execution.
HTTP Client Refactoring
src/infra/client/asyncio_http.py, src/infra/client/project_resource_impl.py, src/infra/client/schemas.py
Added response.read() awaits in HTTP methods to consume response bodies before returning; introduced _request wrapper in ProjectResourceClientImpl to centralize ResourceServerException handling; converted user_id and project id to string types in headers and payloads; changed ExternalProjectCreate.id field from int to str.
Test Updates
tests/test_api_available_endpoint.py, tests/test_api_dns_endpoints.py, tests/test_api_ports_endpoints.py, tests/test_api_projects_endpoints.py, tests/test_project_usecases.py
Updated import paths from v1 routes to routes structure; adapted test assertions for new SuccessResponse wrapper format (message/data structure); added tests for new get_project_resource_limit_endpoint and GetProjectResourceLimitUseCase with owner verification and error handling tests.

Sequence Diagram

sequenceDiagram
    participant App as FastAPI App
    participant Startup as Startup Event
    participant ConfigLoader as load_all_configs()
    participant Registry as Config Registry
    participant AppConfig as AppConfig Getter
    participant DBConfig as DatabaseConfig Getter
    participant DB as Database
    
    App->>Startup: Application starts
    Startup->>ConfigLoader: Call load_all_configs()
    ConfigLoader->>Registry: Iterate registered config getters
    Registry->>AppConfig: Execute get_app_config()
    AppConfig-->>Registry: Load AppConfig (VAULT_ENV_FILE)
    Registry->>DBConfig: Execute get_db_config()
    DBConfig-->>Registry: Load DatabaseConfig (VAULT_ENV_FILE)
    ConfigLoader->>DB: Configs loaded, create_all_tables()
    DB-->>ConfigLoader: Tables created
    ConfigLoader-->>Startup: Config loading complete
    Startup-->>App: App ready to serve requests
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • fix(master): 실수 머지된 PR #17 되돌리기 #18: Removes v1_api_router aggregation from src/api/routers/v1/init.py, directly related to this PR's router refactoring away from v1-based routing.
  • Dev 0.1.1 #17: Introduces v1 router additions and API router wiring changes that overlap with this PR's router restructuring and configuration system modifications.

Poem

🐰 Routes take flight from v1 to root,
Config logs grow from a sturdy shoot!
Port guards catch when servers misbehave,
Resource limits for projects so brave! 🌿✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev-0.1.12

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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