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:
peptiderepo
2026-06-12 14:05:09 +00:00
parent 02310e90d4
commit c0929be3ce
2 changed files with 3 additions and 1 deletions

View File

@@ -111,7 +111,7 @@ class PRAutoBlogger_Post_Assembler {
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
$research_row = $wpdb->get_row(
$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}
WHERE run_id = %s AND stage = 'llm_research' AND post_id IS NULL
LIMIT 1",