Skip to content

Remove redundant helpers, dead code, and single-use indirection - #1341

Merged
Vysp3r merged 7 commits into
Vysp3r:mainfrom
Quinta0:simplify-collection-copies
Nov 21, 2026
Merged

Vysp3r merged 7 commits into
Vysp3r:mainfrom
Quinta0:simplify-collection-copies

Conversation

@Quinta0

@Quinta0 Quinta0 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem and change

The provider models and launch-options editor hand-rolled array copies and
array-contains loops that Gee and Vala already provide, and an
over-engineering pass found dead classes, unobserved signals, and single-use
indirection. This PR removes them without changing behavior.

Stdlib/native replacements

  • Provider models: replace nine hand-written copy loops with Gee
    to_array () / add_all_array () and Vala's implicit array duplication.
    The generated C still emits _vala_array_dup in owned getters, so callers
    keep receiving defensive copies.
  • Launch-options editor: replace five private array-contains helpers with
    Vala's in operator.

Dead code and indirection

  • Delete unused Models.Steam (SteamLibraryConfig, LibraryFolder).
  • Inline TinkerGameContext into InstallJob.tinker_game_install_location.
  • Fold InstallationLifecycleRecorder into a virtual no-op on
    InstallationOperationCoordinator, removing three as casts.
  • Share immutable VariantDefinition objects instead of rebuilding them on
    every get_variants () call, including the new ReleaseVariantSet, and
    drop the now-unused VariantDefinition.copy (). Arrays are still copied.
  • Drop run_command_sync (duplicate of run_command_sync_result), the
    convert_bytes_to_string (→ GLib.format_size) and
    Asset.is_archive_name pass-throughs, two signals nothing connects to,
    and commented-out code.

Net: about 160 fewer lines. The branch is merged with current main (#1337, #1339). A micro-benchmark shows provider
definition reads ~10× faster and ProviderRegistry construction ~18% faster.
Startup, test runtime, and clean build time are unchanged within noise, so
the benefit is mainly less code to maintain.

Validation

  • ./scripts/check.sh on the branch merged with current main: compile,
    12/12 Meson suites (670 unit subtests), and
    git diff --check all pass.
  • Manual GUI check on a native build before merging main: tool install/update, download size and
    speed labels, launch-options editor toggles/preview/Apply, and header back
    navigation behave and look the same as before. No UI change, so no
    screenshot.
  • Unverified: Flatpak/AppImage packaging, controller input, and live Steam
    restart flows.

Maintenance impact

  • No new dependencies, settings, persisted IDs, or migrations.
  • Removed Vala sources (src/models/steam/*,
    src/services/tinker-game-context.vala); ran
    ./scripts/build.sh translations to refresh po/POTFILES and the POT
    template. No translatable strings changed.
  • Updated the TinkerGameContext reference in
    docs/provider-architecture.md.

🤖 Generated with Claude Code

Quinta0 and others added 4 commits November 20, 2026 16:03
Gee's to_array()/add_all_array() and Vala's implicit array duplication
already provide the defensive copies the provider models made by hand,
and Vala's `in` operator replaces five private array-contains loops in
the launch-options editor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Delete unused Models.Steam (SteamLibraryConfig, LibraryFolder).
- Inline TinkerGameContext into InstallJob.tinker_game_install_location.
- Fold InstallationLifecycleRecorder into a virtual no-op on
  InstallationOperationCoordinator, dropping three `as` casts.
- Share immutable VariantDefinition objects instead of rebuilding them
  on every get_variants () call.
- Drop run_command_sync (duplicate of run_command_sync_result), the
  convert_bytes_to_string and Asset.is_archive_name pass-throughs, two
  never-observed signals, and commented-out code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Quinta <112334784+Quinta0@users.noreply.github.com>
The web merge of main left provider-definition.vala calling the removed
copy_strings helper and reintroduced copy_variants; the new downloads
presentation test still called convert_bytes_to_string.

Treat the new legacy_titles and ReleaseVariantSet code the same way as
the rest of the branch: share immutable VariantDefinition objects, rely
on Vala array duplication, and drop the now-unused
VariantDefinition.copy ().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Vysp3r

Vysp3r commented Nov 20, 2026

Copy link
Copy Markdown
Owner

I will take a look in a few hours.

Keep the TinkerGame destination in the existing install location. Require successful host command execution before reporting a Flatpak dependency as present, and cover the failure cases with a fixture.
@Vysp3r
Vysp3r merged commit 07fdd44 into Vysp3r:main Nov 21, 2026
2 checks passed
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.

2 participants