Files
prautoblogger/INFORMATION-ARCHITECTURE.md
PRAutoBlogger Engineer baae383c76 feat: Pipeline Settings M4 — generation history list + per-step I/O drill-down (v0.26.0)
CEO ask #5 complete: browsable paginated run list + full input/output inspection
per pipeline stage.

## What was built

### Generations list (prautoblogger-gen-history)
Hidden admin page (options.php-parent, priority 14) showing all pipeline runs newest
first, 20 per page. Each row: article title (linked to dossier when a post exists),
start date, status chip, distinct model(s), settled cost, duration. Queries bounded
(LIMIT/OFFSET) — no unbounded SELECT *.

New files:
- includes/admin/class-gen-history-query.php — paginated run list + per-run I/O queries
- includes/admin/class-gen-history-page.php  — hidden admin page + asset enqueue
- assets/css/gen-history.css, assets/js/gen-history.js — table + drill-down UI
- templates/admin/gen-history-page.php       — HTML template

### Per-step input + output drill-down (Stage I/O)
'Stage I/O' toggle opens an AJAX-loaded inline panel. For each generation_log stage:
  - input_system: system-role message content from generation_log.request_json
  - input_user: last user-role message from request_json (rendered instruction)
  - output: model response from run_stages.meta_json.output
  - output_pruned: true when meta_json present but output key absent (retention prune)

New AJAX endpoint: prautoblogger_gen_run_io (manage_options + nonce)
New file: includes/ajax/class-gen-run-io-handler.php

### gen-log INPUT/OUTPUT coverage verified
- INPUT: generation_log.request_json stores the chat body WITHOUT the Authorization
  header (Request_Recorder captures body after build_body(), before headers are added).
  System + user message content extracted and surfaced.
- OUTPUT: run_stages.meta_json.output is the LLM response text (Run_Stage_State::done()).
  Image/log-only stages (image_a, image_b, llm_research, image_prompt_rewrite) have no
  run_stages row; output is null, NOT pruned. Pruned outputs are flagged honestly.

### Dossier as entry point
Runs with a linked post show a 'Dossier' button deep-linking into the existing dossier
(which renders full per-stage I/O with editorial context). Stage I/O is complementary —
works for failed/orphan runs and provides the same data in a lighter inline UI.

### Stage-list-driven
Stage labels via Stage_Display_Map::label() — Phase 2b curate/seo appear automatically.

### Dead prautoblogger_pipeline_history endpoint
Not dead — it IS used by pipeline-settings.js for prompt version history (M3 feature).
Left in place. No dangling endpoint.

## M3 P2 sweep
- Removed dead data-preview-nonce and data-diff-nonce HTML attrs from
  pipeline-settings-prompt-panel.php (JS uses prabPipeline.*Nonce from
  wp_localize_script, not data-* attrs — confirmed by grep).
- Removed 3 redundant wp_create_nonce() calls from class-pipeline-settings-renderer.php
  (preview_nonce, history_nonce, diff_nonce keys that fed the now-removed dead attrs).
- Updated CONTEXT.md: added M3 + M4 terminology tables.
- Updated ARCHITECTURE.md: added ajax/ section to file tree; M3/M4 design notes.
- Updated INFORMATION-ARCHITECTURE.md: prautoblogger-gen-history entry.

## Security
- manage_options cap + prautoblogger_gen_run_io nonce on the AJAX endpoint.
- All output esc_html()/esc_url() server-side before JSON-encoding.
- JS renders prompt/response text via textContent — never innerHTML.
- No writes from history UI; request_json never contains auth headers.

## Version: v0.25.0 → v0.26.0

Agent-Session: pipeline-settings-m4
2026-06-23 06:57:54 +00:00

4.7 KiB

Information Architecture — PRAutoBlogger

Auto-generated index of all admin surfaces, data flows, and integrations. Maintained per DoD v1.1.0 (same-PR update rule).


Admin Pages

