8000 fix(dev): let the API hot reload while the web app is open by adeelahmad · Pull Request #51 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

fix(dev): let the API hot reload while the web app is open - #51

Merged
adeelahmad merged 1 commit into
mainfrom
claude/e2e-fixes-elucss
Oct 2, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/e2e-fixes-elucss

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: in make dev (or make start-backend), saving a backend file while the web app was open made the API stop at "Waiting for connections to close" and stay down: the web app got 502s until the browser tab closed. Every make dev also left an 800 KB diff in local-shared-data/openapi.json.

After: the API reloads within a few seconds whether or not the web app is open, and make dev leaves the git tree clean.

Motivation and Context

The web app keeps /api/v1/events (server-sent events) open, and uvicorn waits for open connections before it reloads. fastapi dev has no option for a graceful-shutdown timeout, so start.sh now runs uvicorn app.main:app --reload --reload-dir app --timeout-graceful-shutdown 3. Watching only app/ also stops a local .venv in fastapi_backend/ from triggering reloads.

local-shared-data/openapi.json is the schema the dev API writes for the dev web app container. It was tracked but stale, so it is now ignored (.gitkeep keeps the folder). nextjs-frontend/openapi.json remains the tracked schema.

Steps to reproduce (if appropriate):

make dev, open the web app, then touch any file in fastapi_backend/app. Before: the API never comes back. After: Cancel 1 running task(s), timeout graceful shutdown exceeded, then Application startup complete. I checked this in the dev stack.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

GitHub Actions can't run on this repo right now, so Adeel approved merging on local checks.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ja26f8Npk3M6ixFhE1WEfe


Generated by Claude Code

The web app keeps /api/v1/events open, and uvicorn waits for open
connections before reloading, so with fastapi dev a reload hung until
the browser was closed. start.sh runs uvicorn with a 3 s graceful
shutdown timeout, watching only app/ (not a local .venv).

local-shared-data/openapi.json is what the dev API writes for the dev
web app; tracked, it was a stale 800 KB diff after every make dev.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ja26f8Npk3M6ixFhE1WEfe
@adeelahmad
adeelahmad merged commit 4e1cec8 into main Oct 2, 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.

2 participants

0