fix: image style suffix empty-string bypass and image cost run_id mismatch (v0.12.2)
Bug 1: Image style suffix empty-string bypass - get_option() for prautoblogger_image_style_suffix returns empty string from DB instead of default - Root cause of post #675 rendering photorealistically instead of newspaper comic - Fixed by extracting private helper get_style_suffix() that treats both absent AND empty as default - Applied to all three call sites in class-image-prompt-builder.php (lines 85, 107, 272) Bug 2: Image cost logged under wrong run_id - class-image-pipeline.php created fresh cost tracker when invoked without argument - Image costs logged under different run_id than article's other stages - Cost breakdowns aggregating by run_id silently excluded image line items - Fixed by threading article worker's cost tracker through Publisher to image pipeline - Modified publisher.php and post-assembler.php to accept and pass cost_tracker - Updated article-worker.php to pass cost_tracker to publisher methods - Image costs now share same run_id as analysis, draft, review, and llm_research stages Version: 0.12.1 -> 0.12.2 CHANGELOG: Added comprehensive entry describing both fixes
This commit is contained in:
@@ -35,9 +35,10 @@ class PRAutoBlogger_Publisher {
|
||||
string $content,
|
||||
PRAutoBlogger_Article_Idea $idea,
|
||||
PRAutoBlogger_Editorial_Review $review,
|
||||
?string $run_id = null
|
||||
?string $run_id = null,
|
||||
?PRAutoBlogger_Cost_Tracker $cost_tracker = null
|
||||
): int {
|
||||
return $this->create_post( $content, $idea, $review, 'publish', $run_id );
|
||||
return $this->create_post( $content, $idea, $review, 'publish', $run_id, $cost_tracker );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,9 +55,10 @@ class PRAutoBlogger_Publisher {
|
||||
string $content,
|
||||
PRAutoBlogger_Article_Idea $idea,
|
||||
PRAutoBlogger_Editorial_Review $review,
|
||||
?string $run_id = null
|
||||
?string $run_id = null,
|
||||
?PRAutoBlogger_Cost_Tracker $cost_tracker = null
|
||||
): int {
|
||||
return $this->create_post( $content, $idea, $review, 'draft', $run_id );
|
||||
return $this->create_post( $content, $idea, $review, 'draft', $run_id, $cost_tracker );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +77,8 @@ class PRAutoBlogger_Publisher {
|
||||
PRAutoBlogger_Article_Idea $idea,
|
||||
PRAutoBlogger_Editorial_Review $review,
|
||||
string $post_status,
|
||||
?string $run_id = null
|
||||
?string $run_id = null,
|
||||
?PRAutoBlogger_Cost_Tracker $cost_tracker = null
|
||||
): int {
|
||||
// Clean LLM artifacts, then inject peptide hyperlinks deterministically
|
||||
// before the content enters WordPress. Peptide linker no-ops gracefully
|
||||
@@ -106,7 +109,7 @@ class PRAutoBlogger_Publisher {
|
||||
PRAutoBlogger_Post_Assembler::link_generation_logs( $post_id, $run_id );
|
||||
|
||||
if ( 'publish' === $post_status ) {
|
||||
PRAutoBlogger_Post_Assembler::attach_generated_images( $post_id, $idea, $post_data );
|
||||
PRAutoBlogger_Post_Assembler::attach_generated_images( $post_id, $idea, $post_data, $cost_tracker );
|
||||
}
|
||||
|
||||
PRAutoBlogger_Logger::instance()->info(
|
||||
|
||||
Reference in New Issue
Block a user