Skip to content

steam: harden VDF parser & library detection; add tests#6

Merged
astrovm merged 1 commit intomainfrom
codex/test-edge-cases-and-remove-dead-code
Mar 26, 2026
Merged

steam: harden VDF parser & library detection; add tests#6
astrovm merged 1 commit intomainfrom
codex/test-edge-cases-and-remove-dead-code

Conversation

@astrovm
Copy link
Copy Markdown
Owner

@astrovm astrovm commented Mar 26, 2026

Motivation

  • Make Steam VDF parsing and library detection more robust against malformed or weird real-world VDF files and remove a small dead/no-op branch to keep code clearer.
  • Add unit coverage for edge cases observed in the wild where libraryfolders entries or their apps child are not maps.

Description

  • Simplified vdf::Parser::parse_map by removing the found_closing_brace flag and returning early on EOF or closing-brace conditions, making the control flow clearer (src/steam/vdf.rs).
  • Removed an empty/no-op if kind_found {} block and tightened the conditional branches in detect_games_from_parsed_vdfs to only log when nothing was found and otherwise dedupe inaccessible entries (src/steam/library.rs).
  • Added two unit tests to cover malformed VDF structures: test_find_game_skips_non_map_library_entries and test_find_game_skips_non_map_apps to ensure such entries are safely ignored (src/steam/library.rs).

Testing

  • Ran cargo fmt --all which completed successfully.
  • Attempted cargo test -q but the test run failed in this environment because glib-2.0 development pkg-config metadata is missing, so glib-sys cannot build and the full test suite could not be executed.
  • Also attempted PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig cargo test -q which failed with the same missing glib-2.0.pc blocker; the new tests are present in the tree and should pass when system dev deps are available.

Codex Task

@astrovm astrovm merged commit 7c1f6cb into main Mar 26, 2026
@astrovm astrovm deleted the codex/test-edge-cases-and-remove-dead-code branch March 26, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant