Rewrite BarRobot v2 around safe, testable services - #2
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Capture the five Flask pages plus the pour status list against a demo 12-bottle configuration in safe mode, and document each in a new 'The UI' section. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: cmc0619 <cmc0619@users.noreply.github.com>
Greptile SummaryThe PR rewrites BarRobot around validated, injectable service boundaries.
Confidence Score: 2/5This PR should not merge until actuator deassertion is exception-safe and GET requests can no longer initiate a physical pour. A mid-press exception can leave the valve energized, while the compatibility GET route still reaches the complete live rotation-and-dispense path without an intentional POST action. Files Needing Attention: barrobot/hardware.py, barrobot/routes.py
|
| Filename | Overview |
|---|---|
| barrobot/hardware.py | Adds serialized motion and actuator control, but actuator presses are not exception-safe and can leave the valve energized. |
| barrobot/routes.py | Adds service-oriented web workflows and complete-plan locking, but the retained GET pour route can still initiate physical dispensing. |
| barrobot/planning.py | Adds immutable preflighted automatic/manual actions and shot-size-aware repetition calculation. |
| barrobot/config.py | Adds normalized validation, legacy migration, and atomic configuration persistence. |
| barrobot/recipes.py | Adds typed CocktailDB conversion, explicit download errors, and atomic cache persistence. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
UI[Flask routes and templates] --> Config[ConfigStore]
UI --> Recipes[RecipeRepository]
UI --> Planner[Drink planner]
Config --> Planner
Recipes --> Planner
Planner --> Controller[HardwareController]
Controller --> GPIO[GPIO adapter]
GPIO --> Hardware[Turret and actuator]
Reviews (1): Last reviewed commit: "Add v2 UI screenshots to README (#5)" | Re-trigger Greptile
| self._output("ACTUATOR", True) | ||
| self._sleeper(PUSH_DURATION_MS / 1000) | ||
| self._output("ACTUATOR", False) |
| return jsonify(status="ok", slot=slot) | ||
|
|
||
|
|
||
| @web.route("/make_drink/<name>", methods=["GET", "POST"]) |
There was a problem hiding this comment.
GET still executes physical pours
When a crawler, prefetch, refresh, or embedded URL sends GET for a known recipe after live position is established, the shared route body rotates the turret and presses the actuator, causing a drink to be dispensed without an intentional Pour submission.
| @web.route("/make_drink/<name>", methods=["GET", "POST"]) | |
| @web.post("/make_drink/<name>") |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 3 medium 2 minor 57 high |
🟢 Metrics 283 complexity · 2 duplication
Metric Results Complexity 283 Duplication 2
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
Summary
Rewrites BarRobot v2 around explicit configuration, recipe, planning, web, hardware-controller, and GPIO-adapter boundaries while preserving the existing route URLs, 12-slot workflow, recipe-cache schema, pantry/substitution behavior, safe mode, configurable pins, shortest-path rotation, and conservative motion ramp.
The first commit contains the complete review and behavior contract in
design.md. Intentional safety and correctness changes are documented there rather than hidden in refactoring.Important behavior changes
bottle_config.jsoninto canonicalconfig.jsonshot_sizedetermine actuator repetitionsDeveloper and operator impact
app.pyandhardware.pyremain compatibility entry pointsValidation
ruff format --check .ruff check .pytest— 31 passedpython -m compileall -q app.py hardware.py barrobot testsgit diff --checkNo tests contact CocktailDB or emit Raspberry Pi GPIO.