Skip to content

week 1-7 tasks done #81

Open
Kreesh Modi (kreeeesh17) wants to merge 83 commits into
Rippling:mainfrom
kreeeesh17:main
Open

week 1-7 tasks done #81
Kreesh Modi (kreeeesh17) wants to merge 83 commits into
Rippling:mainfrom
kreeeesh17:main

Conversation

@kreeeesh17

@kreeeesh17 Kreesh Modi (kreeeesh17) commented Apr 6, 2026

Copy link
Copy Markdown

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, default Miscellaneous category, category delete protection). Includes both a one-off migration script (week4/migrate_old_products.py) and an automatic startup seed/migration via Week4Config.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 register week2/week3/week4, sets DRF pagination defaults, and expands requirements.txt with MongoEngine, Streamlit/data/ML, and Gemini/Pydantic dependencies.

Reviewed by Cursor Bugbot for commit 8b30275. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Fix All in Cursor

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",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8b30275. Configure here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8b30275. Configure here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8b30275. Configure here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8b30275. Configure here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants