feat(publish): wire sanitizer + output-first hero into orchestrator#6
Merged
Conversation
Orchestrator.publish() now: 1. Calls sanitize_body_for_publish() (added in #5) before client.publish() so the JSON command manifest, exec-proof block, and screenshot plan sections never reach the WP draft. No-op fast path when body is clean. 2. Prefers output_*.png over terminal_*.png for the hero image. output_*.png shows command results; terminal_*.png shows the command line, which duplicates the body's code block. 3. Falls back to terminal_*.png when output upload raises PublishError, so a bad output proof never publishes a hero-less post. Implementation notes: - Single iterdir() partition replaces two glob calls (avoids TOCTOU race flagged in codex review). - Body model_copy only fires when sanitizer actually mutates content. Tests added (6 new): - strips_scaffolding_from_body_before_wp_call - clean_body_skips_body_model_copy (sanitizer called once, body unchanged) - dirty_body_triggers_model_copy (sanitized body reaches wp.publish) - prefers_output_screenshot_as_hero - falls_back_to_terminal_when_no_output_image - falls_back_to_terminal_when_output_upload_fails (resilience) WordPressClient mock now spec'd so signature drift fails fast. Closes the deferred follow-up from #5. Sandbox skip-empty-output rule is independent and lands with the sandbox track. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the deferred follow-up from #5. Wires the publish sanitizer (already on main) into `Orchestrator.publish()` and adds an output-first hero image picker with terminal fallback.
Changes
`Orchestrator.publish()` now:
Implementation notes
Tests added (6)
`WordPressClient` mock spec'd so signature drift fails fast.
Test plan
Out of scope
Sandbox skip-empty-output rule (`sandbox_tutorial_media.py`) is independent and lands with the sandbox track.
🤖 Generated with Claude Code