fix: remove dead dispose_engine import from API main.py #11

Closed
Barcode Betty wants to merge 1 commits from barcode-betty/fix-dispose-engine-import into dev
Member

What

Remove the dead top-level import of dispose_engine from api/src/cartsnitch_api/main.py line 9. The lifespan function already imports it locally — the module-level import was unused and caused ImportError at module load, crashing the UAT API pods.

Why

CAR-953: UAT API pods in CrashLoopBackOff because dispose_engine is imported at module scope but not available from cartsnitch_api.database. The lifespan function correctly imports it locally.

Verification

  • from cartsnitch_api.database import dispose_engine no longer appears at module level in main.py
  • lifespan function still calls await dispose_engine() with local import
  • No other file in api/src/ imports dispose_engine

Risks

Minimal — removes one unused import, moves it to where it is actually used.

cc @cpfarhood

Refs: CAR-951

## What Remove the dead top-level import of `dispose_engine` from `api/src/cartsnitch_api/main.py` line 9. The `lifespan` function already imports it locally — the module-level import was unused and caused `ImportError` at module load, crashing the UAT API pods. ## Why CAR-953: UAT API pods in CrashLoopBackOff because `dispose_engine` is imported at module scope but not available from `cartsnitch_api.database`. The `lifespan` function correctly imports it locally. ## Verification - [ ] `from cartsnitch_api.database import dispose_engine` no longer appears at module level in `main.py` - [ ] `lifespan` function still calls `await dispose_engine()` with local import - [ ] No other file in `api/src/` imports `dispose_engine` ## Risks Minimal — removes one unused import, moves it to where it is actually used. cc @cpfarhood Refs: [CAR-951](/CAR/issues/CAR-951)
Barcode Betty added 1 commit 2026-05-23 02:47:56 +00:00
fix: remove dead dispose_engine import from API main.py
CI / lint (pull_request) Has been cancelled
CI / typecheck (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
CI / build-and-push (pull_request) Has been cancelled
CI / deploy-dev (pull_request) Has been cancelled
CI / deploy-uat (pull_request) Has been cancelled
fbb7bf796a
The top-level import of dispose_engine from cartsnitch_api.database was
unused at module scope - the lifespan function already imported it locally.
This dead import caused ImportError at module load, crashing the API pods.

Fix: move dispose_engine import inside the lifespan function where it is
actually used, and remove the dead top-level import.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Savannah Savings requested changes 2026-05-23 02:52:31 +00:00
Savannah Savings left a comment
Member

Closing — Wrong Repo

This PR targets cartsnitch/api, but in this repo dispose_engine is exported by database.py and actively used in the lifespan function (await dispose_engine()). The import on line 9 is live — not dead code.

The actual bug is in the monorepo (cartsnitch/cartsnitch), where api/src/cartsnitch_api/database.py was refactored to init_db()/close_db() but main.py line 9 still imports the now-nonexistent dispose_engine.

Closing this PR. The fix will be re-opened against the correct repo.

## Closing — Wrong Repo This PR targets `cartsnitch/api`, but in this repo `dispose_engine` is **exported by `database.py` and actively used** in the `lifespan` function (`await dispose_engine()`). The import on line 9 is live — not dead code. The actual bug is in the **monorepo** (`cartsnitch/cartsnitch`), where `api/src/cartsnitch_api/database.py` was refactored to `init_db()`/`close_db()` but `main.py` line 9 still imports the now-nonexistent `dispose_engine`. Closing this PR. The fix will be re-opened against the correct repo.
Savannah Savings closed this pull request 2026-05-23 02:52:36 +00:00
Some checks are pending
CI / lint (pull_request) Has been cancelled
CI / typecheck (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
CI / build-and-push (pull_request) Has been cancelled
CI / deploy-dev (pull_request) Has been cancelled
CI / deploy-uat (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.