Skip to content

feat(dogs): add color lookup support#261

Merged
asku1990 merged 5 commits into
developfrom
feature/bej-107-import-dog-color-details
Jun 24, 2026
Merged

feat(dogs): add color lookup support#261
asku1990 merged 5 commits into
developfrom
feature/bej-107-import-dog-color-details

Conversation

@asku1990

@asku1990 asku1990 commented May 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add canonical dog color lookup data and status handling.
  • Import legacy color codes into the dog profile when they exist in the catalog.
  • Show dog colors on public/admin profiles.
  • Allow admins to select current official colors, while preserving existing hidden historical values during editing.

Notes

  • Legacy codes without a canonical definition are imported as unknown/null and recorded as import issues.
  • Hidden historical colors cannot be selected for new dogs.

ref bej-107

@vercel

vercel Bot commented May 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
beagle-db-v2 Ignored Ignored Preview Jun 24, 2026 1:07pm

asku1990 added 2 commits June 22, 2026 20:49
Add dog color storage, legacy import mapping, public profile display,
and admin form color selection backed by lookup data.

Files:
- CHANGELOG.md
- apps/web/app/actions/admin/dogs/lookups/get-admin-dog-color-options.ts
- apps/web/components/admin/dogs/admin-dogs-page-client.tsx
- apps/web/components/admin/dogs/dog-form-modal.tsx
- apps/web/components/admin/dogs/internal/dog-form-metadata-section.tsx
- apps/web/components/beagle-dog-profile/dog-profile-details-card.tsx
- apps/web/lib/admin/dogs/manage/dog-form-mappers.ts
- apps/web/lib/admin/dogs/manage/dog-mutation-flow.ts
- apps/web/queries/admin/dogs/lookups/use-admin-dog-color-options-query.ts
- docs/features/admin-dog-management.md
- docs/features/beagle-dog-profile.md
- docs/features/schema/schema.md
- docs/legacy-import/phase1.md
- packages/contracts/admin/dogs/lookups/lookup-options.ts
- packages/contracts/admin/dogs/manage/admin-dogs-list.ts
- packages/contracts/admin/dogs/manage/create-admin-dog.ts
- packages/contracts/admin/dogs/manage/update-admin-dog.ts
- packages/db/admin/dogs/lookups/list-color-options.ts
- packages/db/prisma/migrations/20260506120000_add_dog_colors/migration.sql
- packages/db/prisma/schema.prisma
- packages/server/admin/dogs/lookups/list-color-options.ts
- packages/server/admin/dogs/manage/create-dog.ts
- packages/server/admin/dogs/manage/update-dog.ts
- packages/server/imports/phase1/run-legacy-phase1.ts
- related tests and index exports

ref bej-107
  - cover the admin dog color lookup service, action wrapper, and query hook
  - verify auth, success, and failure branches so the coverage gate passes

ref bej-107
@asku1990 asku1990 force-pushed the feature/bej-107-import-dog-color-details branch from 464dc59 to b29634a Compare June 22, 2026 19:32
  Seed and expose a canonical dog color catalog with status metadata, use it for
  admin selection and profile display, and preserve legacy hidden colors during
  updates and phase 1 import.

ref bej-107
@asku1990 asku1990 marked this pull request as ready for review June 23, 2026 17:55
Comment thread packages/server/admin/dogs/manage/internal/manage-responses.ts Outdated
Comment thread packages/server/admin/dogs/manage/create-dog.ts Outdated
Comment thread packages/server/admin/dogs/manage/update-dog.ts Outdated
Comment thread packages/server/imports/phase1/__tests__/run-legacy-phase1.test.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 5 Issues Found | Recommendation: Address before merge

Overview

