Commit Graph
6 Commits
Author SHA1 Message Date
hemna 7a2ed79759 fix: remove dead-code Python version guard in utils/__init__.py (#270)
The guard:
    if sys.version_info.major == 3 and sys.version_info.minor >= 3:
        from collections.abc import MutableMapping
    else:
        from collections.abc import MutableMapping

has identical branches — both import from collections.abc (the correct
Python 3.3+ location).  Remove the guard; keep the bare import.

Closes #251
2026-08-28 14:23:58 -04:00
hemna aa43f60728 fix: add reset() to @singleton decorator to allow test isolation (#262)
The @singleton decorator stored its instance in wrapper_singleton.instance
inside a closure. Tests could reset __new__-based singletons via
ClassName._instance = None, but @singleton classes had no equivalent reset
mechanism, causing state to leak between tests.

Add wrapper_singleton.reset() to every @singleton-decorated class. The
method clears wrapper_singleton.instance so the next call creates a fresh
instance, matching the __new__ singleton pattern.

Update all tests to call ClassName.reset() instead of manually setting
ClassName.instance = None (tests/client/test_client.py x5,
tests/client/test_registry.py x1).

Tests added (tests/utils/test_utils.py):
- test_singleton_has_reset: asserts reset is callable on the wrapper
- test_singleton_reset_clears_instance: verifies a new instance is created
  after reset(), not the cached one
- test_singleton_instance_is_none_before_first_call: verifies the instance
  lifecycle — None → populated → None after reset

Closes #240
2026-08-28 13:51:33 -04:00
hemnaandClaude Sonnet 4.5 202c689658 Replace insecure pickle serialization with JSON
SECURITY FIX: Replace pickle.load() with json.load() to eliminate
remote code execution vulnerability from malicious pickle files.

Changes:
- Update ObjectStoreMixin to use JSON instead of pickle
- Add PacketJSONDecoder to reconstruct Packet objects from JSON
- Change file extension from .p to .json
- Add warning when old pickle files detected
- Add OrderedDict restoration for PacketList
- Update all tests to work with JSON format

Users with existing pickle files must run:
  aprsd dev migrate-pickle

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 16:07:55 -05:00
hemna 0620e63e72 added more unit tests 2026-01-12 23:26:49 -05:00
hemna f9979fa3da remove py310 testing 2025-12-29 20:49:54 -05:00
hemna d0dfaa42e6 Added unit tests 2025-12-09 17:20:23 -05:00