From 0d18cfbfc6fb4e5406429a423c4a59ec35807027 Mon Sep 17 00:00:00 2001 From: indifferentketchup Date: Wed, 6 May 2026 13:33:35 +0000 Subject: [PATCH] fix: relax DebugServerPattern::LINE for PZ B42 log format PZ build 42.x dropped the per-line `t:` (microsecond) field and tightened the spacing between `f:N`, `t:N`, and `st:N,N,N,N>` markers. The hardcoded `f:\d+,\s+t:\d+,\s+st:` requirement caused every B42 line to fail the parser's LINE regex, leaving ServerLog entries without their level/prefix and silently disabling ServerExceptionProblem and ModMissingProblem (the anchorless EngineVersionInformation still fired against the joined entry text, which is why the symptom was "one Information, no Problems"). Make `t:N,` optional via `(?:,\s+t:\d+)?` and the comma between `f:N` and `st:` optional via `,?`. The B41 format remains a strict match. Add `debug-server-42x-minimal.txt` mirroring the existing synthetic fixture in the new format, and parameterise ProjectZomboidServerLogTest with a #[DataProvider] so all four parser-shape assertions now run against both formats. Spot-check: analysers emit 3 Problems (2 exceptions, 1 missing mod) and 4 Information entries against the new fixture, identical to B41. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../ProjectZomboid/DebugServerPattern.php | 2 +- .../fixtures/debug-server-42x-minimal.txt | 22 ++++++++++++ .../Log/ProjectZomboidServerLogTest.php | 36 +++++++++++++------ 3 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 test/src/Games/ProjectZomboid/fixtures/debug-server-42x-minimal.txt diff --git a/src/Pattern/ProjectZomboid/DebugServerPattern.php b/src/Pattern/ProjectZomboid/DebugServerPattern.php index bf9c95c..148cae9 100644 --- a/src/Pattern/ProjectZomboid/DebugServerPattern.php +++ b/src/Pattern/ProjectZomboid/DebugServerPattern.php @@ -15,7 +15,7 @@ namespace IndifferentKetchup\Codex\Pattern\ProjectZomboid; */ class DebugServerPattern { - public const string LINE = '/^\[(\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3})\]\s+(\w+)\s*:\s+(\S+)\s+f:\d+,\s+t:\d+,\s+st:[\d,]+>\s+.*$/'; + public const string LINE = '/^\[(\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3})\]\s+(\w+)\s*:\s+(\S+)\s+f:\d+(?:,\s+t:\d+)?,?\s+st:[\d,]+>\s+.*$/'; public const string VERSION = '/version=(?\S+) (?[a-f0-9]{40}) (?\d{4}-\d{2}-\d{2}) (?