PR Vision v0.1.1: rename from peptide-geo-monitor + P2 fixes

- Exhaustive rename: PGM_ -> PRV_, pgm_ -> prv_, text domain and
  slug peptide-geo-monitor -> pr-vision, admin menu GEO Monitor ->
  PR Vision, main file peptide-geo-monitor.php -> pr-vision.php,
  DB table pgm_ai_visibility -> prv_ai_visibility.
- P2-A: replace ltrim($host,'www.') character-mask with
  str_starts_with/substr prefix strip in PRV_Citation_Detector.
  Adds test coverage for wikipedia.org, webmd.com survival.
- P2-B: drop continue-on-error: true from PHPCS CI step;
  WordPress Coding Standards now gates the build.
- P2-C: remove dead in-run cache from PRV_Probe_Runner::run();
  each (peptide, intent, model) triplet is visited once per run,
  cache hit is structurally impossible.
- Version bump 0.1.0 -> 0.1.1 + CHANGELOG [0.1.1] entry.

Agent-Session: pr-vision rename v0.1.1
This commit is contained in:
peptiderepo
2026-06-13 09:32:56 +00:00
parent 46fda89e18
commit 60ae52663c
39 changed files with 852 additions and 830 deletions

View File

@@ -0,0 +1,94 @@
<?php
declare(strict_types=1);
/**
* Database table creation and schema versioning for PR Vision.
*
* Creates {prefix}prv_ai_visibility via dbDelta (idempotent). Tracks the
* schema version in the prv_schema_version option so future migrations can
* detect when an upgrade is needed without destructive ALTER TABLE.
*
* Who triggers: PRV_Activator::activate() on plugin activation.
* Dependencies: $wpdb global, dbDelta() (requires upgrade.php).
*
* @see class-prv-activator.php — Calls create_table() on activation.
* @see ARCHITECTURE.md — §Storage.
* @package PrVision
*/
class PRV_Table_Manager {
/**
* Name of the custom table (without $wpdb->prefix).
*/
const TABLE_BASE = 'prv_ai_visibility';
/**
* Create or upgrade the AI-visibility table.
*
* Uses dbDelta to create or non-destructively alter the table.
* Records the schema version in an option afterwards.
*
* Side effects: Writes to the database; sets prv_schema_version option.
*
* @return void
*/
public static function create_table(): void {
global $wpdb;
$table_name = $wpdb->prefix . self::TABLE_BASE;
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE {$table_name} (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
run_id VARCHAR(36) NOT NULL,
captured_at DATETIME NOT NULL,
peptide_slug VARCHAR(200) NOT NULL,
peptide_label VARCHAR(200) NOT NULL,
model VARCHAR(200) NOT NULL,
prompt_intent VARCHAR(200) NOT NULL,
cited TINYINT(1) NOT NULL DEFAULT 0,
our_position INT(11) NULL DEFAULT NULL,
source_domains LONGTEXT NOT NULL DEFAULT '',
raw_excerpt LONGTEXT NOT NULL DEFAULT '',
cost_usd DECIMAL(12,8) NOT NULL DEFAULT 0.00000000,
PRIMARY KEY (id),
KEY run_id (run_id),
KEY peptide_slug (peptide_slug),
KEY captured_at (captured_at)
) {$charset_collate};";
if ( ! function_exists( 'dbDelta' ) ) {
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
}
dbDelta( $sql );
update_option( 'prv_schema_version', PRV_SCHEMA_VERSION );
}
/**
* Get the full table name including the WP prefix.
*
* @return string
*/
public static function get_table_name(): string {
global $wpdb;
return $wpdb->prefix . self::TABLE_BASE;
}
/**
* Drop the AI-visibility table entirely.
*
* Called only from uninstall.php — never during normal deactivation.
*
* Side effects: Permanently destroys all probe data.
*
* @return void
*/
public static function drop_table(): void {
global $wpdb;
$table = $wpdb->prefix . self::TABLE_BASE;
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$wpdb->query( "DROP TABLE IF EXISTS {$table}" );
}
}