PR Vision v0.2.0: admin/settings interface + correctness fixes
Requirements 1-8 + all non-negotiables:
1. Model manager (CRUD): PRV_Model_Registry, prv_models v2 option, versioned
idempotent migration from v0.1.x flat-string format, Settings page CRUD.
2. Per-model run-health: PRV_Model_Registry::update_health() after each run;
health badges (Healthy/Retired?/Disabled/Unknown) in model table + dashboard.
3. Metric comparability: PRV_Config_Version stamps every run with config_version;
save-bar warning on scoring-relevant changes; orphaned rows excluded by version.
4. Projected cost at save: PRV_Config::get_projected_cost(); over-cap warning;
prv_last_run_truncated option + visible notice when cap hit mid-run.
5. Config surface: peptide set, intents, cadence (reschedules cron), budget cap;
all validated + sanitized; next-run timestamp shown.
6. API-key three-state: not-defined / defined-ok / defined-failed; derived from
ledger; never displays the key.
7. Run-lock: PRV_Run_Lock (transient); cron tick skips if locked; Run-now
refuses with clear message; lock released in finally block.
8. Design fixes: dark-ink focus ring on bright fills; disabled-row full AA
contrast (no opacity); toggle disabled on retired rows; save-bar-level
warning (role=alert); chip text #B4BDC7 6.83:1 AA; keyboard-sortable headers
(<button>+aria-sort); aria-live on Test chip; z-index:50 save-bar;
run-now double-fire guard; @media print light overrides.
New: PRV_Upgrader (runs migrations on plugins_loaded, not just activation),
PRV_Config_Version, PRV_Run_Lock, PRV_Settings_Page, PRV_Settings_Renderer,
PRV_Model_Manager_Table, PRV_Model_Test_Ajax.
Tests: test-model-registry, test-run-lock, test-config-version,
test-projected-cost, test-cron-reschedule (+ updated probe-runner,
uninstall, bootstrap).
Schema: config_version INT column added via dbDelta (idempotent).
Uninstall: purges all v0.2 prv_* options + transients.
This commit is contained in:
@@ -10,14 +10,16 @@ declare(strict_types=1);
|
||||
/**
|
||||
* Main orchestrator for the PR Vision plugin.
|
||||
*
|
||||
* Boots sub-systems in the correct order, hooks into WP, and keeps
|
||||
* the top-level file under the 300-line limit by delegating all logic
|
||||
* to specialist classes.
|
||||
* Boots sub-systems in the correct order, runs pending data migrations,
|
||||
* hooks into WP, and keeps the top-level file under the 300-line limit by
|
||||
* delegating all logic to specialist classes.
|
||||
*
|
||||
* Who triggers: plugins_loaded action (pr-vision.php).
|
||||
* Dependencies: PRV_Cron, PRV_Admin_Page, PRV_Collector_Registry.
|
||||
* Dependencies: PRV_Upgrader, PRV_Cron, PRV_Admin_Page, PRV_Settings_Page,
|
||||
* PRV_Collector_Registry.
|
||||
*
|
||||
* @see ARCHITECTURE.md — Boot sequence diagram.
|
||||
* @see ARCHITECTURE.md -- Boot sequence diagram.
|
||||
* @see class-prv-upgrader.php -- Runs migrations on every boot.
|
||||
* @package PrVision
|
||||
*/
|
||||
class PRV_Plugin {
|
||||
@@ -25,18 +27,28 @@ class PRV_Plugin {
|
||||
/**
|
||||
* Wire up all WordPress hooks.
|
||||
*
|
||||
* Side effects: Registers admin menus, enqueues assets, and registers the
|
||||
* collector/panel registry.
|
||||
* Migrations run before anything reads from prv_models so the v2 format
|
||||
* is always in place regardless of whether the plugin was freshly activated
|
||||
* or just upgraded from v0.1.x while live.
|
||||
*
|
||||
* Side effects: Registers admin menus, enqueues assets, registers the
|
||||
* collector/panel registry, runs data migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init(): void {
|
||||
// Migrations first -- must run before any config read.
|
||||
PRV_Upgrader::run();
|
||||
|
||||
$cron = new PRV_Cron();
|
||||
$cron->register_hooks();
|
||||
|
||||
if ( is_admin() ) {
|
||||
$page = new PRV_Admin_Page();
|
||||
$page->register_hooks();
|
||||
|
||||
$settings = new PRV_Settings_Page();
|
||||
$settings->register_hooks();
|
||||
}
|
||||
|
||||
// Register the v1 AI-visibility collector + panel.
|
||||
|
||||
Reference in New Issue
Block a user