All skills

merchmix-product-review-be

current

Rust/Axum service for building, storing, retrieving, exporting, and delivering retail product review artifacts across weekly, monthly, quarterly, and seasonal periods. It aggregates merchandise performance data from PostgreSQL and WSSI-related sources, builds compressed versioned review payloads, and provides REST, MCP, and gRPC interfaces. Background schedulers support recurring review delivery and weekly briefing generation.

master·ab507575b127·generated by gpt-5.6-luna·9/4/2026, 11:22:26 AM View as Markdown

This service gives retailers a consolidated view of how merchandise is performing against budget and last year. Users can create trade reviews, inspect sales, margin, stock, markdown, sell-through, and weeks-of-cover results, add commentary, export reviews to Excel, and schedule email or Slack delivery. It also produces recurring weekly executive briefings with key findings, risks, winners, and recommended actions.

12
Product Performance Review GenerationproductionexecuteReportinguser facingagent facinginternal98%

Creates merchandise performance reviews for selected departments, categories, subcategories, brands, stores, seasons, and reporting periods.

The review pipeline resolves calendar bounds, queries current-year and prior-year metrics, retrieves terminal CSOH and WSSI-derived values, assembles a hierarchy tree, applies weeks-of-cover goals, and persists a versioned compressed PRV artifact.

Product Performance Review RetrievalproductionreadReportinguser facingagent facing99%

Lets retail users retrieve available reviews and inspect their current status or a specific historical version.

REST handlers list reviews by period, return current or versioned artifact bytes, expose artifact status, and decode stored PRV blobs into diagnostic review nodes.

Merchandise Performance DrilldownproductionreadReportinguser facingagent facing90%

Provides detailed style-level size breakdowns so users can investigate product performance beyond the summary hierarchy.

The size-breakdown route executes a dynamic SQL query for a style code within a review scope and returns its size-level performance data.

Trade Commentary ManagementproductionwriteReportinguser facingagent facing98%

Allows merchants to record comments, highlights, lowlights, actions, and executive summaries against a review.

Review artifacts contain dedicated commentary columns, with REST and MCP operations for reading and updating commentary.

AI-Assisted Trade CommentaryproductionexecuteReportinguser facingagent facing88%

Generates AI-written review commentary to help merchants prepare trade discussions and summaries.

The write-AI operation is backed by an optional OpenAI configuration and writes generated content to the review artifact; the environment configuration indicates the feature degrades when AI credentials are absent.

Review Excel ExportproductionreadReportinguser facingagent facing97%

Exports a merchandise review into an Excel workbook for offline analysis and sharing.

The export handler builds an XLSX workbook using rust_xlsxwriter and exposes it through the review export route.

Review Delivery SchedulingproductionwriteReportinguser facingagent facinginternal96%

Schedules review delivery to a mailbox through email or Slack, including recurring delivery options.

Delivery schedules store channel, destination, mailbox, send time, recurrence, subject, message, and status. A background delivery scheduler handles scheduled dispatch, cancellation, and immediate-send flows.

Weekly Executive BriefingsproductionexecuteReportinguser facingagent facinginternal96%

Creates and delivers recurring weekly summaries of merchandise performance, including KPIs, risks, winners and losers, opportunities, and prioritized actions.

The service manages weekly briefing schedules and runs, supports preview and test execution, stores JSON briefing summaries, and runs a background scheduler plus an internal dispatch endpoint.

Product Review Settings ManagementproductionwritePlanninguser facingagent facing93%

Stores and updates client-specific settings used when preparing product reviews, including weeks-of-cover goal bands and overrides.

The settings API reads and writes persisted review settings; WocGoalSettings supports default and brand/category/subcategory-level thresholds with validation.

Season and Calendar DiscoveryproductionreadPlanninguser facingagent facing91%

Provides season information and reporting-period calendar context used to select and build reviews.

The seasons endpoint reads season data, while pipeline calendar modules resolve weekly, monthly, quarterly, and seasonal bounds and latest available weeks.

WSSI Data IntegrationproductionreadPlanninginternal90%

Uses WSSI planning data to enrich reviews with budget and stock-related merchandise metrics.

A generated tonic client implements the WssiService contract with GenerateWssi and GetBudgetExportValues RPCs; the review pipeline also fetches WSSI aggregates and derives metrics such as terminal stock and budget values.

Machine-Readable Product Review AccessproductionexecuteOtheragent facing97%

Allows AI agents and other compatible clients to perform review, settings, and weekly briefing operations through a tool interface.

An MCP Streamable HTTP server exposes tool wrappers over the existing HTTP handlers, with tenant resolution from the X-Client-ID request header and host/origin restrictions.

4
Build a merchandise review

Creates an enriched, versioned review artifact for a selected retail reporting period.

  1. 1.Resolve calendar bounds and latest available reporting week.
  2. 2.Query current-year, prior-year, budget, sales, seller, and CSOH-related metrics from the sync database.
  3. 3.Fetch or derive WSSI aggregates and apply weeks-of-cover goal settings.
  4. 4.Assemble the merchandise hierarchy and review header.
  5. 5.Encode the review using MessagePack and zstd, then persist the artifact and its versioned blob.
  6. 6.Expose the artifact as pending, building, ready, or failed through status and retrieval routes.
Review and annotate merchandise performance

Retrieves a review, investigates product detail, and records merchant interpretation.

  1. 1.List or locate a review by period and slug.
  2. 2.Fetch the current or selected historical version.
  3. 3.Inspect hierarchy metrics or request a style size breakdown.
  4. 4.Read or update trade commentary and executive summary fields.
  5. 5.Optionally generate AI-assisted commentary.
Deliver a scheduled review

Sends a review to a configured destination on a one-time or recurring schedule.

  1. 1.Create a delivery schedule with destination, channel, send time, and recurrence.
  2. 2.Background delivery scheduler identifies due schedules.
  3. 3.Dispatch the review through the configured delivery integration.
  4. 4.Update schedule status and sent/mailbox metadata.
Generate a weekly executive briefing

Produces a recurring summary for a configured client and review scope.

  1. 1.Create or update a weekly briefing schedule with source review, filters, timezone, and local send time.
  2. 2.Scheduler creates or processes a briefing run with idempotency tracking.
  3. 3.Build or preview the briefing summary and recommended actions.
  4. 4.Deliver the briefing by email when configured and record run status and errors.

A single Rust service combines HTTP routing, MCP tool serving, gRPC client generation, PostgreSQL persistence, Redis caching, review aggregation pipelines, binary artifact encoding, and background schedulers. HTTP handlers contain much of the SQL and business logic directly; MCP tools call those handlers rather than duplicating the logic.

Components
Axum REST API and health endpointsMCP Streamable HTTP server mounted at /mcpReview pipeline for calendar resolution, metric queries, hierarchy assembly, WSSI enrichment, and persistencePRV binary encoder/decoder using MessagePack and zstdPostgreSQL application and synchronization database pools with SQLx migrationsLayered in-memory/Redis cacheDelivery and weekly briefing background schedulersGenerated tonic/prost WSSI gRPC clientExcel export componentTelemetry and structured tracing
Patterns
Multi-tenant request handling using client identifiersVersioned immutable-style review blobs with metadata in relational tablesRead-through layered cachingBackground scheduler and retry/run trackingDirect handler reuse for MCP operationsOffline SQLx query preparation and migration-based schema managementContainerized deployment to Azure Container Apps and Google Cloud Run
25
KindIdentifierDescription
http/v2/:period/reviewsList reviews for a client and reporting period; POST creates a review artifact.
http/v2/:period/reviews/:slugRetrieve or delete a review by period and slug.
http/v2/:period/reviews/:slug/statusRead review build status.
http/v2/:period/reviews/:slug/v/:versionRetrieve a specific review artifact version.
http/v2/:period/reviews/:slug/refreshRefresh/rebuild an existing review.
http/v2/:period/reviews/:slug/commentaryRead or update review commentary.
http/v2/:period/reviews/:slug/write-aiGenerate or write AI-assisted review text.
http/v2/:period/reviews/:slug/size-breakdown/:style_codeRead style-level size breakdown data.
http/v2/:period/reviews/:slug/export/excelDownload a review as an Excel workbook.
http/v2/:period/reviews/:slug/delivery-schedulesList or create delivery schedules for a review.
http/v2/:period/reviews/:slug/delivery-schedules/:schedule_idCancel or manage an individual review delivery schedule.
http/v2/seasonsList available seasons.
http/v2/product-review-settingsRead or update product review settings.
http/v2/reviews/decode-diagnostic/:artifact_idDecode the current binary artifact into diagnostic header and node data.
http/v2/weekly-briefing-schedulesList or create weekly briefing schedules.
http/v2/weekly-briefing-schedules/:schedule_idUpdate or delete a weekly briefing schedule.
http/v2/weekly-briefing-schedules/:schedule_id/runsList runs for a weekly briefing schedule.
http/v2/weekly-briefing-schedules/:schedule_id/testTest a weekly briefing schedule.
http/v2/weekly-briefings/latestRetrieve the latest weekly briefing.
http/v2/weekly-briefings/previewPreview a weekly briefing.
http/internal/v2/weekly-briefings/dispatchInternal weekly briefing dispatch endpoint.
http/health/live and /health/readyLiveness and readiness probes.
http/mcp and /.well-known/mcp-serviceMCP Streamable HTTP transport and service metadata.
grpcwssi.WssiService/GenerateWssiGenerates WSSI calendar headers and aggregate values for client, brand/category, store, year, and week count.
grpcwssi.WssiService/GetBudgetExportValuesReturns budget export payload values for a client, year, department, category, and subcategory.
8
EntityOwnershipDescription
ReviewArtifactownsMetadata for a client review, including period, slug, version, status, dimensions, build details, and commentary fields.
ReviewArtifactBlobownsCompressed binary PRV payload for each review artifact version.
ReviewDeliveryScheduleownsOne-time or recurring review delivery configuration and dispatch status.
WeeklyBriefingScheduleownsClient/user weekly briefing schedule, source review scope, filters, timezone, and next/last run timestamps.
WeeklyBriefingRunownsExecution record for a briefing, including idempotency key, reporting period, retry state, summary, delivery time, and errors.
ProductReviewSettingsownsPersisted review configuration including weeks-of-cover defaults and hierarchy-level overrides.
MerchandisePerformanceMetricsreadsSales, gross profit, budget variance, prior-year comparison, sell-through, markdown, stock, units, and weeks-of-cover inputs used to build reviews.
SeasonsAndCalendarreadsSeason definitions and reporting-week/calendar data used to resolve review periods.
10
NameKindRelationshipCriticality
PostgreSQL application databasedatabasereadscritical
PostgreSQL synchronization databasedatabasereadscritical
Redisdatabaseusesrequired
WSSI serviceinternal servicecallsrequired
Merchmix Basics serviceinternal servicecallsrequired
OpenAI APIexternal servicecallsoptional
SendGridexternal servicecallsoptional
Google Cloud Run Jobsexternal servicecallssupporting
merchmix-telemetry-sdklibraryusessupporting
NATSqueueusessupporting
Rust 2024 editionTokioAxum 0.7SQLx with PostgreSQLRedis via deadpool-redisSerde and JSONMessagePack via rmp-serdezstd compressionTonic and Prost gRPCMCP Streamable HTTP via rmcprust_xlsxwriterOpenAPI via utoipa and Swagger UITower HTTP middlewareDockerAzure Container AppsGoogle Cloud Run
5
  • The supplied evidence does not include complete handler implementations, migration contents, or all MCP tool definitions, so exact request/response schemas and table names are not fully established.
  • The concrete email, Slack, and OpenAI client implementations were not included in the excerpts; their configuration and enum values establish intended integrations, but delivery behavior should be verified in the remaining source.
  • NATS is reported by scanning, but no concrete topic, message schema, publisher, or consumer is shown.
  • No frontend screens are present in this repository; user-facing screens are presumably provided by another application.
  • The deployment files show both Azure Container Apps and Google Cloud Run targets, but the active production target cannot be determined solely from repository evidence.

Use this repository for merchandise review generation, retrieval, commentary, export, delivery scheduling, weekly executive briefings, and agent-accessible review operations.

  • Resolve tenant context from the X-Client-ID header for REST/MCP operations; do not assume a client_id argument can override the request tenant.
  • Use period and slug for normal review access; use artifact_id only for the diagnostic decode route, which directly looks up the artifact.
  • Treat review artifacts as versioned binary payloads and use the status endpoint before assuming a newly requested review is ready.
  • For review analytics, prefer the existing review retrieval and size-breakdown interfaces instead of reconstructing metric calculations externally.
  • Use product-review-settings when weeks-of-cover goals or hierarchy-specific thresholds need to be changed.
  • Protect weekly briefing internal dispatch operations with the configured internal secret and required actor/request headers.
  • AI writing and outbound email delivery are optional integrations; handle unavailable credentials or providers as degraded capability rather than assuming success.
  • Do not expose or request secret environment values, tokens, database URLs, or API keys.