Skip to content

fix(statcalc): build units that start above one star - #197

Merged
MarTrepodi merged 1 commit into
developfrom
fix/statcalc-units-without-one-star
Oct 22, 2026
Merged

MarTrepodi merged 1 commit into
developfrom
fix/statcalc-units-without-one-star

Conversation

@MarTrepodi

Copy link
Copy Markdown
Collaborator

Summary

GameDataBuilder dropped ADELPHIRANGER from unitData. It is the only obtainable unit with no ONE_STAR definition (it starts at 2★), and the builder only took a unit's base definition from its rarity-1 row. Its growth tables were collected, but no unit entry was ever created.

The base definition is now each unit's lowest-rarity row:

 for unit in obtainable_units:
     record statProgressionId under unit.rarity
-    if rarity == 1:
+    if 0 < rarity < lowest rarity seen for this baseId:
         base_units[baseId] = unit
  • The fields the builder reads (skills, gear tiers, relics, categories, crew) are identical across rarities in live data. Only basePower and promotionRecipeReference differ. So output for every unit that does have a 1★ row is unchanged.
  • The 0 < guard keeps unknown rarity enums (normalised to 0) out of the base, as before.

Evidence

  • Before: the new test_unit_without_one_star_row_uses_lowest_rarity_as_base fails 6/6 (character and ship × ascending, descending and enum rarities). A live build returns 412 units with no ADELPHIRANGER.
    After: 6/6 pass and the full unit suite passes (1556). Live builds against a Comlink instance, sync and async, return 413 units. ADELPHIRANGER has growth tables for 2★–7★, 4 skills and 13 gear tiers. calc_char_stats at 7★ / L85 / G13 gives GP 14,145, Strength 1,498, Speed 145.

Not verified: the stat values themselves. There was no swgoh-stats service to compare against.

Merge Danger

Door: two-way. A single-function change with no data or API changes; reverting it is clean.

Blast Radius: narrow. Only _build_unit_data changes, and only units without a 1★ row get new output.

Related Issues

None.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactor (code change that neither fixes a bug nor adds a feature)
  • Performance improvement
  • Documentation
  • Tests
  • CI / build / dependencies

Checklist

  • This PR targets the develop branch (only release PRs target main)
  • My commits follow the Conventional Commits / Angular convention (feat:, fix:, refactor:, etc.) — they become the changelog
  • I have not edited CHANGELOG.md by hand (it is generated from commit messages)
  • I have added/updated docstrings with type hints for any new or changed public methods
  • I have updated the docs (README.md, docs/, examples/) if user-facing behavior changed
  • I have added unit tests that cover my changes (mocked, not requiring a live comlink service)
  • Tests pass (uv run pytest tests/)
  • Ruff linter and formatter pass (uv run ruff check src/ tests/ and uv run ruff format --check src/ tests/)
  • Type check passes (uv run ty check src/swgoh_comlink/)
  • I have not bundled unrelated changes in this PR

🤖 Generated with Claude Code

GameDataBuilder only promoted a unit's rarity-1 definition to its base
entry, so a unit with no ONE_STAR row was silently dropped from
unitData even though its growth tables were collected. ADELPHIRANGER
starts at 2 stars and was missing as a result.

Use each unit's lowest-rarity definition as its base instead. The
fields the builder reads (skills, gear tiers, relics, categories, crew)
are identical across rarities, so this is equivalent for every unit
that does have a 1-star row. Unknown rarity enums (normalised to 0)
are still ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MarTrepodi
MarTrepodi merged commit 2ace9ad into develop Oct 22, 2026
16 checks passed
@MarTrepodi
MarTrepodi deleted the fix/statcalc-units-without-one-star branch October 22, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant