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.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user