Agents Builders

Cache primary type on Pokemon

Archived
cache-pokemon-primary-type

Created

Jun 26, 02:31

Started

Jun 26, 02:32

Completed

Jun 26, 03:16

DevOps handoff

Type

Feature

Shape

backend

Worktree Slug

cache-pokemon-primary-type

Repositories

mcritchie-studio

Release Train

Branch

feat/cache-pokemon-primary-type

Local URL

QA URL

Production URL

backend data seed-migration

Acceptance Criteria

  • Add primary_type column to pokemons table
  • Pokemon.assign_primary_types! computes and persists primary_type
  • primary_type equals the least-common identifying type
  • Seed sets primary_type; re-runnable when roster grows
  • Color helpers read primary_type; rendered colors unchanged

Expected Test Plan

  • [unit] Pokemon.assign_primary_types! + signature cache reads
  • [integration] full seed 56/57/58 → 151 cached, colors unchanged

Checks Run

  • [unit] pokemon_test: assign_primary_types! caches/idempotent/no-op; signature reads cache
  • [integration] seed 56+57+58 → all 151 cached, Pidgeot=flying, color unchanged
  • [full-suite@0b942db33a4b31770ca197f00467937969ca4067] bin/rails test green
  • [rubocop@0b942db33a4b31770ca197f00467937969ca4067] bin/rubocop clean
  • [post-deploy] bin/rails pokemon:seed on mcritchie-studio-qa → ok (2026-06-26T03:06:18Z)
  • [post-deploy] bin/rails pokemon:seed on mcritchie-studio → ok (2026-06-26T03:15:57Z)

Agent Context

Denormalize the signature/identifying type onto pokemons.primary_type so color-based lookups (signature_color, statusline mascot tint, /pokemon badges) read a cached column instead of recomputing max_by(rank) over type_enumerals each call. primary_type = the LEAST-COMMON of a Pokemon's types (the rarer/identifying side: Pidgeot normal/flying -> flying), which is exactly today's signature behavior, so rendered colors must NOT change (pure denormalization). Class method Pokemon.assign_primary_types! does the compute+persist for all rows (idempotent, re-runnable when the roster grows beyond gen-1). Seed (new db/seeds/58_*, after 56 pokemon + 57 type ranks) calls it so it's a one-time calc baked into rows. signature_enumeral/_type/_color read primary_type with a computed fallback for un-backfilled rows. Wire pokemon:seed (the post_deploy_cmd) to run assign_primary_types! so prod backfills on deploy. Tests: Pidgeot->flying, single-type->itself, idempotent re-run, signature_color==type_color(primary_type), all 151 populated after seed.

Stage Timeline

Who handled each stage, the time it took (measured), and the model / tokens / cost reported (best-effort) — plus who's on it right now. means the agent didn't report that metric.

Sizing Avi · PO Dev Actual XL
  1. Created Designed
    P Pidgeot
    Pidgeot
    Model
    Duration
    Tokens
    Cost
    Completed Jun 26, 02:31 · 1 day ago
    api
  2. Designed Building
    P Pidgeot
    Pidgeot
    Model
    claude-opus-4-8
    Duration
    under a minute
    Tokens
    Cost
    Started Jun 26, 02:31
    Completed Jun 26, 02:32 · 1 day ago
    cli
  3. Building Submitted
    P Pidgeot
    Pidgeot
    Model
    claude-opus-4-8
    Duration
    12 minutes
    Tokens
    26,709,548
    Cost
    ~$17.23
    Started Jun 26, 02:32
    Completed Jun 26, 02:44 · 1 day ago
    cli
  4. Submitted Reviewed
    C Carl
    Carl primary
    S Shannon
    Shannon light
    Model
    claude-opus-4-8
    Duration
    17 minutes
    Tokens
    9,208,685
    Cost
    ~$5.50
    Started Jun 26, 02:44
    Completed Jun 26, 03:01 · 1 day ago
    cli
  5. Reviewed Assembled
    S Steffon
    Steffon
    Model
    claude-opus-4-8
    Duration
    1 minute
    Tokens
    2,580,954
    Cost
    ~$1.49
    Started Jun 26, 03:01
    Completed Jun 26, 03:02 · 1 day ago
  6. Assembled Shipped
    A Avi
    Avi
    Model
    claude-opus-4-8
    Duration
    13 minutes
    Tokens
    13,555,036
    Cost
    ~$7.62
    Started Jun 26, 03:02
    Completed Jun 26, 03:16 · 1 day ago
  7. Shipped Archived
    Model
    Duration
    about 15 hours
    Tokens
    Cost
    Started Jun 26, 03:16
    Completed Jun 26, 18:43 · about 15 hours ago

Conversation

QA review feedback, agent handoffs, and follow-up notes for this task.

No task feedback has been recorded yet.

Sealed-bid sizing

Edit →

Alex (PM)

Avi (PO)

Dev

Actual

XL