From 2aa35da61f2a55eb08d02ee135710fabbc8d8049 Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Tue, 16 Jun 2026 13:24:51 +0000 Subject: [PATCH] fix(tests): restore tested proxy methods in PSA_AI_Generator AIGeneratorTest accesses build_validation_prompt() and build_generation_prompt() via ReflectionClass - confirmed by running CI. Restored both as compact single-docblock proxies to PSA_AI_Content. Condensed section headers to keep file under 300 lines (now 299). Agent-Session: claude-sonnet-4-6-adopt-ci-20260616 --- CHANGELOG.md | 2 +- includes/class-psa-ai-generator.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4031e08..06765c7 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `.github/workflows/ci.yml`: replaced per-repo CI jobs with thin caller for the reusable `peptiderepo/peptide-e2e/.github/workflows/ci.yml@main` (tests: stubs, has_js: true). Adds blocking PHPCS, 300-line file-size enforcement, and phpcbf auto-commit on PRs. - `.github/workflows/deploy.yml`: dropped redundant file-existence and PHP-syntax checks now covered by the reusable CI; kept PSA_VERSION constant check. - `includes/class-psa-admin.php`: removed dead backward-compat proxy methods (all delegated to `PSA_Admin_Page`; zero external callers). File reduced from 327 → 290 lines (estate 300-line rule compliance). -- `includes/class-psa-ai-generator.php`: removed dead backward-compat proxy methods (all delegated to `PSA_AI_Content`; zero external callers). File reduced from 309 → 292 lines. +- `includes/class-psa-ai-generator.php`: removed untested backward-compat proxies (save_peptide_meta, assign_category_term); retained build_validation_prompt and build_generation_prompt as tested proxies (AIGeneratorTest uses reflection). Section headers condensed. File 309 → 299 lines. - `includes/class-psa-search.php`: removed dead backward-compat proxy methods (all delegated to `PSA_Search_Handler`; zero external callers). File reduced from 307 → 294 lines. - `peptide-search-ai.php`: synced `PSA_VERSION` constant (was stuck at 4.5.0) with plugin header (was 4.6.0); both now 4.7.0. - `package.json` / `package-lock.json`: added minimal npm manifest (no dependencies) so the reusable `lint-js` job can run `npm ci` and fall back to `node --check` on the three JS asset files. diff --git a/includes/class-psa-ai-generator.php b/includes/class-psa-ai-generator.php index 2722fba..5e95ec4 100755 --- a/includes/class-psa-ai-generator.php +++ b/includes/class-psa-ai-generator.php @@ -237,8 +237,6 @@ class PSA_AI_Generator { ); } - // ── Private helpers ───────────────────────────────────────────────── - /** * Get plugin settings with defaults, decrypted API key, and constant override. * @@ -288,4 +286,14 @@ class PSA_AI_Generator { } return true; } + + /** @see PSA_AI_Content::build_validation_prompt() — kept for test reflection. */ + public static function build_validation_prompt( string $name ): string { + return PSA_AI_Content::build_validation_prompt( $name ); + } + + /** @see PSA_AI_Content::build_generation_prompt() — kept for test reflection. */ + public static function build_generation_prompt( string $peptide_name ): string { + return PSA_AI_Content::build_generation_prompt( $peptide_name ); + } }