Repository navigation
feat(local): allow write callbacks to suppress default storage - #684
Open
timothyanderson096-ocdealcheck wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow LocalNode write callbacks to suppress the default data-store write by returning anything except None, while still invoking all registered callbacks in order. Addresses the requested enhancement in #598, reported by @sveinse and discussed with @acolomb.
Use an explicit
is not Nonecheck after each callback and return only after the loop. This implements the discussion's stated non-None/all-callback contract without truthiness or generator short-circuiting.False,0and empty values also opt out. Document arguments, order, return semantics and exception propagation in the callback registration API.Compatibility change: previously ignored non-None callback return values now suppress storage. Existing callbacks needing normal storage must return None. Prior stored data is left unchanged when opting out. Validation still precedes callbacks; callback exceptions propagate and prevent storage as before. Read-callback behavior, async dispatch and registration concurrency are unchanged.
Validation recorded 25 October 2026, Linux / CPython 3.12.14 / python-can 4.6.1: six of eleven requested-contract tests fail on original production source and five controls pass; these demonstrate an unimplemented enhancement, not six existing defects. Final focused new/existing LocalNode tests 30 passed, independently rerun. Full base suite 291 passed, one optional-export skip; export-enabled 292 passed; docs build succeeds and includes the callback contract. Fresh original/final optional mypy both retain 44 identical inherited errors in seven files, exit 1.
Tests cover false/empty/truthiness-resistant results, all-callback order, prior data preservation, default copying, kwargs, pre-callback rejection, exceptions, unchanged reads, NMT side effects and real client/server SDO callback round trips without a connected CAN backend. Baseline/final test ASTs match; two formatting-only wraps do not alter assertions.
On 27 October, public head
bea9b0443464c482eab6f2cf6590e95de8747daa, tree372d057a337c52a3ad2939e7be960f3aa3337d6d, exactly matches clean tested3dfa5b5on unchanged base14b3336. Saved evidence and independent review were checked; no fresh project-suite rerun during publication. Related #676 subscriber dispatch and #359 async work do not supply this LocalNode storage behavior.Physical devices, other OS/Python/minimum dependencies, async callbacks, concurrent registration, real application migration and integration with other prepared branches remain unvalidated. This is a proposed API enhancement, not an accepted compatibility policy or upstream approval.
Prepared with AI assistance and independent inspection during original preparation.
Timothy Anderson — Spotted Ridge Engineering / OC Labs
Independent software verification · GDN (Global Decision Network)
timothyanderson096@gmail.com · Engineering evidence