Slug Class Template Purpose
prautoblogger-settings PRAutoBlogger_Admin_Page admin-page.php Main settings: API Keys, Schedule & Budget, Publishing, Analytics, Display, Images. AI Models / Content / Sources retired to Pipeline Settings in M2 (v0.24.0).
prautoblogger-board PRAutoBlogger_Board_Page board-page.php Kanban board: Generating / Failed / In Review / Published columns. New Article button (v0.21.0).
prautoblogger-pipeline PRAutoBlogger_Pipeline_Settings_Page pipeline-settings-page.php Per-step pipeline config: Global Content Context (niche), step option fields, model picker, system instructions, agent prompts, params (M1 v0.23.0; M2 v0.24.0 adds editable step options, retires AI Models/Content/Sources Settings tabs). M3 v0.25.0 adds Template/Preview toggle (assembled-instructions preview from last-run gen_log), version history accordion, and inline diff panel. Three new AJAX endpoints: prautoblogger_pipeline_preview, prautoblogger_pipeline_history, prautoblogger_pipeline_diff (all manage_options + nonce gated).
prautoblogger-gen-history PRAutoBlogger_Gen_History_Page gen-history-page.php M4: Paginated list of all generation runs — title, date, status, models, cost, duration; Stage I/O toggle for inline per-step input/output drill-down (AJAX). Hidden options.php-parent page. manage_options + prautoblogger_gen_run_io nonce.
prautoblogger-dossier PRAutoBlogger_Dossier_Page dossier-page.php Per-article generation log + stage edit/re-run (M3). Preferred per-step I/O surface for runs with a linked post.
prautoblogger-ideas PRAutoBlogger_Ideas_Browser ideas-browser.php Analysis results browser with per-idea generation
prautoblogger-activity PRAutoBlogger_Activity_Page activity-page.php Cost + generation activity log

Generation Entry Points (v0.21.0)

Board "New Article" button
  └─ AJAX prautoblogger_generate_now
       └─ Generation_Status_Poller::on_ajax_generate_now()
            └─ schedules prautoblogger_manual_generation cron
                 └─ Executor::on_manual_generation()
                      └─ Generation_Checkpoint_Runner::on_orchestrate_tick()  ← Tick 1
                           └─ schedules prautoblogger_gen_tick
                                └─ Generation_Checkpoint_Runner::on_generate_tick()  ← Tick 2..N

WP-CLI: wp prautoblogger generate
  └─ WP_CLI_Commands::generate_command()
       └─ Generation_Checkpoint_Runner::kick_off()
            └─ schedules prautoblogger_gen_orchestrate
                 └─ Generation_Checkpoint_Runner::on_orchestrate_tick()  ← Tick 1

Daily auto-generation cron
  └─ prautoblogger_daily_generation
       └─ Executor::on_cron_run()
            └─ Pipeline_Runner::run()  (legacy synchronous path — runs in a single PHP process)

Database Tables

Table DB Version Purpose
prautoblogger_sources 1.0.0 Collected Reddit/RSS source content
prautoblogger_analysis_results 1.0.0 Scored article ideas
prautoblogger_generation_log 1.0.0 Per-LLM-call log (cost, tokens, status)
prautoblogger_runs 1.0.0 Per-run ledger (status, ceiling_usd)
prautoblogger_run_stages 1.2.0 Per-stage state for M3 re-run
prautoblogger_stage_inputs 1.3.0 Immutable input versions for stage edits (M3)
prautoblogger_run_decisions 1.2.0 Editorial decisions per run

DB version history: 1.0→1.1 (schema normalisation), 1.1→1.2 (M2 dossier), 1.2→1.3 (M3 stage inputs), 1.3→1.4 (M4 indexes).


Key Options

Option Type Default Purpose
prautoblogger_board_column_limit int 20 Max cards per board column
prautoblogger_ideas_per_page int 30 Ideas browser page size
prautoblogger_article_queue array — Checkpoint queue (run_id + ideas + results)
prautoblogger_checkpoint_run_id string — Current run UUID for Tick 2..N finalize path
prautoblogger_db_version string — Installed schema version (triggers dbDelta on mismatch)

WP-CLI Commands

Command Since Description
wp prautoblogger generate 0.21.0 Queue article generation via chained-cron checkpoints
wp prautoblogger opik:eval 0.12.0 Trigger Opik eval run

Last updated: v0.24.0 (2026-06-23)