Scrum 234 ai shopping assistant query foundations#17
Conversation
…OrderCommandHandler
Move dated feature working docs (survey/audit/context/design/tasks/backlog) out of the flat docs/ root into docs/features/<feature>/ (ai-assistant, orders, logistics, auth-catalog). Core numbered spec stays at docs/ root so CLAUDE.md and 00-index.md path references remain valid. Add docs/features/README.md index and a pointer from 00-index.md.
…ira import Design for the AI Shopping Assistant orchestration layer (Tầng 2): provider GLM 5.2 (Free) via ZenMux behind a provider-agnostic IAssistantChatClient, Option B host-layer, MVP 5 tools, non-streaming v1 (SSE deferred), two-phase confirmation safety gate, DB-backed conversation store (Redis deferred). Adds T1-T8 task breakdown and a Jira CSV bulk-import (Epic Link SCRUM-234).
…it model Document DEC-002 (B2B credit / công nợ payment, superseding the per-order gateway) and update the capstone registration with the implemented business model (internal Market Agents, role set, Catalog, voice price updates).
- Non-streaming orchestrator loop (LLM <-> tool, MaxToolHops bounded) - POST /api/v1/assistant/chat with conversation persistence - Per-user session ownership check (404 on mismatch) prevents IDOR/session hijacking (CWE-639) - Request validation via FluentValidation invoked explicitly (no MediatR pipeline on this path)
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ✅ |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThe PR adds pricing product search and order-confirmation preview paths, an assistant chat stack with tool dispatch and conversation persistence, solution/runtime wiring, and updated planning, schema, and flow documentation. ChangesFeature implementation
Documentation updates
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
| return false; | ||
| } | ||
|
|
||
| orderId = args.OrderId.Value; |
| var ok = (OkObjectResult)response; | ||
| ok.Value.Should().NotBeNull(); | ||
| var data = ok.Value!.GetType().GetProperty("data")?.GetValue(ok.Value); | ||
| data.Should().Be(dto); |
| response.Should().BeOfType<OkObjectResult>(); | ||
| var ok = (OkObjectResult)response; | ||
| var data = ok.Value!.GetType().GetProperty("data")?.GetValue(ok.Value) as OrderConfirmationPreviewDto; | ||
| data.Should().NotBeNull(); |
|
|
||
| // Assert | ||
| await _sender.Received(1).Send( | ||
| Arg.Is<GetOrderQuery>(q => q.UserId == _userId && q.OrderId == _orderId && q.IsAdmin == false), |
| catch | ||
| { | ||
| return null; // invalid cursor treated as start of list | ||
| } |
Split the ERD into IMPLEMENTED (matches AppDbContextModelSnapshot) vs PLANNED tables. Correct drifted tables (users, roles, restaurants, products, markets, orders, order_items, scheduled_orders, driver_profiles) and add the new tables: product_categories, units_of_measurement, delivery_addresses, password_reset_tokens, verification_codes, order_issues, restaurant_credit, credit_transactions, assistant_conversations. Document the B2B credit model superseding the invoices/payments/refunds design and the catalog normalization.
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ✅ |
- Correct enum value sets/casing, FK ON DELETE behaviors, and logical-vs-enforced FK distinctions for implemented (Part A) tables - Note price_snapshots is a normal (non-partitioned) table - Document the preserved user_market_assignments.market_id -> markets FK - Mark CHECK clauses as app-enforced (not DB-level)
…rams - 02A system overview, 02B state machines (12 pages), 02C activity swimlanes (9 pages) as Draw.io sources + Markdown companions - PLANNED states/steps rendered with solid lines (grey + italic) for visual consistency with implemented ones - Update 00-index with 02A/02B/02C rows and mark 03/03A as Current
- Add Sync Status banner + Part A/Part B split mirroring the ERD doc
- Part A: authoritative inventory of all 79 implemented routes (method,
path, auth/roles) across 12 controllers + PricingHub/OrderHub, verified
1:1 against src/FreshFlow.API/Controllers and Program.cs
- Tag Logistics/Hub/Analytics domains and DeliveryHub as [PLANNED]
- Tag dropped/changed endpoints: order-groups + system-config [PLANNED],
generic PATCH /orders/{id}/status [SUPERSEDED], users/{id}/status [CHANGED]
- Renumber sections (Part A inserted as section 2); update 00-index row
- Add MicroElements.Swashbuckle.FluentValidation so validator rules (minLength/maxLength/pattern/required) surface in the generated OpenAPI - Upgrade Swashbuckle.AspNetCore 6.9.0 -> 10.2.3 (required by MicroElements on net10); adapt Program.cs to Microsoft.OpenApi 3.x (OpenApiSecuritySchemeReference, func-based AddSecurityRequirement) - Add RequestValidationSchemaBridge: maps *Request DTO schemas to their *Command/*Query validators so constraints appear without duplicating rules (coverage 2 -> 35 of 41 request schemas; remainder are framework/conditional)
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ✅ |
- ToolDefinitions.TryParseOrderId: use 'is not { } parsedOrderId' pattern so the Guid? null-state is explicit (no nullable dereference) - MarketProductRepository.SearchCursor.TryDecode: narrow generic catch to FormatException (bad Base64) + JsonException (bad payload); behavior unchanged - tests: explicit null checks on reflected envelope property; simplify 'IsAdmin == false' to '!IsAdmin'
Summary by CodeRabbit
GET /api/v1/orders/{orderId}/confirm-preview.