Revised error codes and functional PlaybackEngine

All internal and public errors have been revised (GPT 5.6 Sol) to return
more detail without horrendously long error classes, this has reduced
the number of error types but each now carries a reason and a code for
differentiation if needed

PlaybackEngine has been implemented and is functional, core mode changes
what signal descriptors are returned to avoid duplicates, the playback
engine currently discards the derived signals that would be recorded in
the DLPak and derived signals are reprocessed live

Future will require the behavior listed above to be selectable so one of
two options are possible:
A - Derived signals are reprocessed live by the relevant derive units
(current behavior
B - Derived signals are played back directly from the PlaybackEngine,
this requires turning off the routing to the live derive units to avoid
duplicate values

This will also require the option to perform offline processing with
derive units to be able to create derived signals after the fact, this
will likely incur a new 'offline' mode in the core to gate things
correctly, this will likely be useful for heavier processing that cannot
be done live, filters that require a lookahead, or more precise derived
signals using interpolated signals for higher acurracy which also brings
the ability to offline process on a fixed timebase instead of following
either input signal to the derived signal
This commit is contained in:
2026-09-13 12:26:12 +02:00
parent bbc5aac891
commit 9407bfeb79
18 changed files with 1160 additions and 178 deletions
+9 -7
View File
@@ -7,12 +7,9 @@ from uuid import uuid4
import pytest
from dynalab_core import Core
from dynalab_core.config import CoreConfig
from dynalab_core.errors import JsonServerError
from dynalab_core.protocols.constants import PROTOCOL_VERSION
from dynalab_core.protocols.common import VersionDescriptor
from dynalab_core.protocols.json.errors import (
JsonServerStartupError,
JsonServerTimeoutError,
)
from dynalab_core.protocols.packets.handshake import ConnectorHello, SignalDescriptor
from test.common import find_available_port
@@ -39,7 +36,7 @@ def test_json_server_raises_timeout_error(
with caplog.at_level(logging.DEBUG, logger="dynalab_core"):
try:
with pytest.raises(JsonServerTimeoutError):
with pytest.raises(JsonServerError, match="did not start") as raised:
core.start()
finally:
core.stop()
@@ -51,6 +48,7 @@ def test_json_server_raises_timeout_error(
)
assert timeout_record.levelno == logging.ERROR
assert timeout_record.port == port
assert raised.value.code == "start_timeout"
def test_json_server_raises_startup_error(
@@ -65,7 +63,7 @@ def test_json_server_raises_startup_error(
core1.start()
try:
with pytest.raises(JsonServerStartupError):
with pytest.raises(JsonServerError, match="failed to start") as raised:
core2.start()
finally:
core1.stop()
@@ -79,6 +77,8 @@ def test_json_server_raises_startup_error(
assert failure_record.levelno == logging.ERROR
assert failure_record.port == port
assert failure_record.exc_info is not None
assert raised.value.code == "startup_failed"
assert isinstance(raised.value.__cause__, OSError)
def test_json_server_logs_invalid_handshake(
@@ -117,7 +117,7 @@ def test_json_server_reports_unexpected_thread_startup_failure(
with caplog.at_level(logging.DEBUG, logger="dynalab_core"):
try:
with pytest.raises(JsonServerStartupError):
with pytest.raises(JsonServerError) as raised:
core.start()
finally:
core.stop()
@@ -131,6 +131,8 @@ def test_json_server_reports_unexpected_thread_startup_failure(
assert failures[0].startup_complete is False
assert failures[0].exception_type == "RuntimeError"
assert failures[0].exc_info is not None
assert raised.value.code == "startup_failed"
assert isinstance(raised.value.__cause__, RuntimeError)
def test_rejected_handshake_is_not_logged_as_connected(