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
pull from: barcode-betty/fix-dispose-engine-import
merge into: cartsnitch:dev
cartsnitch:main
cartsnitch:dev
cartsnitch:uat
cartsnitch:betty/car-1362-cache-remove-uat
cartsnitch:betty/car-1362-push-unknown-fix
cartsnitch:betty/car-1362-remove-gha-cache-dev
cartsnitch:betty/car-1330-buildpush-registry-token-dev
cartsnitch:betty/car-1330-buildpush-registry-token-uat
cartsnitch:betty/car-1330-dev-ci-fix
cartsnitch:betty/car-1340-uat-ci-fix
cartsnitch:barcode-betty/fix-car-1135-dispose-engine
cartsnitch:betty/car-1132-comprehensive-fix
cartsnitch:promote/car1077-dev-uat
cartsnitch:betty/fix-postgres-pool
cartsnitch:betty/fix-sqlite-uuid-server-default
cartsnitch:betty/fix-ci-test-failures-v2
cartsnitch:remove-deploy-dev-uat-jobs
cartsnitch:betty/fix-ci-test-failures
cartsnitch:barcode-betty/fix-lint-f402
cartsnitch:betty/fix-email-inbound-token-tests
cartsnitch:barcode-betty/car-1004-fix-ruff-lint
cartsnitch:betty/fix-lint-errors
cartsnitch:fix/cart-995-gitea-registry-migration
cartsnitch:fix-gitea-registry-migration
cartsnitch:betty/car-995-gitea-registry
cartsnitch:betty/car-932-dispose-import-v3
cartsnitch:barcode-betty/car-995-gitea-registry
cartsnitch:betty/car-932-fix-dispose-engine
cartsnitch:betty/car-964-gitea-registry-v2
cartsnitch:barcode-betty/gitea-registry
cartsnitch:savannah/fix-ci-uat-trigger
cartsnitch:barcode-betty/fix-ci-uat-trigger
cartsnitch:betty/car-869-gitea-actions-api
cartsnitch:betty/car-723-final-review
cartsnitch:betty/car-723-ci-workflow
cartsnitch:feat/car-723-migrate-api-to-new-repo
No Reviewers
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
Something isn't working
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Further information is requested
This will not be worked on
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
ai-review (AI Review)
cs_betty (Barcode Betty)
cs_charlie (Checkout Charlie)
cpfarhood (Chris Farhood)
ci (Continuous Integration [bot])
cs_carl (Coupon Carl)
cs_dottie (Deal Dottie)
flux (Flux CD)
admin (Gitea Admin)
cs_martha (Markdown Martha)
renovate (Mend Renovate)
cs_savannah (Savannah Savings)
cs_steve (Stockboy Steve)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cartsnitch/api#11
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "barcode-betty/fix-dispose-engine-import"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Remove the dead top-level import of
dispose_enginefromapi/src/cartsnitch_api/main.pyline 9. Thelifespanfunction already imports it locally — the module-level import was unused and causedImportErrorat module load, crashing the UAT API pods.Why
CAR-953: UAT API pods in CrashLoopBackOff because
dispose_engineis imported at module scope but not available fromcartsnitch_api.database. Thelifespanfunction correctly imports it locally.Verification
from cartsnitch_api.database import dispose_engineno longer appears at module level inmain.pylifespanfunction still callsawait dispose_engine()with local importapi/src/importsdispose_engineRisks
Minimal — removes one unused import, moves it to where it is actually used.
cc @cpfarhood
Refs: CAR-951
Closing — Wrong Repo
This PR targets
cartsnitch/api, but in this repodispose_engineis exported bydatabase.pyand actively used in thelifespanfunction (await dispose_engine()). The import on line 9 is live — not dead code.The actual bug is in the monorepo (
cartsnitch/cartsnitch), whereapi/src/cartsnitch_api/database.pywas refactored toinit_db()/close_db()butmain.pyline 9 still imports the now-nonexistentdispose_engine.Closing this PR. The fix will be re-opened against the correct repo.
Pull request closed