week 1-7 tasks done #81
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 4 potential issues.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issues. You can view the agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8b30275. Configure here.
| db=mongo_db, | ||
| host=mongo_uri, | ||
| alias="default", | ||
| ) |
There was a problem hiding this comment.
Conflicting MongoDB connection alias causes startup failure
High Severity
Both week3/db_connection.py and week4/db_connection.py call mongoengine.connect() with alias="default", but they point to different databases (interneers_lab_week3 vs interneers_lab_week4). Since both Week3Config and Week4Config are in INSTALLED_APPS, both ready() methods execute at startup. Registering the same alias twice either raises a connection error (crashing Django) or silently ignores the second call, causing week4 models to operate on the wrong database.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8b30275. Configure here.
There was a problem hiding this comment.
Bugbot Autofix determined this is a false positive.
The referenced backend/python/week3 and backend/python/week4 modules do not exist in this repository, so this alias conflict is not present here.
You can send follow-ups to the cloud agent here.
| def update(self, id, data): | ||
| existing_product = product_repository.get(id) | ||
| if not existing_product: | ||
| return None |
There was a problem hiding this comment.
Service update returns None causing view crash
Medium Severity
ProductService.update() returns None when the product isn't found, but returns an error dict for other failures and a Product object on success. In ProductDetailAPIView.put(), only the error-dict case is handled — if update() returns None, the code proceeds to call updated_product.to_dict(), which crashes with an AttributeError. Although the view pre-checks existence, a concurrent delete between the check and the update call triggers this crash.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8b30275. Configure here.
There was a problem hiding this comment.
Bugbot Autofix determined this is a false positive.
The cited week4/service.py and week4/views.py files are absent from this codebase, so the reported update/view crash path does not apply.
You can send follow-ups to the cloud agent here.
| @@ -0,0 +1 @@ | |||
| {"name":"Local: db_connection","url":"c:\\Users\\Kreesh\\OneDrive\\Desktop\\Rippling\\interneers-lab\\backend\\python\\week3\\db_connection.py","tests":[{"id":1773758364094,"input":"","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"c:\\Users\\Kreesh\\OneDrive\\Desktop\\Rippling\\interneers-lab\\backend\\python\\week3\\db_connection.py","group":"local","local":true} No newline at end of file | |||
There was a problem hiding this comment.
IDE debug file accidentally committed to repository
Low Severity
A Competitive Programming Helper (CPH) VS Code extension file was accidentally committed. It contains local filesystem paths (e.g., c:\\Users\\Kreesh\\OneDrive\\Desktop\\Rippling\\...) exposing the developer's personal directory structure. This file serves no purpose in the repository and leaks local environment details.
Reviewed by Cursor Bugbot for commit 8b30275. Configure here.
There was a problem hiding this comment.
Bugbot Autofix determined this is a false positive.
The .cph debug file and its containing week3 path are not tracked or present in this repository.
You can send follow-ups to the cloud agent here.
| else: | ||
| queryset = queryset.order_by("id") | ||
|
|
||
| return queryset |
There was a problem hiding this comment.
Duplicated filter/sort logic in repository methods
Low Severity
list_all and list_by_category in ProductRepository contain nearly identical filter and sort logic (~30 lines each). This duplication means any future filter change (e.g., adding a new field or fixing a filter bug) needs to be applied in two places, risking inconsistency. The shared logic could be extracted into a private helper method.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8b30275. Configure here.
There was a problem hiding this comment.
Bugbot Autofix determined this is a false positive.
The referenced backend/python/week4/repository.py file is not part of this repository, so this duplication issue cannot be reproduced here.
You can send follow-ups to the cloud agent here.


week 1-7 tasks done
Note
Medium Risk
Medium risk: adds multiple new API surfaces and MongoDB-backed persistence with automatic startup seeding/migration, plus CSV upload and external Gemini integration, which could affect data consistency and runtime behavior if misconfigured.
Overview
Adds new backend features across Weeks 1–6: a hexagonal
GET /hello-world/greeting endpoint, a Week 2 in-memory DRF Product CRUD API (with manual pagination), and a Week 3 refactor to a layered service/repository design persisted in MongoDB via MongoEngine.Introduces a Week 4 MongoDB-backed inventory system with Product + Category CRUD, category–product assignment endpoints, filtering/sorting/pagination, bulk CSV product upload (validate-all-rows-before-insert), and enforced business rules (unique category titles, required
brand, defaultMiscellaneouscategory, category delete protection). Includes both a one-off migration script (week4/migrate_old_products.py) and an automatic startup seed/migration viaWeek4Config.ready().Adds Week 5–6 tooling: a Streamlit inventory dashboard (add/remove products, category filter, low-stock alerts) and an extended Streamlit dashboard that uses Gemini (
google-genai) + Pydantic schemas to generate and optionally persist AI-generated products and future stock events. Updates Django settings/URLs to registerweek2/week3/week4, sets DRF pagination defaults, and expandsrequirements.txtwith MongoEngine, Streamlit/data/ML, and Gemini/Pydantic dependencies.Reviewed by Cursor Bugbot for commit 8b30275. Configure here.