Skip to content

feat(helpers): add get_omicron_breakdown for guild-wide omicron adoption - #265

Merged
MarTrepodi merged 3 commits into
developfrom
feat/guild-omicron-breakdown
Nov 10, 2026
Merged

MarTrepodi merged 3 commits into
developfrom
feat/guild-omicron-breakdown

Conversation

@MarTrepodi

Copy link
Copy Markdown
Collaborator

Description

Adds get_omicron_breakdown(), which summarises omicron adoption across a set of player profiles, grouped by game mode. Every omicron skill in game data becomes a row that splits the players into three groups:

  • those who have applied it;
  • those who own the unit but have not applied it;
  • a count of those who do not own the unit.

This answers "who in the guild can still apply this omicron?" in one call.

How it decides

  • Omicron: a skill is an omicron when one of its tiers is flagged isOmicronTier, never because of its omicronMode. Mode 1 (ALL_OMICRON) is the value every skill without an omicron carries.
  • Mode: read as a number whether game data was fetched with enums=False or enums=True, through parse_enum and the OmicronMode members. The bare and type-prefixed names both work. A mode name the library does not know yet is kept as sent. Labels default to OMICRON_MODE and can be overridden with mode_names.
  • Ownership: a player owns a unit when it is in their roster. Many omicron skills are referenced by several base IDs: the playable unit, a non-obtainable PVE_ mirror and sometimes an event variant. Playable units (get_playable_units) claim their skills first, so owners are not reported as non-owners. A skill missing from an owner's roster is locked behind a star level, which is not evidence that they don't own the unit.
  • Names: an optional ability_list names each omicron from the ability its skill references. A skill's own nameKey is a placeholder shared across unrelated skills, and a unit often has several omicrons in one mode (Doctor Aphra has three in 5v5 Grand Arena). Unit and omicron names are localized when a localization dictionary is passed.

Results are TypedDicts (OmicronBreakdown, OmicronModeBreakdown, OmicronSkillStats, OmicronMember), like the other helper results.

The separate fix(helpers): accept tier 0 in is_omicron_skill commit

  • is_omicron_skill() treated a tier of 0 as missing and raised, both for roster_unit_skill and for a skill_tier passed directly.
  • Tier 0 is the value a newly unlocked skill carries, and a skill whose only tier is its omicron has the omicron at index 0. Only a missing tier is now an error.
  • The bug turned up while building the breakdown, but it is a fix to an existing public helper. Keeping it as its own fix commit gives it its own changelog entry, separate from the new feature.

Examples

  • examples/Sync/guild_omicron_breakdown.py and examples/Async/guild_omicron_breakdown.py list a guild's members with get_guild_members() and fetch every profile (concurrently with asyncio.TaskGroup in the Async one).
  • They request only the skill, units and ability collections, by combining DataItems bits with |.
  • They print the top omicrons per mode, then the members who own the unit behind the biggest unapplied omicron.
  • Both are listed in the example READMEs, docs/examples.md and the README.

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

Testing

Automated

  • Unit tests are parametrized tables covering:
    • which players fall into each group: applied, one tier short, star-gated, unit not owned, no roster, tier left out, owning unit unknown;
    • mode reading: numbers, enums=True names, type-prefixed names, numeric strings, an unknown name, a missing mode, custom labels;
    • picking the playable unit over PVE_ mirrors and event variants, including an enums=True rarity;
    • name resolution;
    • input validation.
  • uv run pytest tests/: 2033 passed, 31 skipped.
  • uv run ruff check and uv run ruff format --check on src/ tests/ examples/ parity/, uv run ty check src/swgoh_comlink/, uv run python .github/scripts/unasync.py --check and uv run mkdocs build --strict all pass.

Live, against the public Comlink release (spec 0.40.5), read-only calls only

  • Both examples ran for a guild, and the Sync and Async reports were identical.
  • An independent recount from the raw rosters matched the helper on every omicron row: owners, applied count and resolved unit.
  • The breakdown built from enums=True game data was identical to the one built from enums=False game data.

🤖 Generated with Claude Code

MarTrepodi and others added 3 commits November 9, 2026 13:55
is_omicron_skill treated a tier of 0 as missing and raised, both for a
roster_unit_skill and for a skill_tier passed directly. Tier 0 is the
value a freshly unlocked skill carries, and a skill whose only tier is
its omicron has the omicron at index 0, so only a missing tier is now an
error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summarise omicron adoption across a set of player profiles, grouped by
game mode. Every omicron skill in game data becomes a row that splits
the players into those who have applied it, those who own the unit but
have not, and a count of those who do not own the unit.

A skill is an omicron when one of its tiers is flagged isOmicronTier,
never because of its omicronMode: mode 1 (ALL_OMICRON) is the value
every skill without an omicron carries. The mode is read as a number
whether the game data was fetched with enums=False or enums=True,
including the type-prefixed spelling, through parse_enum and the
OmicronMode members; a mode name the library does not know yet is kept
as given. Labels default to OMICRON_MODE and can be overridden.

Ownership is a property of the unit, resolved through the unit that can
be in a roster. Many omicron skills are referenced by several base IDs,
a playable unit plus a non-obtainable PVE_ mirror and sometimes an event
variant, so playable units (get_playable_units, which also reads an
enums=True rarity) claim their skills first. A skill missing from an
owner's roster is star-gated, not evidence of non-ownership, and a
listed skill without a tier is at tier 0.

An optional ability_list names each omicron from the ability its skill
references; a skill's own nameKey is a placeholder shared across
unrelated skills, and a unit often has several omicrons in one mode.
Unit and omicron names are localized through _localize.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a Sync and an Async guild_omicron_breakdown.py that report omicron
adoption across a guild by game mode. Both list the members with
get_guild_members(), fetch every member's profile (concurrently with
asyncio.TaskGroup in the Async one), request only the skill, units and
ability collections by combining DataItems bits with |, and print the
top omicrons per mode followed by the members who own the unit behind
the biggest unapplied omicron.

List both in the examples READMEs, docs/examples.md and the README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation code testing labels Nov 9, 2026
@MarTrepodi
MarTrepodi merged commit 0783d9e into develop Nov 10, 2026
12 checks passed
@MarTrepodi
MarTrepodi deleted the feat/guild-omicron-breakdown branch November 10, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code documentation Improvements or additions to documentation testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant