Commit Graph

2 Commits

Author SHA1 Message Date
peptiderepo
1880d1db1f fix(tests): guard error_log/wp_json_encode stubs + document idempotency limitation
- tests/unit/test-migration-0004.php: wrap error_log() stub in
  function_exists() guard -- prevents PHP fatal redeclaration on
  PHP Lint (8.1/8.2/8.3) which runs php -l on all .php files.

- tests/bootstrap.php: update wp_json_encode stub to accept
  int $flags = 0 second arg (matches production call signature
  wp_json_encode($clean, JSON_UNESCAPED_UNICODE)); guard with
  function_exists().

- class-pr-core-migration-0004-backfill-peptide-meta.php: add
  code comment near idempotency check documenting the all-or-nothing
  limitation (post with legitimately empty aliases will re-run).

- CONVENTIONS.md: one-line note under migration conventions item 5
  documenting the idempotency caveat.

- CHANGELOG.md: add Fixed section under v0.6.0 for CI/test-stub fix.

Agent-Session: peptide-schema-backfill v0.6.0 P1 fix
2026-06-13 05:24:04 +00:00
peptiderepo
1e5999e663 feat(schema): v0.6.0 — PSA backfill migration + Yoast-integrated Drug/MedicalWebPage/FAQ schema
Piece 1 — Backfill migration 0004: copies PSA psa_molecular_formula/weight/aliases
into PR Core _pr_* meta. Idempotent + re-runnable. PubChem REST fallback for 4
posts missing PSA data (MAX_RETRIES=3, exp backoff). All PSA values UNTRUSTED.
PR_CORE_TARGET_SCHEMA_VERSION bumped 3 -> 4.

Piece 2 — Drug node enrichment + stable @id = {permalink}#drug (ratified contract).
Reads _pr_* schema-input meta. molecularWeight in g/mol. Empty-prop guard throughout.

Piece 3 — Yoast-integrated emission via wpseo_schema_graph_pieces (priority 11),
wpseo_schema_webpage_type (MedicalWebPage retype), wpseo_schema_graph (enrichment).
Standalone @graph fallback retained. No duplicate WebPage/BreadcrumbList.
FAQPage emitted only when _pr_faq_items populated.

Supporting: PR_Core_Schema_Sanitizers, PR_Core_Pubchem_Client, CONTEXT.md,
ARCHITECTURE.md, CONVENTIONS.md, CHANGELOG.md, uninstall.php purge.
Tests: test-migration-0004.php (20 assertions), test-jsonld.php (29 assertions).

Agent-Session: peptide-schema-backfill v0.6.0
2026-06-13 05:01:59 +00:00