Severity Count
WARNING 3
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
packages/db/prisma/migrations/20260506120000_add_dog_colors/migration.sql 13 CREATE INDEX without CONCURRENTLY on populated Dog table causes table lock
packages/server/admin/dogs/manage/internal/manage-responses.ts 112 "Color code was not found." is misleading for format validation failures
packages/server/admin/dogs/manage/create-dog.ts 108 "Color code is not selectable." conflates not-found and hidden statuses
packages/server/admin/dogs/manage/update-dog.ts 150 "Color code is not selectable." conflates not-found and hidden statuses

SUGGESTION

File Line Issue
packages/server/imports/phase1/__tests__/run-legacy-phase1.test.ts 125 Leftover dogColors: [] mock field does not match actual LegacyPhase1Rows type (also lines 232, 282, 335, 374, 432)
Files Reviewed (4 files)
  • packages/db/prisma/migrations/20260506120000_add_dog_colors/migration.sql - 1 issue
  • packages/server/admin/dogs/manage/internal/manage-responses.ts - 1 issue
  • packages/server/admin/dogs/manage/create-dog.ts - 1 issue
  • packages/server/admin/dogs/manage/update-dog.ts - 1 issue
  • packages/server/imports/phase1/__tests__/run-legacy-phase1.test.ts - 1 issue

Reply with @kilocode-bot fix it to have Kilo Code address these issues.

Previous Review Summaries (2 snapshots, latest commit ddc1b7f)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit ddc1b7f)

Status: 5 Issues Found | Recommendation: Address before merge

Overview

Severity Count
WARNING 3
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
packages/db/prisma/migrations/20260506120000_add_dog_colors/migration.sql 13 CREATE INDEX without CONCURRENTLY on populated Dog table causes table lock
packages/server/admin/dogs/manage/internal/manage-responses.ts 112 "Color code was not found." is misleading for format validation failures
packages/server/admin/dogs/manage/create-dog.ts 108 "Color code is not selectable." conflates not-found and hidden statuses
packages/server/admin/dogs/manage/update-dog.ts 150 "Color code is not selectable." conflates not-found and hidden statuses

SUGGESTION

File Line Issue
packages/server/imports/phase1/__tests__/run-legacy-phase1.test.ts 125 Leftover dogColors: [] mock field does not match actual LegacyPhase1Rows type (also lines 232, 282, 335, 374, 432)
Files Reviewed (4 files)
  • packages/db/prisma/migrations/20260506120000_add_dog_colors/migration.sql - 1 issue
  • packages/server/admin/dogs/manage/internal/manage-responses.ts - 1 issue
  • packages/server/admin/dogs/manage/create-dog.ts - 1 issue
  • packages/server/admin/dogs/manage/update-dog.ts - 1 issue
  • packages/server/imports/phase1/__tests__/run-legacy-phase1.test.ts - 1 issue

Reply with @kilocode-bot fix it to have Kilo Code address these issues.

Previous review (commit 3c6a8d2)

Status: 5 Issues Found | Recommendation: Address before merge

Overview

Severity Count
WARNING 3
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
packages/db/prisma/migrations/20260506120000_add_dog_colors/migration.sql 13 CREATE INDEX without CONCURRENTLY on populated Dog table causes table lock
packages/server/admin/dogs/manage/internal/manage-responses.ts 112 "Color code was not found." is misleading for format validation failures
packages/server/admin/dogs/manage/create-dog.ts 108 "Color code is not selectable." conflates not-found and hidden statuses
packages/server/admin/dogs/manage/update-dog.ts 150 "Color code is not selectable." conflates not-found and hidden statuses

SUGGESTION

File Line Issue
packages/server/imports/phase1/__tests__/run-legacy-phase1.test.ts 125 Leftover dogColors: [] mock field does not match actual LegacyPhase1Rows type (also lines 232, 282, 335, 374, 432)
Files Reviewed (4 files)
  • packages/db/prisma/migrations/20260506120000_add_dog_colors/migration.sql - 1 issue
  • packages/server/admin/dogs/manage/internal/manage-responses.ts - 1 issue
  • packages/server/admin/dogs/manage/create-dog.ts - 1 issue
  • packages/server/admin/dogs/manage/update-dog.ts - 1 issue
  • packages/server/imports/phase1/__tests__/run-legacy-phase1.test.ts - 1 issue

