Skip to content

Bug fixes, test suite, CI, and Nix flake - #2

Merged
celex3 merged 3 commits into
mainfrom
improvements/bugfixes-tests-ci-nix
Aug 20, 2026
Merged

celex3 merged 3 commits into
mainfrom
improvements/bugfixes-tests-ci-nix

Conversation

@celex3

@celex3 celex3 commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bug fixes across commands.py, _utils.py, _config.py, and __main__.py:
    • add_song deleted macOS ._ files from an already-moved temp path (silent no-op); now cleans the destination
    • censor crashed with FileNotFoundError when .censored/ didn't exist yet; uncensor/get_censored crashed when nothing was censored
    • extract had a broken suffix whitelist (duplicate .xz, .bz instead of .bz2, no .gz) and a missing f-string prefix on its error message
    • downloads: 30s timeout, clearer Google Drive failure error, broader accepted Content-Types, sanitized filenames
    • config: empty root = '' now raises a proper ConfigError; clear error when APPDATA is unset
    • CLI: duplicate typer.Typer() removed, explicit imports, ctx.invoked_subcommand instead of sys.argv grepping, init-config overwrite prompt defaults to No
  • Missing dependencies declared: requests, tqdm, rich were only present transitively via gdown/typer
  • 39-test pytest suite (no network needed) with regression tests for the bugs above, plus uv.lock and a dev dependency group
  • GitHub Actions CI: tests on Ubuntu/Windows/macOS x Python 3.10-3.12, plus ruff lint
  • Nix flake: packages simfile, msdparser, and pyrfc6266 from PyPI sdists (absent from nixpkgs), builds itg-cli with the test suite running in the build sandbox. Enables nix run github:celex3/itg-cli
  • Repository URLs updated after the account rename; includes the pending 1.0.8 version bump / author metadata edits that were in the working tree

Behavior changes to review

  • init-config overwrite prompt now defaults to No (was Yes)
  • Empty Courses/PackName folders are no longer created for packs without courses
  • The local itg-cli.nix stub is superseded by flake.nix and can be deleted

Test plan

  • uv run pytest - 39 passed
  • uv run ruff check src tests - clean
  • nix build + nix flake check pass; built binary verified with a real add-pack / censor / uncensor roundtrip against a fake ITGmania install

🤖 Generated with Claude Code

Celeste and others added 3 commits July 16, 2026 02:30
- add_song: delete macOS ._ files from the destination instead of the
  already-moved temp path (they were silently never deleted)
- censor: create .censored/Pack/ before moving so the first censor of a
  pack no longer raises FileNotFoundError; resolve paths before the
  is_relative_to check
- get_censored/uncensor: return []/raise UncensorException when
  .censored does not exist instead of crashing
- extract: fix suffix whitelist (.gz/.tgz/.bz2 now accepted, duplicate
  .xz removed) and add missing f-string prefix on the error message
- download_file: 30s request timeout; clear error when a Google Drive
  download fails instead of Path(None) TypeError
- validate_response: accept application/octet-stream and
  x-zip-compressed; strip Content-Type parameters before comparing
- get_download_filename: return str as annotated; strip path separators
- config: reject empty root with a proper ConfigError; clear error when
  APPDATA is unset on Windows
- CLI: remove duplicate Typer() construction; use ctx.invoked_subcommand
  instead of grepping sys.argv; explicit imports instead of import *;
  init-config overwrite prompt now defaults to No
- declare requests, tqdm, and rich as direct dependencies (previously
  only present transitively); add uv.lock
- update repository URLs after account rename; fix typos

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
39 pytest tests covering add_pack (dir/zip/courses/overwrite), add_song
(including a regression test for macOS file deletion), censor/uncensor
roundtrips, archive extraction, response validation, download filename
parsing, and config loading. No network access required.

CI runs the suite on Ubuntu/Windows/macOS x Python 3.10-3.12 via uv,
plus a ruff lint job.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Packages the three dependencies missing from nixpkgs (simfile,
msdparser, pyrfc6266) from PyPI sdists with hashes taken from uv.lock,
then builds itg-cli with buildPythonApplication. The test suite runs
inside the build via pytestCheckHook.

setuptools and pyparsing version pins are relaxed to match what nixpkgs
ships; the fs pkg_resources deprecation warning is silenced in the
wrapper so CLI output stays clean. Includes a dev shell with uv and
Python 3.12.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@celex3
celex3 merged commit e56b951 into main Aug 20, 2026
10 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.

1 participant