Skip to content

Change the default artifact to None#526

Merged
sdglitched merged 1 commit intomainfrom
naan
Apr 12, 2026
Merged

Change the default artifact to None#526
sdglitched merged 1 commit intomainfrom
naan

Conversation

@gridhead
Copy link
Copy Markdown
Owner

@gridhead gridhead commented Apr 5, 2026

Change the default artifact to None

Fixes #499

Summary by Sourcery

Set the placeholder "None" artifact as the default selection and align UI behavior, tests, and CI configuration with that behavior.

Bug Fixes:

  • Ensure wiping artifacts or teams correctly triggers UI updates even when the artifact type is already set to "None".

Enhancements:

  • Promote the "None" artifact entry in the artifact registry so it becomes the default artifact.
  • Simplify test artifact selection by iterating directly over the artifact registry keys instead of using .keys().

Build:

  • Configure tox environments to run Qt-based tests in offscreen mode via QT_QPA_PLATFORM=offscreen.

Tests:

  • Update artifact, team, and output tests to expect the "None" artifact with Star 0 rarity and to explicitly set artifact types before save/fail scenarios.

@gridhead gridhead added this to the Luna VI milestone Apr 5, 2026
@gridhead gridhead requested a review from sdglitched April 5, 2026 03:59
@gridhead gridhead self-assigned this Apr 5, 2026
@gridhead gridhead added the bug Something isn't working label Apr 5, 2026
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 5, 2026

Reviewer's Guide

Make the 'None' artifact the default option in the registry and UI, adjust tests to expect/drive this new default behavior, ensure wipe operations emit the appropriate Qt signals when already on 'None', and configure Qt to run offscreen in tox.

Sequence diagram for wiping an artifact and ensuring Qt signal emission

sequenceDiagram
    actor User
    participant WindRule as WindRule
    participant QtCombo as QtComboBox_arti_part_type

    User->>WindRule: wipe_artifact(part)
    WindRule->>QtCombo: getattr(self, arti_part_type)
    WindRule->>QtCombo: currentText()
    alt currentText is None
        WindRule->>QtCombo: currentTextChanged.emit(None)
    else currentText is not None
        WindRule->>QtCombo: setCurrentText(None)
    end
Loading

Sequence diagram for wiping a team of artifact slots

sequenceDiagram
    actor User
    participant WindRule as WindRule
    participant QtCombo_fwol as QtComboBox_arti_fwol_type
    participant QtCombo_pmod as QtComboBox_arti_pmod_type
    participant QtCombo_sdoe as QtComboBox_arti_sdoe_type
    participant QtCombo_gboe as QtComboBox_arti_gboe_type
    participant QtCombo_ccol as QtComboBox_arti_ccol_type

    User->>WindRule: wipe_team()
    loop for each slot in [fwol, pmod, sdoe, gboe, ccol]
        WindRule->>QtCombo_fwol: currentText() / currentTextChanged.emit or setCurrentText(None)
        WindRule->>QtCombo_pmod: currentText() / currentTextChanged.emit or setCurrentText(None)
        WindRule->>QtCombo_sdoe: currentText() / currentTextChanged.emit or setCurrentText(None)
        WindRule->>QtCombo_gboe: currentText() / currentTextChanged.emit or setCurrentText(None)
        WindRule->>QtCombo_ccol: currentText() / currentTextChanged.emit or setCurrentText(None)
    end
Loading

Flow diagram for artifact registry defaulting to None

flowchart TB
    subgraph ArtifactModule
        A[Import none artifact module]
        B[Import all other artifact modules]
        C[Define ArtifactTeam for none]
        D[Populate artilist dict]
    end

    A --> C
    B --> D
    C --> D

    subgraph ArtiListDict[__artilist__]
        N[Key none.team.__teamname__ mapped first]
        O[Other artifact teams mapped after]
    end

    D --> N
    D --> O
Loading

File-Level Changes

