Skip to content

add dev_docker case to set reload_flag#686

Open
qredwoods wants to merge 1 commit intodevelopfrom
bugfix/679/uvicorn-doesnt-reload
Open

add dev_docker case to set reload_flag#686
qredwoods wants to merge 1 commit intodevelopfrom
bugfix/679/uvicorn-doesnt-reload

Conversation

@qredwoods
Copy link
Copy Markdown
Collaborator

Description

add a short description
adds "or if the environment is "dev_docker" also set the uvicorn reload flag. Considered shifting to "case" to future-proof for easily adding other environments in the future, but used 'or' for minimal diff and lack of anticipation of many other cases. In discussion in ChatGPT5 conversation, it suggested use of "$(ENVIRONMENT:-)" in the line as a safe default guard, however I chose to leave it out because it seems in the development context you would want the "ENVIRONMENT: unbound variable" error if for some reason your environment wasn't set. I defer to reviewer judgment as this is new terrain for me.

reference to relevant issue
#679

Type of changes

  • ( X) Bugfix
  • ( ) Chore
  • ( ) New Feature

Testing

  • ( ) I added automated tests
  • (X ) I think tests are unnecessary

How to test

testing description here: i.e. run app, go to x page, see that it does y
make a change that would trigger a uvicorn reload while running app in docker desktop and see if reloads

Clean commits

  • ( X) I plan to Squash and Merge
  • (X ) My commit history is clean¹
    ¹ described here

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
datasci-earthquake Ready Ready Preview Comment Oct 15, 2025 0:32am

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @qredwoods, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the development experience for users working within a Docker environment by automatically enabling Uvicorn's hot-reloading feature. By extending the condition for setting the --reload flag to include the dev_docker environment, developers will now benefit from immediate code changes being reflected without manual server restarts, thereby streamlining the development workflow.

Highlights

  • Uvicorn Reload for dev_docker Environment: The startup.sh script has been updated to enable the Uvicorn --reload flag when the ENVIRONMENT variable is set to dev_docker, mirroring the behavior for the development environment.
  • Environment Variable Handling: The author intentionally omitted the use of $(ENVIRONMENT:-) for default guarding, preferring an unbound variable error in development contexts to ensure the environment is always explicitly set.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@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 adds the dev_docker environment to the condition for enabling the --reload flag for uvicorn. The change is correct, but as you mentioned in the description, using a case statement would improve maintainability and make it easier to add other environments in the future. I've added a suggestion to refactor the if statement to a case statement.

Comment on lines +37 to 39
if [ "${ENVIRONMENT}" = "development" ] || [ "${ENVIRONMENT}" = "dev_docker" ]; then
RELOAD_FLAG="--reload"
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For better readability and future extensibility, consider using a case statement here. As you noted in the pull request description, this would make it cleaner to add more environments in the future.

Suggested change
if [ "${ENVIRONMENT}" = "development" ] || [ "${ENVIRONMENT}" = "dev_docker" ]; then
RELOAD_FLAG="--reload"
fi
case "${ENVIRONMENT}" in
development|dev_docker)
RELOAD_FLAG="--reload"
;;
esac

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If it makes sense to reviewers I am happy to support the use of case. I just don't personally foresee the addition of more environments at this time, if we go to three then case definitely makes sense at that time, but could be fine now.

@qredwoods qredwoods requested a review from agennadi October 22, 2025 00:11
Copy link
Copy Markdown
Collaborator

@agennadi agennadi left a comment

Choose a reason for hiding this comment

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

Since you fixed the if-statement, the underlying issue with the reload functionality has surfaced. Please don’t merge this PR until we resolve the issues mentioned in this bug report: #697

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