fix: array_merge P0 + restore check-constants self-test P1 (v0.22.0)

P0: replace `+` array union with array_merge() in
Settings_Fields_Extended::get_fields(). PHP `+` keeps left-side keys
when both arrays are integer-indexed — silently drops all 11 image fields
(indexes 0–10 collide with indexes 0–10 of the local array). array_merge()
is already the operator used by the parent class at class-settings-fields.php:84.

P1: restore `php scripts/check-constants.php --self-test` step in the
check-constants CI job. Step was present in v0.21.0 and accidentally dropped
in the CI rewrite. Script logic is intact; CI now exercises it again.

Also adds SettingsFieldsExtendedTest (3 assertions) as a regression guard:
cardinality (29 = 18 local + 11 image), presence check, and per-field
id/section contract. If a + union ever re-appears, test_get_fields_returns_29_fields
fails with a message naming the root cause.

Agent-Session: engineer-infra-prab-p0fix-20260616
This commit is contained in:
peptiderepo
2026-06-16 14:38:46 +00:00
parent 7217c154bb
commit 0bac82be52
3 changed files with 86 additions and 2 deletions

View File

@@ -46,3 +46,8 @@ jobs:
# by defined() at the reference site. Prevents the v0.19.0 incident
# class (constant deleted from bootstrap, test fallback masks the gap).
run: php scripts/check-constants.php
- name: Self-test check-constants scanner
# Verifies the scanner itself can detect the failure cases it was
# designed to catch. If the scanner regresses, this step fails CI.
# Added v0.21.0; restored in v0.22.0 (was accidentally dropped in rewrite).
run: php scripts/check-constants.php --self-test