Change Details Files
Make the 'None' artifact the default artifact in the registry and adjust uses/tests accordingly.
  • Move the 'none' ArtifactTeam entry to the top of the artifact registry dictionary so it becomes the default option.
  • Simplify iteration over artifact names in tests by iterating directly over artilist instead of artilist.keys().
  • Update tests that previously assumed a specific non-default artifact and rarity to now expect 'None' and 'Star 0' as the default type/rarity and 'None' for level.
  • Add test setup steps to explicitly select non-'None' artifact types in tests that require a non-default artifact.
gi_loadouts/data/arti/__init__.py
test/face/wind/arti/test_arti_file.py
test/face/wind/team/test_team_file.py
test/face/otpt/test_otpt.py
Ensure wiping artifacts/teams correctly triggers UI updates when already set to 'None'.
  • Modify wipe_artifact to emit the currentTextChanged signal with 'None' when the dropdown is already on 'None', otherwise setCurrentText('None').
  • Apply the same conditional signal emission strategy to wipe_team across all artifact dropdowns, marking the non-signal branch as no-cover for tests.
gi_loadouts/face/wind/rule.py
Make Qt tests runnable in headless environments via tox.
  • Set QT_QPA_PLATFORM=offscreen in the default testenv and py312/py313-dist tox environments to allow Qt to operate without a display server.
tox.ini

Assessment against linked issues

Issue Objective Addressed Explanation
#499 Set the default selected artifact in the UI to the special None artifact instead of the first real artifact in the list.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • If other code depends on the first entry of __artilist__ as the default artifact, consider making that dependency explicit (e.g., a DEFAULT_ARTIFACT constant or a dedicated accessor) instead of relying on dictionary insertion order for clarity and robustness.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- If other code depends on the first entry of `__artilist__` as the default artifact, consider making that dependency explicit (e.g., a `DEFAULT_ARTIFACT` constant or a dedicated accessor) instead of relying on dictionary insertion order for clarity and robustness.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request relocates the none.team.teamname entry within the artilist dictionary in gi_loadouts/data/arti/init.py from the end to the beginning. I have no feedback to provide.

@gridhead gridhead force-pushed the naan branch 2 times, most recently from f458153 to bfdd432 Compare April 5, 2026 05:28
@gridhead gridhead marked this pull request as draft April 5, 2026 05:40
@gridhead gridhead marked this pull request as ready for review April 5, 2026 05:58
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In wipe_artifact and wipe_team, consider simplifying the currentText == "None" special-case and direct currentTextChanged.emit("None") logic, or at least add a brief comment explaining why bypassing setCurrentText("None") is required here, since Qt normally emits the signal on setCurrentText and this branch may be surprising to future maintainers.
  • Several of the tests now use standalone triple-quoted strings (e.g. in test_arti_save_fail, test_team_save_fail, test_otpt_fail) purely as comments; replacing these with # comments would avoid creating no-op string literals and keep intent clearer.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `wipe_artifact` and `wipe_team`, consider simplifying the `currentText == "None"` special-case and direct `currentTextChanged.emit("None")` logic, or at least add a brief comment explaining why bypassing `setCurrentText("None")` is required here, since Qt normally emits the signal on `setCurrentText` and this branch may be surprising to future maintainers.
- Several of the tests now use standalone triple-quoted strings (e.g. in `test_arti_save_fail`, `test_team_save_fail`, `test_otpt_fail`) purely as comments; replacing these with `#` comments would avoid creating no-op string literals and keep intent clearer.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Signed-off-by: Akashdeep Dhar <akashdeep.dhar@gmail.com>
Copy link
Copy Markdown
Collaborator

@sdglitched sdglitched left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Nice catching the long-lived problem.

@sdglitched sdglitched merged commit 76c3e4d into main Apr 12, 2026
7 checks passed
gridhead pushed a commit that referenced this pull request Apr 12, 2026
Change the default artifact to `None`
@gridhead gridhead deleted the naan branch April 15, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Change the default artifact to None

2 participants