Skip to content

hotfix: Implement Task 7.3 of the marketplace epic — expose averageRa……ting and reviewCount on product responses so the catalog can render star ratings — using a denormalized-counter design (Decision A1) that was already fixed in the phase-7 plan.#134

Merged
edsonwade merged 2 commits into
mainfrom
develop
Jul 19, 2026

Conversation

@edsonwade

Copy link
Copy Markdown
Owner

#Purpose
Implement Task 7.3 of the marketplace epic — expose averageRating and reviewCount on product responses so the catalog can render star ratings — using a denormalized-counter design (Decision A1) that was already fixed in the phase-7 plan.

Current state
Code changes are written and compile clean (mvn test-compile -pl product-service → BUILD SUCCESS), but no tests have been executed and no Docker/Flyway rebuild has happened yet.

-Touched/added:

  • V14__add_rating_counters_to_product.sql — new columns + backfill
  • Product.java, ProductResponse.java, ProductMapper.java — carry the two new fields through all construction sites (5 constructors, 4 mapper sites)
  • ProductRepository.java — native row-locking recomputeRatingCounters update
  • ProductCacheKeys.java (new) — single source of truth for cache key names, since tenant fallback logic made ad-hoc key construction unsafe
  • ReviewService.java — recomputes counters and evicts only the product-detail cache (list cache intentionally untouched, per A1's no-evict policy)
  • Test layers written but not run: ReviewServiceTest (+5 cases), ProductMapperTest, ProductControllerTest, CatalogRatingIntegrationTest (new), ReviewConcurrencyIntegrationTest (new), catalog_rating.feature + CatalogRatingSteps.java (new)
  • Plan file correctly relocated to .claude/plans/2026-07-19-f7-task-7.3-catalog-rating-counters.md after an earlier misstep of creating it outside the project
    Two known traps already fixed in code: @Builder.Default dropping initializers in hand-written constructors (would NPE against a NOT NULL column), and the tenant-fallback cache-key mismatch that would have made evictions silently no-op.

#Purpose
Implement Task 7.3 of the marketplace epic — expose averageRating and reviewCount on product responses so the catalog can render star ratings — using a denormalized-counter design (Decision A1) that was already fixed in the phase-7 plan.

Current state
Code changes are written and compile clean (mvn test-compile -pl product-service → BUILD SUCCESS), but no tests have been executed and no Docker/Flyway rebuild has happened yet.

-Touched/added:

  • V14__add_rating_counters_to_product.sql — new columns + backfill
  • Product.java, ProductResponse.java, ProductMapper.java — carry the two new fields through all construction sites (5 constructors, 4 mapper sites)
  • ProductRepository.java — native row-locking recomputeRatingCounters update
  • ProductCacheKeys.java (new) — single source of truth for cache key names, since tenant fallback logic made ad-hoc key construction unsafe
  • ReviewService.java — recomputes counters and evicts only the product-detail cache (list cache intentionally untouched, per A1's no-evict policy)
  • Test layers written but not run: ReviewServiceTest (+5 cases), ProductMapperTest, ProductControllerTest, CatalogRatingIntegrationTest (new), ReviewConcurrencyIntegrationTest (new), catalog_rating.feature + CatalogRatingSteps.java (new)
  • Plan file correctly relocated to .claude/plans/2026-07-19-f7-task-7.3-catalog-rating-counters.md after an earlier misstep of creating it outside the project
    Two known traps already fixed in code: @Builder.Default dropping initializers in hand-written constructors (would NPE against a NOT NULL column), and the tenant-fallback cache-key mismatch that would have made evictions silently no-op.

…ting and reviewCount on product responses so the catalog can render star ratings — using a denormalized-counter design (Decision A1) that was already fixed in the phase-7 plan.
@edsonwade edsonwade self-assigned this Jul 19, 2026
@edsonwade edsonwade added bug Something isn't working enhancement New feature or request good first issue Good for newcomers dependencies Pull requests that update a dependency file labels Jul 19, 2026
@edsonwade
edsonwade merged commit 74a4116 into main Jul 19, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Pull requests that update a dependency file enhancement New feature or request good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant