feat(pet): BodyGene 9→34 — 解鎖 25 個原本無法顯示的家族#106
Merged
Conversation
Found while verifying the auto-generated hamster in the app: SpeciesCatalog defines 34 families (and the asset pipeline + variant-rarity tags like `pig-boar` target them), but BodyGene had only 9 cases. `resolvedSpeciesID` keys on `body.rawValue`, so the other 25 families (cow, deer, duck, fox, hamster, …, wolf) could NEVER be selected by any pet — 229 bundled zips (71% of the bundle, incl. 32 with v5 walk/idle animation) were unreachable dead assets. - BodyGene: +25 cases so every catalog family is hatchable. - displayName: +25 zh-Hant台灣用語 names. - defaultSpeciesID: +25 (each family's first catalogued variant; BodyGeneMappingTests pins that each resolves). - from(personalityGene:): refactored to a weighted table over allCases — cat stays dominant (best v5 coverage), the 8 core families common, the 25 expansion families a ~1.4%-each reachable tail. Auto-scales on future adds. - PetBehaviorProviderFactory: a `default:` → new GenericBehavior (grounded walker) for the expansion families; bespoke behaviours can come later. Note: many expansion families ship v4 rotation-only assets, so those pets render the correct species statically (renderer's 1-frame fallback) until v5 animations are generated; partial-coverage stages fall back gracefully. Tests: count 9→34; replaced brittle hatch-band asserts with a sweep proving every family is hatchable; new test_everyCatalogFamilyHasABodyGene regression guard so a future catalog family can't silently become unreachable again. Decoder-throws test now uses a genuinely-unknown string. PeerDropPet 495/0; iOS build green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
驗證自動生成的倉鼠時發現的重大缺口:
SpeciesCatalog定義 34 個家族(資產 pipeline +pig-boar等稀有度標記都瞄準它們),但BodyGene只有 9 個 case。resolvedSpeciesID用body.rawValue→ 其餘 25 個家族(cow/deer/duck/fox/hamster/…/wolf)任何寵物都選不到 —— 229 個 bundled zip(占 bundle 71%,含 32 個已有 v5 動畫)是無法顯示的死資產。內容
BodyGeneMappingTests釘住每個都 resolve)from(personalityGene:):重構成allCases加權表 —— cat 維持主導(v5 覆蓋最好)、8 個 core 家族常見、25 個擴充家族 ~1.4%/個的可達尾巴。未來加 case 自動擴展PetBehaviorProviderFactory:default:→ 新GenericBehavior(接地行走);bespoke 行為日後再加注意
許多擴充家族只有 v4(旋轉-only)資產,所以那些寵物會靜態顯示正確 species(renderer 1-frame fallback),等 v5 動畫生成後才會動;缺的 stage 優雅 fallback。
測試
count 9→34;脆弱的 hatch-band 斷言換成「sweep 證明每個家族可孵化」;新增
test_everyCatalogFamilyHasABodyGene回歸守衛(未來 catalog 家族不能再悄悄變不可達)。PeerDropPet 495/0、iOS build 綠。🤖 Generated with Claude Code