Add Restocking tab and system architecture doc - #234
Conversation
Adds a budget-driven restocking workflow: a new Restocking tab lets users set an available budget, see items recommended from demand forecasts (prioritized by urgency and rising demand), and submit an order that appears in the Orders tab under a new "Submitted Orders" section with delivery lead time. Backfills unit_cost onto demand_forecasts.json since its SKUs don't overlap inventory.json's, so recommendations couldn't otherwise be costed. Also adds docs/architecture.html, a static overview of the system's tech stack, architecture, and data flow for onboarding. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Reviewed this with a fresh pair of eyes (independent pass, not just re-reading what I wrote). Overall the backend is solid and convention-compliant, but there's one real bug in the frontend interaction that undermines the feature's core UX, plus a few things worth tightening before merge. 🔴 Bug — checked-item selection resets on every budget change
const applyRecommendations = (data) => {
recommendedItems.value = data.recommended_items
totalCost.value = data.total_cost
checkedSkus.value = new Set(data.recommended_items.map(item => item.sku)) // always re-checks everything
}This runs from both Fix: only seed "all checked" on the very first load; on subsequent budget-driven refetches, preserve existing unchecked state for SKUs that are still present, e.g.: const applyRecommendations = (data, isInitial = false) => {
recommendedItems.value = data.recommended_items
totalCost.value = data.total_cost
const newSkus = new Set(data.recommended_items.map(i => i.sku))
checkedSkus.value = isInitial
? newSkus
: new Set([...checkedSkus.value].filter(s => newSkus.has(s)))
}🟡 Recommended before merge
🟢 Nice-to-haves
What's good
Happy to push a follow-up commit for the checkbox-reset fix + the Pydantic constraints if useful — those are the two I'd actually block on. |
Unchecking a recommended item, then moving the budget slider at all, silently re-checked every item on the next recommendation refetch -- the checked-item selection was rebuilt from scratch on every budget change instead of only on first load. Now only the initial load defaults everything to checked; subsequent refetches preserve the user's existing exclusions and only default newly-appearing items to checked. Also adds Pydantic constraints (positive quantity, non- negative unit price, capped item-list length) to the restocking order submission endpoint, which previously trusted client-supplied values with no bounds. Found during PR review: beck-source#234 (comment) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
.claude/settings.local.json holds personal env var overrides (e.g. experimental feature flags) that shouldn't be shared via git. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The Reports page was the one view in the app that hadn't kept pace with the rest of the codebase's conventions: - No i18n at all (hardcoded English strings, $ currency symbol regardless of locale) -- now fully translated via t(), including localized month labels. - Completely ignored the global filter bar -- neither the frontend nor the /api/reports/quarterly and /api/reports/monthly-trends backend endpoints accepted warehouse/category/status/month filters. Both endpoints now reuse the existing apply_filters/filter_by_month helpers, and the view wires into useFilters() like every other view. - ~14 unconditional console.log calls, several inside per-render helper functions -- removed entirely. - Still on Options API while every other view uses Composition API; bypassed the centralized api.js client in favor of raw axios calls to a hardcoded URL; used array index as v-for :key (a documented anti-pattern in this repo's own CLAUDE.md); recomputed max revenue by rescanning the full dataset on every bar render (O(n^2)); had a latent bug in hand-rolled number formatting that mis-placed a comma on negative values. All fixed to match Orders.vue/Demand.vue conventions. Also translates the "Reports" nav tab, the one nav link that was still hardcoded in English. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Pushed fixes for both blocking items from the review above:
All 62 backend tests pass, production build is clean, and both fixes were verified live in the browser (checkbox exclusion persists across slider moves; Reports page now translates, filters, and is silent in the console). |
Adds a budget-driven restocking workflow: a new Restocking tab lets users set an available budget, see items recommended from demand forecasts (prioritized by urgency and rising demand), and submit an order that appears in the Orders tab under a new "Submitted Orders" section with delivery lead time. Backfills unit_cost onto demand_forecasts.json since its SKUs don't overlap inventory.json's, so recommendations couldn't otherwise be costed.
Also adds docs/architecture.html, a static overview of the system's tech stack, architecture, and data flow for onboarding.