Skip to content

chore: enforce the declaration ordering convention in ci - #1887

Merged
bdraco merged 1 commit into
masterfrom
enforce_ordering_ci
Aug 30, 2026
Merged

bdraco merged 1 commit into
masterfrom
enforce_ordering_ci

Conversation

@bdraco

@bdraco bdraco commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

Follow up to #1886. The fifth audit showed the ordering convention can regress silently (#1880 broke it in three classes), so it is now enforced and fully documented:

  • scripts/check_declaration_order.py verifies method order in every class (dunders with init first, then public, then private, each alphabetical) and sibling class order (locally defined bases first, subclasses sharing the same local bases alphabetical), printing the full expected sequence on failure
  • runs as a pre-commit hook receiving the changed files from pre-commit (full tree scan when run standalone), triggering on the script's own changes too, via python3
  • CLAUDE.md now documents the full convention it enforces, including that the arrangement is deliberately rule generated
  • enforcement required conforming the eighteen classes earlier rounds never touched plus the info.py resolver siblings; a review confirmed the reorder is invisible to the compiled Cython layout since the untouched pxd files own the struct and vtable order and matching is by name

Test plan

  • checker green tree wide, fails correctly on perturbation, argv mode verified
  • full suite passes against a REQUIRE_CYTHON rebuild; CodSpeed is the authoritative perf confirmation

@github-actions

Copy link
Copy Markdown

Thanks for contributing! A quick note: this project is in the process of moving from LGPL-2.1 to Apache 2.0, see #1835.

By continuing with this pull request you agree that this new contribution is offered under Apache 2.0.

This notice does not affect your previous contributions. If you would like to consent to relicensing those as well, please post the consent statement on #1835; silence is never treated as consent for past work.

If offering this contribution under Apache 2.0 does not work for you, no hard feelings; reply with the exact phrase I do not agree to the Apache 2.0 license or simply close this pull request.

@codspeed

codspeed Bot commented Aug 30, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing enforce_ordering_ci (dd9091d) with master (d44c3f8)

Open in CodSpeed

@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.71347% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.87%. Comparing base (d44c3f8) to head (dd9091d).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/zeroconf/_handlers/record_manager.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1887   +/-   ##
=======================================
  Coverage   99.87%   99.87%           
=======================================
  Files          33       33           
  Lines        3910     3910           
  Branches      568      568           
=======================================
  Hits         3905     3905           
  Misses          3        3           
  Partials        2        2           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bdraco
bdraco force-pushed the enforce_ordering_ci branch from 348072c to dd9091d Compare August 30, 2026 00:48
@bdraco

bdraco commented Aug 30, 2026

Copy link
Copy Markdown
Member Author

The one line codecov flags (record_manager.py:68, the failed to remove listener log) predates this PR and is currently unreachable: listeners is a set, so removing an unregistered listener raises KeyError while the handler catches ValueError, a leftover from the list days. #1783 addresses that behavior; covering the line belongs there rather than in this declaration move.

@bdraco
bdraco marked this pull request as ready for review August 30, 2026 00:52
@bdraco
bdraco merged commit f0a20a0 into master Aug 30, 2026
34 of 35 checks passed
@bdraco
bdraco deleted the enforce_ordering_ci branch August 30, 2026 00:52
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