Skip to content

Commit f041420

Browse files
committed
Release v2.2.3: fix Docker log timestamp split off-by-one
Fix _split_docker_log_timestamp using z+2 so the message begins after the "Z " prefix; z+3 dropped the first character and broke JSON logs. Add a regression test for Docker-prefixed JSON lines. Made-with: Cursor
1 parent 5fd9cab commit f041420

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

dtop/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
A high-performance terminal UI for Docker container management.
44
"""
55

6-
__version__ = "2.2.2"
6+
__version__ = "2.2.3"
77
__author__ = "StakeSquid"
88
__description__ = "A high-performance terminal UI for Docker container management"
99

dtop/views/textual_log_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _split_docker_log_timestamp(line: str) -> Tuple[str, str]:
3333
return "", ""
3434
if "Z " in line:
3535
z = line.index("Z ")
36-
return line[: z + 1], line[z + 3 :]
36+
return line[: z + 1], line[z + 2 :]
3737
if " " in line and line[0].isdigit():
3838
prefix, rest = line.split(" ", 1)
3939
if "T" in prefix and len(prefix) >= 10:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "dtop"
7-
version = "2.2.2"
7+
version = "2.2.3"
88
description = "A high-performance terminal UI for Docker container management"
99
readme = "README.md"
1010
license = "MIT"

tests/test_textual_log_normalize.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
NORMALIZE_SCRIPT = REPO_ROOT / "dtop" / "utils" / "normalize_logs.py"
1313

1414

15+
def test_split_docker_log_timestamp_strips_z_space_without_truncating_message():
16+
"""Docker prefix is '...Z '; message must start immediately after the space."""
17+
ts, msg = tlv._split_docker_log_timestamp(
18+
'2025-03-26T12:06:31.000Z {"severity":"INFO"}'
19+
)
20+
assert ts == "2025-03-26T12:06:31.000Z"
21+
assert msg == '{"severity":"INFO"}'
22+
assert msg.startswith("{")
23+
24+
1525
def _fake_screen_for_worker():
1626
applied: list = []
1727

0 commit comments

Comments
 (0)