Skip to content

fix: brand registry house/sub-brand counts#1353

Merged
bokelley merged 2 commits intomainfrom
bokelley/fix-share-icon-spacing
Mar 9, 2026
Merged

fix: brand registry house/sub-brand counts#1353
bokelley merged 2 commits intomainfrom
bokelley/fix-share-icon-spacing

Conversation

@bokelley
Copy link
Contributor

@bokelley bokelley commented Mar 8, 2026

Summary

Supersedes #1132. The brand registry page shows house/sub-brand counts but they were always zero because:

  • The getAllBrandsForRegistry query hardcoded NULL as keller_type for hosted brands, so they were never counted
  • The API response was missing houses, sub_brands, and with_manifest stats that the frontend expected
  • Seeded discovered brands had no keller_type set

Fixes:

  • LEFT JOIN hosted_brands to discovered_brands to pull actual keller_type, defaulting to master for self-hosted brands with no discovered record
  • Add houses, sub_brands, with_manifest stats to the registry API response
  • Backfill migration for seeded brands with idempotency guards (WHERE keller_type IS NULL) to avoid overwriting enrichment/community edits
  • Fix data conflicts from Fix a brand and sub brand count on brand registry page #1132: removed Pfizer from independent list (it's a master), removed duplicate Lilly entry, removed NBCUniversal from master list (it's a Comcast sub-brand)

Test plan

  • All 323 unit tests pass
  • TypeScript typecheck clean
  • OpenAPI spec unchanged
  • Migration applies cleanly in Docker (verified: 40 master, 38 independent, 65 sub_brand)
  • Verified query returns correct stats via direct DB query (195 total, 79 houses, 65 sub-brands)
  • No duplicate rows from LEFT JOIN (verified with hosted brand data)

🤖 Generated with Claude Code

bokelley and others added 2 commits March 8, 2026 16:14
The getAllBrandsForRegistry query hardcoded NULL for keller_type on
hosted brands, so they were never counted as houses or sub-brands.
Join hosted_brands to discovered_brands to pull the actual keller_type,
defaulting to 'master' for self-hosted brands. Also add missing
with_manifest stat and backfill keller_type for seeded discovered brands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add keller_type IS NULL / house_domain IS NULL guards so the migration
won't overwrite values set by enrichment or community edits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bokelley bokelley merged commit a6cf73f into main Mar 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants