QA review of 88a4ae9 caught that UpgradeTest.php requires peptide-search-ai.php
(to access the pure helper psa_upgrade_needed) but did not stub add_action or
add_filter. The plugin file calls those at top level (lines 47, 53, 146, 265),
so the test would fatal on load with "Call to undefined function add_action".
Follows the stub pattern used in PostTypeTest.php.
Agent-Session: cowork-qa-p1-fixes-20260414
Addresses the three P1 findings from QA baseline review of a8a0ce2:
1. uninstall.php: delete psa_db_version option on plugin removal so no
orphaned data is left behind — satisfies AGENT-OPERATING-STANDARD
teardown/uninstall DoD.
2. Extract psa_upgrade_needed( $stored, $current ) as a pure function and
add tests/unit/UpgradeTest.php covering fresh-install, same-version,
future-version, and older-version scenarios. The impure wrapper
psa_maybe_run_upgrades() now delegates the decision to the pure helper.
3. Document the psa_db_version option and the admin_init-triggered
upgrade mechanism in ARCHITECTURE.md (Options section), including
why admin_init, downgrade behavior, cleanup, and testability.
No behavioral change for end users — same upgrade semantics, just
testable and documented, with proper teardown.
Agent-Session: cowork-qa-p1-fixes-20260414