refactor(cost): split 550-line cost tracker into tracker + reporter

Extract read-only reporting queries (get_cost_summary, get_daily_costs,
get_recent_calls, ajax_get_cost_data) into Peptide_News_Cost_Reporter
(224 lines). Core tracker retains logging, budget enforcement, pricing,
table creation, and pruning (276 lines). Backward-compatible proxies
preserved on Peptide_News_Cost_Tracker.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-16 22:36:36 +07:00
parent 64e715372a
commit f57bf15b9b
4 changed files with 271 additions and 319 deletions

View File

@@ -353,7 +353,8 @@ if ( ! function_exists( 'add_settings_field' ) ) {
}
}
// Cost tracker provides calculate_cost(), budget checks used by tests.
// Cost subsystem: reporter must load before tracker (tracker proxies to reporter).
require_once PEPTIDE_NEWS_PLUGIN_DIR . 'includes/class-peptide-news-cost-reporter.php';
require_once PEPTIDE_NEWS_PLUGIN_DIR . 'includes/class-peptide-news-cost-tracker.php';
// Stub WP_REST_Request for REST API tests.