Fix cost-tracker SELECT against canonical schema (v0.15.1)

The cost-preview probe in get_avg_tokens_for_stages() referenced
input_tokens/output_tokens/timestamp, which don't exist. Canonical
columns are prompt_tokens/completion_tokens/created_at. Empty-result
fallback was masking the failure functionally, but the wpdb debug
notice was visibly leaking to every admin visit of the AI Models tab.

Adds regression tests that assert $wpdb->last_error after the call,
so the next schema drift won't be masked the same way.

Bug present since v0.11.0 (2026-04-23).

Agent-Session: engineer-prautoblogger cost-tracker-schema-mismatch
This commit is contained in:
peptiderepo
2026-05-14 16:40:51 +08:00
parent 96f0248d81
commit 0bac52d268
4 changed files with 153 additions and 11 deletions

View File

@@ -9,7 +9,7 @@
* Plugin Name: PRAutoBlogger
* Plugin URI: https://peptiderepo.com/prautoblogger
* Description: Monitors social media for trending topics, generates SEO-friendly blog posts using AI, and publishes them on a daily schedule with full cost tracking and self-improvement metrics.
* Version: 0.15.0
* Version: 0.15.1
* Requires at least: 6.0
* Requires PHP: 7.4
* Author: PeptideRepo
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
| Defined here so every file in the plugin can reference paths, versions,
| and limits without magic strings.
*/
define( 'PRAUTOBLOGGER_VERSION', '0.15.0' );
define( 'PRAUTOBLOGGER_VERSION', '0.15.1' );
define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' );
define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ );
define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );