Skip to content

Code quality review: final cleanup and mypy scope (#79, #81) - #82

Merged
shaonianche merged 3 commits into
mainfrom
chore/code-review-cleanup
Oct 28, 2026
Merged

shaonianche merged 3 commits into
mainfrom
chore/code-review-cleanup

Conversation

@shaonianche

@shaonianche shaonianche commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follow-ups from the 2026-10-28 code quality review. Nine of the eleven review issues (#71–#78, #80) already landed on main; this PR carries the remaining commits and closes out the whole set.

  • Align the mypy configuration with what the codebase actually satisfies #79 — scope mypy to the files CI actually enforces: [tool.mypy].files lists the checked modules and CI runs bare mypy instead of relaxing every flag on the command line.
  • Small cleanup list #81 — small cleanup pass: drop the dead _KNOWN_COMPONENTS / _register_developer_field aliases, keep one TIMESTAMP_FIELD_ID, share crc16_chunks between FitFile and FitFileBuilder, read STRING fields by field size, and move project_records test scaffolding out of compatibility.
  • Move to_bytes option merging into resolve_encode_options #72 follow-up — explicit encode kwargs now win over EncodeOptions: preserve= is honored when options= is also given, strict=False can turn off options.strict, and the _CHECK_CRC_UNSET sentinel is replaced by None defaults.

Review issues

Closes #71
Closes #72
Closes #73
Closes #74
Closes #75
Closes #76
Closes #77
Closes #78
Closes #79
Closes #80
Closes #81

Verification

  • uv run ruff check fit_tool — clean
  • uv run mypy — 3 files, success
  • uv run pytest -q — 447 passed, 1 skipped

shaonianche and others added 2 commits October 28, 2026 12:34
- drop the unused _KNOWN_COMPONENTS and _register_developer_field aliases
- move project_records test scaffolding out of compatibility
- keep TIMESTAMP_FIELD_ID in wire.model instead of three modules
- share crc16_chunks between FitFile and FitFileBuilder
- read STRING fields by field size instead of buffer length

Amp-Thread-ID: https://ampcode.com/threads/T-01a180a3-b0f6-711b-bca9-09e4a1f830d0
Co-authored-by: Amp <amp@ampcode.com>
The config advertised disallow_untyped_defs for every non-generated module
while CI relaxed all of those flags and checked three files. List the
checked files in [tool.mypy].files and run bare mypy in CI so the config
and the gate agree. Expanding the list is tracked in #79.

Amp-Thread-ID: https://ampcode.com/threads/T-01a180a3-b0f6-711b-bca9-09e4a1f830d0
Co-authored-by: Amp <amp@ampcode.com>
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.03%. Comparing base (3bfabe2) to head (392c21d).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
- Coverage   93.06%   93.03%   -0.04%     
==========================================
  Files          46       46              
  Lines        2741     2728      -13     
  Branches      427      425       -2     
==========================================
- Hits         2551     2538      -13     
  Misses        109      109              
  Partials       81       81              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

preserve= was ignored whenever options= was supplied, and an explicit
strict=False could not turn off options.strict. Merge kwargs over a base
EncodeOptions in one path and use None (instead of a sentinel object) to
mean "omitted", so explicit values always win.

Amp-Thread-ID: https://ampcode.com/threads/T-01a180a3-b0f6-711b-bca9-09e4a1f830d0
Co-authored-by: Amp <amp@ampcode.com>
@shaonianche
shaonianche merged commit efcbd2c into main Oct 28, 2026
10 checks passed
shaonianche added a commit that referenced this pull request Oct 28, 2026
Bump the package version to 0.9.17 and fold the pending news fragments
into the release section: FIT protocol 2.0 headers (#78), explicit encode
kwargs overriding EncodeOptions (#82), Garmin FIT SDK profile 21.218.0
(#68), and the Python 3.15 CI matrix (#python-315).

Amp-Thread-ID: https://ampcode.com/threads/T-01a180f7-8bdd-77a3-bedc-fcca2ad4bd20

Co-authored-by: Amp <amp@ampcode.com>
@shaonianche
shaonianche deleted the chore/code-review-cleanup branch October 28, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment