From 1f03b4656494e0c903c98d47bc3077b7544b0546 Mon Sep 17 00:00:00 2001 From: Jeppe B <2jepp9350@gmail.com> Date: Mon, 3 Aug 2026 16:00:52 +0200 Subject: [PATCH] Fix XL-Vask usage metadata hydration (#341) Keep automation metadata out of the strict legacy XL-Vask helper payload while returning it separately. This restores the invoice-period XL-Vask orders GET after the guarded autopilot deployment. --- .../nginx/app/routes/xlvaskUsageLogsRoute.php | 13 ---------- .../XLVask/XLVaskUsageRouteContractTest.php | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/services/nginx/app/routes/xlvaskUsageLogsRoute.php b/services/nginx/app/routes/xlvaskUsageLogsRoute.php index 724aa415..cb1eed43 100644 --- a/services/nginx/app/routes/xlvaskUsageLogsRoute.php +++ b/services/nginx/app/routes/xlvaskUsageLogsRoute.php @@ -98,19 +98,6 @@ class xlvaskUsageLogsRoute 'ignored_at', 'ignored_by', 'ignored_reason', - 'source_hash', - 'source_revision', - 'source_observed_at', - 'source_stable_since', - 'source_observation_count', - 'import_state', - 'resolution_state', - 'certainty', - 'planned_action', - 'state_reason', - 'expected_version', - 'last_run_id', - 'last_evaluated_at', ])); // Create a new xlvask usage log object $tmp = $xlvask->new($xlvask->helpers->xlvask_usage_log); diff --git a/services/nginx/app/tests/Unit/XLVask/XLVaskUsageRouteContractTest.php b/services/nginx/app/tests/Unit/XLVask/XLVaskUsageRouteContractTest.php index 943a38de..d368d185 100644 --- a/services/nginx/app/tests/Unit/XLVask/XLVaskUsageRouteContractTest.php +++ b/services/nginx/app/tests/Unit/XLVask/XLVaskUsageRouteContractTest.php @@ -48,6 +48,30 @@ it('returns cached amount summaries on XL Vask usage order rows without widening ->and($route)->toContain("\$tmp_res['order']['xlvask_amount_cached'] = \$amount_summary['cached']"); }); +it('keeps automation metadata out of the strict legacy XL Vask helper payload', function (): void { + $route = file_get_contents(WD . '/routes/xlvaskUsageLogsRoute.php'); + + expect($route)->not->toBeFalse(); + + $payloadStart = strpos((string)$route, '$usage_log_payload = array_intersect_key('); + $payloadEnd = strpos((string)$route, '// Create a new xlvask usage log object', $payloadStart ?: 0); + + expect($payloadStart)->not->toBeFalse() + ->and($payloadEnd)->not->toBeFalse(); + + $payloadDefinition = substr((string)$route, (int)$payloadStart, (int)$payloadEnd - (int)$payloadStart); + + expect($payloadDefinition) + ->not->toContain("'source_hash'") + ->not->toContain("'source_revision'") + ->not->toContain("'import_state'") + ->not->toContain("'resolution_state'") + ->not->toContain("'certainty'") + ->not->toContain("'planned_action'") + ->not->toContain("'expected_version'") + ->not->toContain("'last_run_id'"); +}); + it('adapts the legacy XL Vask usage import route to a scoped queued autopilot run', function (): void { $route = file_get_contents(WD . '/routes/moduleXLVaskRoute.php'); $automation = file_get_contents(WD . '/classes/xlvask_automation_service.php');