Reply with @kilocode-bot fix it to have Kilo Code address these issues.


Reviewed by step-3.7-flash-20260528 · Input: 268.3K · Output: 17.7K · Cached: 790.8K

asku1990 added 2 commits June 23, 2026 21:18
  Replace the React Query Server Action path with a canonical admin API route,
  keep the server use case as the source of business logic, and remove the now-
  unused color lookup action.

  Files:
  - apps/web/app/actions/admin/dogs/lookups/__tests__/get-admin-dog-color-options.test.ts
  - apps/web/app/actions/admin/dogs/lookups/get-admin-dog-color-options.ts
  - apps/web/app/api/admin/dogs/lookups/colors/__tests__/route.test.ts
  - apps/web/app/api/admin/dogs/lookups/colors/route.ts
  - apps/web/queries/admin/dogs/lookups/__tests__/use-admin-dog-color-options-query.test.ts
  - apps/web/queries/admin/dogs/lookups/use-admin-dog-color-options-query.ts
  - packages/api-client/admin/dogs/__tests__/admin-dogs.test.ts
  - packages/api-client/admin/dogs/create-admin-dogs-api-client.ts
  - packages/api-client/admin/dogs/index.ts
  - packages/api-client/admin/dogs/list-admin-dog-color-options.ts

ref bej-107
@asku1990

asku1990 commented Jun 24, 2026

Copy link
Copy Markdown
Owner Author

Manual Testing Checklist

Database & Import

  • Migration runs successfully
  • DogColor table seeded correctly
  • SELECTABLE colors exist
  • HIDDEN colors exist
  • LEGACY_UNKNOWN colors exist
  • Existing imported dogs retain their color codes
  • Unknown legacy codes are imported as legacy unknown values

Admin - Create Dog

  • Open Admin → Dogs → Add Dog
  • Color dropdown loads successfully
  • Only selectable colors appear in dropdown
  • Create dog with color 121 (Kolmivärinen)
  • Dog saves successfully
  • Color is visible in admin list
  • Color is visible in admin profile
  • Color is visible in public profile
  • Create dog without color
  • Dog saves successfully without color

Admin - Edit Dog

  • Edit dog with selectable color
  • Change color and save
  • Updated color is displayed correctly

Hidden Color Preservation

  • Open imported dog with hidden color
  • Hidden color is displayed correctly
  • Modify another field
  • Save succeeds
  • Original hidden color remains unchanged
  • Hidden color is not available in create form dropdown

Legacy Unknown Preservation

  • Open imported dog with legacy unknown color
  • Legacy unknown value is displayed correctly
  • Modify another field
  • Save succeeds
  • Original legacy unknown value remains unchanged

Validation & Security

  • Create dog with valid selectable color succeeds
  • Hidden color selection is rejected
  • Legacy unknown color selection is rejected
  • Non-existent color code is rejected
  • Invalid color code (0, negative, text) is rejected

Public Profile

  • Color visible on public dog profile
  • Finnish translation displayed correctly
  • Swedish translation displayed correctly
  • Dog without color renders correctly
  • No UI regressions observed

Regression Testing

  • Dog search works
  • Dog list loads correctly
  • Dog create works
  • Dog update works
  • Parent selection works
  • Owner selection works
  • Registration handling works
  • Historical trial/show linking unaffected

Quality Checks

  • Typecheck passes
  • Tests pass
  • Lint passes
  • CI passes

@asku1990 asku1990 merged commit ca3a7a6 into develop Jun 24, 2026
5 checks passed
@asku1990 asku1990 deleted the feature/bej-107-import-dog-color-details branch June 24, 2026 15:42
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.

1 participant