Skip to content

fix(fleet): support selector rules and disambiguate same-name ships#420

Merged
veadex merged 8 commits intomainfrom
fix/fleet-rules-search-name-disambiguation
Apr 13, 2026
Merged

fix(fleet): support selector rules and disambiguate same-name ships#420
veadex merged 8 commits intomainfrom
fix/fleet-rules-search-name-disambiguation

Conversation

@yltx
Copy link
Copy Markdown
Contributor

@yltx yltx commented Apr 12, 2026

Summary

  • add FleetRuleRequest and plan.fleet_rules support in task schemas/routes
  • propagate fleet_rules through normal/event fight ops and preparation flow
  • enhance fleet change algorithm with selector-aware matching, refill, and occupied-slot handling
  • support search_name in choose-ship flow to disambiguate same-name ships (e.g. 大淀 variants)
  • bump package version to 2.1.9.post5

Why

Frontend now sends slot-level fleet selector rules (candidates/search_name). Without backend support, same-name ships can be treated as already matched and fail to replace, causing repeated fleet setup failures.

Validation

  • local static check on modified files passed
  • branch pushed and ready for review

Copilot AI review requested due to automatic review settings April 12, 2026 02:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds backend support for slot-level fleet selector rules (candidates/search_name/level range) and improves fleet-changing + ship-choosing logic to handle same-name ships and selector-driven matching, then propagates the new fleet_rules field through server schemas/routes into normal/event fight preparation. It also bumps the package version.

Changes:

  • Add FleetRuleRequest + plan.fleet_rules to task request schemas and route overrides.
  • Enhance fleet-change flow to be selector-aware (candidate reuse, one-to-one matching, refill/occupied-slot handling) and extend choose-ship flow with search_name + optional level filtering.
  • Update ship-list OCR utilities to support optional name de-duplication disabling and row-level keys for correlating name ↔ level OCR results.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
autowsgr/ui/utils/ship_list.py Extends row OCR helpers with optional de-dupe control and row keys to support same-name disambiguation + level correlation.
autowsgr/ui/choose_ship_page.py Adds selector-aware choose-ship logic (search_name/candidates/min-max level) and returns the selected name.
autowsgr/ui/battle/fleet_change/_change.py Updates fleet change algorithm to support selector rules, avoid same-name false matches, and handle refill/occupied-slot cases.
autowsgr/server/schemas.py Introduces FleetRuleRequest and CombatPlanRequest.fleet_rules request schema support.
autowsgr/server/routes/task.py Propagates fleet_rules overrides from requests into fight runners.
autowsgr/ops/normal_fight.py Accepts/propagates fleet_rules into preparation flow and resolves ship names post-change.
autowsgr/ops/event_fight.py Same as normal fight, for event fights.
autowsgr/__init__.py Version bump to 2.1.9.post5.
Comments suppressed due to low confidence (1)

autowsgr/ui/utils/ship_list.py:271

  • read_ship_levels() now optionally appends row_key to each entry, but the debug log still unpacks found as (n, lv) pairs. When include_row_key=True (used by ChooseShipPage._click_ship_in_list for level filtering), this will raise ValueError: too many values to unpack and break ship selection. Update the debug formatting to index into the tuple (e.g., entry[0], entry[1]) or branch on tuple length.
    _log.debug(
        '[选船列表] 等级识别: {}',
        [(n, lv) for n, lv in found],
    )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@veadex veadex merged commit 161b844 into main Apr 13, 2026
0 of 2 checks passed
@veadex veadex deleted the fix/fleet-rules-search-name-disambiguation branch April 13, 2026 05:49
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.

3 participants