← Back to documentation

BUY-2478-product-detail-agent-field-audit

Product Detail Agent-Readable Field Audit

Issue: BUY-2478
Date: 2026-04-16
Auditor: Snap (Eng19)
Scope: V1 and V2 Product Detail endpoints (/products/{id}, /v2/products/{product_id})


Executive Summary

The BuyWhere product catalog API has a strong foundation for agent-native usage, but has significant gaps in fields required for AI agents to make purchase recommendations and provide accurate citations. This audit identifies 32 missing or suboptimal fields across 5 categories.


Current Field Coverage

V2 ProductResponse (app/schemas/product.py:936-969)

Currently exposed:

  • Basic: id, sku, source, merchant_id, name, description, price, currency, price_sgd
  • URLs: buy_url, affiliate_url, image_url
  • Categorization: brand, category, category_path
  • Ratings: rating, review_count
  • Availability: is_available, in_stock, stock_level, last_checked
  • Metadata: data_updated_at, metadata, updated_at
  • Agent: confidence_score, availability_prediction, competitor_count, data_freshness

Database Product Model (app/models/product.py:19-87)

Available but NOT exposed in API:

  • canonical_id - Cross-platform canonical product ID
  • barcode - UPC/EAN (only in V1 ProductResponse, missing from V2)
  • specs - JSONB structured specifications
  • created_at - First ingestion timestamp
  • rating_source, avg_rating - Rating provenance
  • title_search_vector, search_vector - Internal TSV (OK to keep internal)

Missing Fields by Category

Category 1: Citation & Reference Fields (Critical for Agents)

FieldSeverityDescriptionDB ColumnRecommendation
canonical_idCRITICALCross-platform product grouping ID for dedup/citationsproducts.canonical_idAdd to V2ProductResponse
source_urlHIGHDirect URL to product on source platform (for agent citations)products.urlRename/alias buy_url → source_url
merchant_nameHIGHHuman-readable store name for agent responsesmerchants.name (join)Add merchant join to detail endpoint
barcodeMEDIUMUPC/EAN for product identificationproducts.barcodeAdd to V2ProductResponse (missing)
product_typeLOWProduct type classificationmetadata_->>'product_type'Surface from metadata

Category 2: Data Provenance & Trust (Critical for Citation Quality)

FieldSeverityDescriptionDB ColumnRecommendation
ingested_atHIGHWhen product was first scraped/ingestedproducts.created_atAdd as ingested_at alias
scraper_versionMEDIUMWhich scraper version created this recordmetadata_->>'scraper_version'Surface from metadata
data_confidenceHIGHData quality score (0-1)ComputedAdd computed field
source_credibilityMEDIUMPlatform reliability ratingComputed per sourceAdd enum: verified, trusted, standard
last_verifiedMEDIUMWhen price/availability was last confirmedproducts.last_checkedRename/alias

Category 3: Structured Specifications (High Value for Agents)

FieldSeverityDescriptionDB ColumnRecommendation
specsHIGHStructured product specificationsproducts.specs (JSONB)Add to V2ProductResponse (currently only in metadata_)
specificationsHIGHNormalized/flattened specs for agentsComputedAdd computed field
key_featuresMEDIUMTop 3-5 product highlightsmetadata_->>'highlights'Surface from metadata

Category 4: Pricing Transparency (Critical for Purchase Decisions)

FieldSeverityDescriptionDB ColumnRecommendation
original_priceHIGHPrice before discountmetadata_->>'original_price'Surface explicitly
discount_pctHIGHDiscount percentageComputedAdd computed field
shipping_costHIGHShipping costmetadata_->>'shipping'Surface explicitly
shipping_estimateMEDIUMDelivery time estimatemetadata_->>'shipping_days'Surface explicitly
free_shippingMEDIUMBoolean free shipping flagmetadata_->>'free_shipping'Add computed boolean
tax_infoLOWTax applicabilitymetadata_->>'tax'Add if available

Category 5: Agent Decision Support

FieldSeverityDescriptionRecommendation
price_trendHIGH30-day price trend (up/down/stable)Currently computed in v1 only - add to v2
trust_signalsHIGHPlatform/method verification statusAdd enum: verified_source, community_vetted
return_policyMEDIUMReturn window and conditionsSurface from metadata if available
promotionsMEDIUMActive deals/couponsAdd as array of active promotions
warranty_infoLOWWarranty duration and coverageSurface from metadata if available
authenticitiyLOWAuthenticity guaranteeAdd boolean flag

Gap Analysis: V1 vs V2

FieldV1 ProductResponseV2 V2ProductResponseGap
barcode✅ Yes❌ NoRegressed in V2
avg_rating✅ Yes❌ NoMissing in V2
rating_source✅ Yes❌ NoMissing in V2
price_trend✅ Computed❌ Not computedNot implemented in v2
specsIn metadataIn metadataNot surfaced as top-level

Recommended Priority Fixes

Phase 1: Critical (Do First)

  1. Add canonical_id to V2ProductResponse
  2. Fix barcode regression in V2
  3. Add price_trend computation to v2 endpoint
  4. Add ingested_at / created_at as first_ingested
  5. Add data_confidence computed field

Phase 2: High Value

  1. Add merchant_name via join
  2. Add source_url as explicit citation URL
  3. Surface specs as top-level field
  4. Add original_price, discount_pct, shipping_cost
  5. Add trust_signals enum

Phase 3: Enhancement

  1. Add promotions array
  2. Add return_policy
  3. Add rating_distribution
  4. Add alternative_product_ids

Implementation Notes

Files to Modify:

  1. app/schemas/product.py - Add new fields to V2ProductResponse
  2. app/routers/v2.py:_map_v2_product() - Include new fields
  3. app/routers/products.py - Fix barcode exposure in V1 if needed

Migration Risk:

  • Adding fields is low risk (additive changes)
  • Changing field names is high risk (breaking change)
  • Adding computed fields is low risk

Appendix: Field Severity Ratings

RatingDefinitionAction
CRITICALBreaks agent citation or purchase recommendation capabilityFix in Phase 1
HIGHSignificantly degrades agent decision qualityFix in Phase 1-2
MEDIUMReduces answer completenessFix in Phase 2
LOWNice-to-have for specific use casesFix in Phase 3

Document generated as part of BUY-2478 audit task