Commit Graph

3 Commits

Author SHA1 Message Date
peptiderepo
66891267be test(dossier): split DossierMenuRegistrationTest (551→235+198+120 lines, P1 fix) + §22c→§22b (P3 fix)
P1: DossierMenuRegistrationTest.php was 551 lines (cap 300). Split into:
  - DossierMenuRegistrationTestCase.php (120 lines): shared Brain\Monkey harness,
    add_submenu_page spy stub, $submenu isolation — abstract base class.
  - DossierMenuRegistrationTest.php (235 lines): structural invariants (parent slug,
    $submenu non-mutation, page slug constant, asset enqueue gate prefix), deep-link
    URL shape, and hook priority ordering — 7 test methods.
  - DossierHooknameMechanismTest.php (198 lines): request-time hookname faithfulness
    (simulate_request_time_hookname discriminator) and regression proof — 2 test methods.

Method inventory parity: 9 before = 9 after.
  Before: test_request_time_hookname_matches_registration_hookname,
    test_hide_by_unset_would_fail_request_time_check,
    test_dossier_parent_slug_is_options_php, test_no_submenu_mutation_after_registration,
    test_dossier_uses_correct_slug, test_asset_enqueue_gate_uses_admin_page_prefix,
    test_url_for_post_contains_slug_and_post_id, test_url_for_post_exact_shape,
    test_dossier_hook_registered_at_priority_12.
  After: same 9, split 7/2 across two files. Zero assertions dropped.

P3: class-dossier-page.php docblock §22c → §22b (two occurrences).
  No §22c heading exists in ARCHITECTURE.md; convention content is in §22b.

Agent-Session: dossier-403-hotfix-20260612
2026-06-12 11:37:05 +00:00
peptiderepo
ae32876b6b fix: dossier page 403 — options.php-parent pattern (v0.19.3)
Dossier page dead on prod (403) since v0.19.2 deploy. Root cause:
on_register_menu() registered under 'prautoblogger-settings' parent then
unset the slug from $submenu to hide the nav entry. At request time
get_admin_page_parent() scanned $submenu, found nothing, fell back to
orphan hookname 'admin_page_prautoblogger-dossier'. Render callback was
registered under 'prautoblogger_page_prautoblogger-dossier'. Mismatch ->
wp_die(403). Same hookname-mismatch class as the board 404 (v0.19.1).

Fix (seq 21 §Required fix items 1-6):

1. options.php-parent: add_submenu_page('options.php', ...) -> hookname
   is 'admin_page_prautoblogger-dossier' at BOTH registration and request
   time. Hidden by construction; no $submenu mutation needed or permitted.
   Add PARENT_SLUG = 'options.php' constant.

2. Asset enqueue gate: updated from 'prautoblogger_page_*' to
   'admin_page_*' prefix to match options.php-parent hookname.

3. Deep-link URLs (admin.php?page=prautoblogger-dossier&post_id=N):
   parent-agnostic; unchanged. Asserted in
   test_url_for_post_contains_slug_and_post_id +
   test_url_for_post_exact_shape.

4. Regression test upgraded to request-time faithful:
   test_request_time_hookname_matches_registration_hookname simulates
   get_admin_page_parent() against post-registration $submenu state.
   FAILS on v0.19.2 hide-by-unset (4 failures, captured in evidence):
     - test_request_time_hookname_matches_registration_hookname FAIL
     - test_dossier_parent_slug_is_options_php FAIL
     - test_no_submenu_mutation_after_registration FAIL
     - test_asset_enqueue_gate_uses_admin_page_prefix FAIL
   PASSES on v0.19.3 options.php-parent (9/9 OK, captured in evidence).
   test_hide_by_unset_would_fail_request_time_check documents broken
   pattern inline.

5. ARCHITECTURE.md §22b: hidden-page convention cross-reference + v0.19.3
   incident record added. §23: page registration description updated to
   options.php-parent. File tree entry updated.
   CONVENTIONS.md §Hidden Admin Pages: full rule + both incident history
   (board 404 v0.19.1, dossier 403 v0.19.2) + test methodology.

6. Version 0.19.2 -> 0.19.3, CHANGELOG entry. tests/bootstrap.php:
   PRAUTOBLOGGER_PLUGIN_URL + PRAUTOBLOGGER_VERSION constants added
   (resolves 'Undefined constant' in enqueue tests).

Deletion audit: removed lines are the broken 'prautoblogger-settings'
parent string, the 12-line $submenu mutation block, the wrong hook prefix
'prautoblogger_page_*'. No other logic removed.

Agent-Session: dossier-403-hotfix-20260612
2026-06-12 11:18:15 +00:00
peptiderepo
9c8e500244 v0.19.2 - Phase 2 admin M2: Article Dossier + class-prautoblogger split (#158)
Article dossier (Proposal C): per-stage input/output sections w/ raw-trace
toggle, metadata sidebar + per-stage cost receipt, run_decisions rationale,
image section, metabox dossier link, board deep-links. DB-migration methods
extracted to class-db-migrations.php (byte-parity verified by QA).

QA: APPROVE-W-P2 qa-reviews/prautoblogger/2026-06-12-579c66e.md
P2s carried to M3: populate request_json (input trace), sidebar pv
consolidation, image stages in run_stages. Thread: pipeline-v2-phase2-admin seq 16-20

Agent-Session: cto-phase2-admin-m2-merge-20260612
2026-06-12 18:01:39 +07:00