fix(assembler): add prompt_version/agent_role to amortize SELECT; fix test mock
The amortize_research_costs() SELECT was missing prompt_version and agent_role — the two fields added in the INSERT as part of the v0.19.4 pv/role fix. PHP 8.x treats accessing an undefined property on stdClass as E_WARNING; PHPUnit converts warnings to exceptions, which the reap() try/catch captures as 'DB error', leaving reaped=0 and breaking ResearchReaperTest on all 3 PHP versions. Fix: extend the SELECT column list to include the two new fields so $research_row has them populated. Update the ResearchReaperTest get_row mock to return prompt_version and agent_role from fixtures (defaults null/''). Agent-Session: engineer-prab-maint-fix-20260612
This commit is contained in:
@@ -111,7 +111,7 @@ class PRAutoBlogger_Post_Assembler {
|
|||||||
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||||
$research_row = $wpdb->get_row(
|
$research_row = $wpdb->get_row(
|
||||||
$wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
$wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
||||||
"SELECT id, estimated_cost, provider, model, prompt_tokens, completion_tokens
|
"SELECT id, estimated_cost, provider, model, prompt_tokens, completion_tokens, prompt_version, agent_role
|
||||||
FROM {$table}
|
FROM {$table}
|
||||||
WHERE run_id = %s AND stage = 'llm_research' AND post_id IS NULL
|
WHERE run_id = %s AND stage = 'llm_research' AND post_id IS NULL
|
||||||
LIMIT 1",
|
LIMIT 1",
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ class ResearchReaperTest extends BaseTestCase {
|
|||||||
'model' => $o->model ?? 'gemini-flash',
|
'model' => $o->model ?? 'gemini-flash',
|
||||||
'prompt_tokens' => $o->prompt_tokens ?? 1000,
|
'prompt_tokens' => $o->prompt_tokens ?? 1000,
|
||||||
'completion_tokens' => $o->completion_tokens ?? 500,
|
'completion_tokens' => $o->completion_tokens ?? 500,
|
||||||
|
'prompt_version' => $o->prompt_version ?? null,
|
||||||
|
'agent_role' => $o->agent_role ?? '',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user