Skip to content

Conversation

@Zerohertz
Copy link
Owner

What type of PR is this?

  • feat
  • fix
  • refactor
  • test
  • infra
  • ci/cd
  • docs
  • chore

What this PR does / why we need it

@codecov
Copy link

codecov bot commented Feb 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.30%. Comparing base (d675e51) to head (d69bf24).
Report is 5 commits behind head on main.

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main      #43   +/-   ##
=======================================
  Coverage   82.30%   82.30%           
=======================================
  Files          42       42           
  Lines        1430     1430           
  Branches       87       87           
=======================================
  Hits         1177     1177           
  Misses        227      227           
  Partials       26       26           
Flag Coverage Δ
mysql 82.02% <100.00%> (ø)
postgresql 81.88% <100.00%> (ø)
sqlite 81.81% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
api/v1 97.08% <ø> (ø)
core 86.02% <100.00%> (ø)
exceptions 95.52% <ø> (ø)
models 100.00% <ø> (ø)
repositories 71.20% <ø> (ø)
schemas 100.00% <ø> (ø)
services 49.51% <ø> (ø)
utils 85.52% <ø> (ø)
Files with missing lines Coverage Δ
app/core/configs.py 92.30% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d675e51...d69bf24. Read the comment docs.

@Zerohertz Zerohertz merged commit ca43d72 into main Feb 13, 2025
27 of 29 checks passed
@Zerohertz
Copy link
Owner Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces Alembic for database migrations, which is a great step towards improving the project's maintainability and scalability. The changes are well-structured, but there are a few areas that could be improved for better clarity and robustness.

Summary of Findings

  • Environment variable usage in Makefile: The Makefile uses environment variables in a way that might not be consistent across different systems. It's better to explicitly define the environment variables within the Makefile or ensure they are consistently set in the environment.
  • Missing ENV variable in k8s configmaps: The removal of the ENV variable from the k8s configmaps could lead to inconsistencies between the application's environment and the configuration. It's important to ensure that the application is aware of its environment (dev, prod, etc.).
  • Hardcoded environment in k8s deployment: The ENV variable is hardcoded to PROD in the k8s deployment. This might not be desirable in all cases, especially for development or testing environments. It's better to make this configurable.

Merge Readiness

The pull request introduces a significant feature (Alembic migrations) and is generally well-implemented. However, the issues identified regarding environment variable handling in the Makefile and k8s configurations should be addressed before merging. I am unable to approve this pull request, and recommend that another reviewer also reviews this code before merging. Addressing the high severity issues is highly recommended before merging.

Comment on lines +19 to +20
- name: ENV
value: "PROD"

Choose a reason for hiding this comment

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

high

Hardcoding the ENV variable to PROD might not be suitable for all deployments (e.g., development, staging). Consider making this configurable via a parameter or a separate config file.

            - name: ENV
              valueFrom:
                configMapKeyRef:
                  name: fastapi-env
                  key: ENV

Comment on lines +18 to +21
@export DESCRIPTION=$$(cat README.md) && \
set -o allexport && \
source envs/$${ENV,,}.env && \
set +o allexport && \

Choose a reason for hiding this comment

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

medium

Consider using dotenv to manage environment variables instead of relying on shell commands. This can improve readability and maintainability. Also, consider whether DESCRIPTION should be an environment variable at all, or whether it should be passed directly to the alembic command as an argument.

Also, it might be better to use export directly in the .env file, instead of using set -o allexport.

	@uv sync
	@dotenv -f envs/$${ENV,,}.env -- uv run alembic upgrade head # Example using python-dotenv


class Configs(BaseSettings):
ENV: ENVIRONMENT
ENV: ENVIRONMENT = ENVIRONMENT.TEST

Choose a reason for hiding this comment

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

medium

While setting a default environment is good, ensure this default (TEST) is appropriate for all contexts. Consider raising an error if no environment is explicitly set, to force a conscious decision.

Suggested change
ENV: ENVIRONMENT = ENVIRONMENT.TEST
ENV: ENVIRONMENT # No default, requires explicit setting

Comment on lines 6 to 7
dev.env: |
ENV="DEV"
PORT="8000"

Choose a reason for hiding this comment

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

medium

Consider keeping the ENV variable in the configmap for clarity and consistency. Removing it might lead to confusion about the environment the application is running in.

  dev.env: |
    ENV="DEV"
    PORT="8000"

Comment on lines 14 to 15
prod.env: |
ENV="PROD"
PORT="8000"

Choose a reason for hiding this comment

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

medium

Consider keeping the ENV variable in the configmap for clarity and consistency. Removing it might lead to confusion about the environment the application is running in.

  prod.env: |
    ENV="PROD"
    PORT="8000"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] DB 고도화 및 Alembic을 통한 migration

2 participants