Skip to content

Fix/69 sequential packet reassembly - #124

Closed
drewr95 wants to merge 155 commits into
juergenH87:masterfrom
RaulSMS:fix/69-sequential-packet-reassembly
Closed

Fix/69 sequential packet reassembly#124
drewr95 wants to merge 155 commits into
juergenH87:masterfrom
RaulSMS:fix/69-sequential-packet-reassembly

Conversation

@drewr95

@drewr95 drewr95 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces significant improvements to the project's development, CI/CD, and documentation infrastructure. It adds comprehensive configuration for automated dependency updates, continuous integration (CI), package publishing, supply-chain security analysis, and documentation builds. Additionally, it provides clear contributing guidelines and architectural documentation for new contributors.

Key changes:

CI/CD and Automation

  • Added .github/workflows/CI.yml with improved test matrix (Python 3.10–3.13, multiple OS), separate lint and build jobs, and updated dependency installation for better reliability.
  • Introduced .github/workflows/publish.yml for automated release publishing to PyPI and GitHub Releases, including SLSA provenance and hash generation for supply-chain security.
  • Added .github/dependabot.yml to enable weekly automated dependency update checks for GitHub Actions and Python packages.
  • Added .github/workflows/scorecard.yml to run OpenSSF Scorecard supply-chain security analysis on the default branch.

Documentation and Contributor Experience

  • Added .readthedocs.yaml for automated documentation builds using Read the Docs with Sphinx.
  • Added CONTRIBUTING.md with clear instructions for environment setup, testing, linting, type checking, branching, and the release process.
  • Added CLAUDE.md with a detailed project architecture overview, common commands, and testing patterns for contributors and AI assistants.

Packaging

  • Updated MANIFEST.in to include LICENSE and README.md in source distributions, ensuring compliance and completeness.

RaulSMS and others added 30 commits May 20, 2026 12:54
To support agentic development
Extend the DTC class and Dm1 sender/receiver to handle SAE J1939-73 SPN
conversion methods 1, 2, 3, and 4 (previously only CM 4 / CM-bit-clear
was supported and other methods were logged as errors on receive). TX
takes an optional per-DTC 'cm' key (default 4); RX disambiguates the
CM-bit-set case via a new Dm1(rx_cm_bit_set=...) constructor arg.
Add support for all four DM1 SPN conversion methods
* feat: remove numpy

* test: add coverage for j1939_22 logic

* test: clean up docs and remove constant

* feat: use constants instead of hardcoded numbers
With the two-thread model introduced in this branch, the protocol thread
iterates _snd_buffer in async_job_thread concurrently with send_pgn being
called from a user/timer thread. The check-then-write on _snd_buffer was
unprotected, creating a live race (RuntimeError: dictionary changed size
during iteration on CPython).

j1939_22.py already wraps its send_pgn buffer writes with _buffer_lock;
this commit brings j1939_21.py to the same standard.

CAN I/O (_send_tp_bam / _send_tp_rts) is intentionally kept outside the
lock to avoid holding it during I/O.
Two new tests in test_threading.py covering the race condition fixed in
the previous commit:

- test_send_pgn_concurrent_no_crash: 4 threads hammer send_pgn while the
  protocol thread is running; verifies no RuntimeError or crash.
- test_send_pgn_j1939_21_buffer_lock_no_race: two threads race to send to
  the same src/dst pair simultaneously; verifies the check-then-write is
  atomic (exactly one succeeds, one is rejected).
#11)

python-can v4.2.0 renamed the Bus() kwarg from 'bustype' to 'interface'
and scheduled 'bustype' for removal in v5.0. Update all examples and the
connect() docstring, and bump the minimum version requirement in setup.py.

Fixes #9.
- Remove test_helpers/__init__.py so find_packages() no longer picks it
  up; feeder.py stays in test_helpers/ as the contributor prefers.
- Move conftest.py to the repo root so pytest auto-discovers the feeder
  fixture — no more explicit `from test_helpers.conftest import feeder`
  in every test file.
- Add test_helpers to find_packages(exclude=...) as an explicit guard.
- Drop the now-redundant explicit fixture imports from all test files.

Fixes the issue documented in reviews/issue-test-folder-structure.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…12)

Covers issue #8 — device_address_preferred=0 is falsy in Python, so a
bare truthiness check silently skipped the bypass, leaving the CA in
State.NONE. The fix (is not None guard) was already applied; this test
pins the behaviour so it cannot regress.
…ments

General threading and other misc. improvements
khauersp and others added 29 commits July 7, 2026 17:16
…actions/upload-artifact-7.0.1

chore(deps): bump actions/upload-artifact from 4.6.1 to 7.0.1
…ows/generator_generic_slsa3.yml

Bumps [slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml](https://github.com/slsa-framework/slsa-github-generator) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/slsa-framework/slsa-github-generator/releases)
- [Changelog](https://github.com/slsa-framework/slsa-github-generator/blob/main/CHANGELOG.md)
- [Commits](slsa-framework/slsa-github-generator@v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml
  dependency-version: 2.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
…slsa-framework/slsa-github-generator/dot-github/workflows/generator_generic_slsa3.yml-2.1.0

chore(deps): bump slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml from 2.0.0 to 2.1.0
…s-on-construction

Feature/add support for bus on construction
Use Dispatch thread for processing
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6.3.0 to 7.0.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v6.3.0...v7.0.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…actions/setup-python-7.0.0

chore(deps): bump actions/setup-python from 6.3.0 to 7.0.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@9c091bb...3d3c42e)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
…actions/checkout-7.0.1

chore(deps): bump actions/checkout from 7.0.0 to 7.0.1
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.3 to 2.4.4.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](ossf/scorecard-action@4eaacf0...2d11466)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
…ossf/scorecard-action-2.4.4

chore(deps): bump ossf/scorecard-action from 2.4.3 to 2.4.4
Log errors instead of crash when trying to send can messages
can.Notifier.stop() calls listener.stop() on every listener it holds,
which sets MessageListener.stopped = True permanently -- nothing ever
resets it. ElectronicControlUnit creates its listener once in __init__
and reuses it for the ECU's whole lifetime.

The ECU and its Notifier are governed by separate ref-counted registries
in consuming code (e.g. j1939_utilities' EcuRegistry/NotifierRegistry).
If a shared notifier's refcount independently hits zero while the ECU
itself survives (some other consumer still holds an ECU reference), the
notifier gets torn down and a fresh one created, but add_notifier() was
re-adding the ECU's same, already-stopped=True listener to the new
notifier without clearing the flag -- silently and permanently dropping
every future frame for that ECU, even though the notifier is alive and
the listener is registered on it.

Found while investigating boom_integration_tests rotary/tilt startup
test flakiness at full-suite scale. Turned out not to be the actual
root cause there (a stray CAN bus filter left by an unrelated fixture),
but this is a real, independently reproducible bug in its own right.
Addresses review feedback on #71 (both Copilot and khauersp) requesting
a regression test for the fix.

test_add_notifier_after_notifier_stop_still_delivers reproduces the exact
sequence: add a notifier, stop it (setting listener.stopped=True via
can.Notifier.stop()), remove it, then add a brand new notifier and
assert a real frame sent on the bus is actually delivered to a
subscriber. Verified this fails without the fix (reverted
electronic_control_unit.py locally, confirmed the test catches the
regression with "Frame was not delivered...") and passes with it.
…-flag

fix: reset MessageListener.stopped when re-adding to a notifier
@drewr95 drewr95 closed this Aug 20, 2026
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.

7 participants