fix: CodeRabbit re-review of PR #62 (final pass) - #63
Merged
Conversation
Three findings from CodeRabbit's re-review of PR #62: 1. TemplateManagerWriteTest.php: a real test-isolation bug — test_update_template_reports_rollback_failure_when_delete_also_fails() added pre_insert_term/pre_delete_post filters and only removed them after update_template() returned. An unexpected exception from that call would skip both remove_filter() calls, leaking the filters into every later test in the same PHP process (any subsequent wp_insert_term()/wp_delete_post() call would be affected). Wrapped the call in try/finally so cleanup always runs. 2. Same file: added `@var \WP_Error $result` narrowing docblocks after four assertInstanceOf(\WP_Error::class, $result) calls, immediately before each result's get_error_code()/get_error_data() calls. composer analyze is already clean on develop (tests/* is excluded from this repo's own PHPStan paths) — applied because it's a trivial, readability-neutral-to-positive one-liner per site, not because our gate required it. 3. src/tools/templates.ts: list_templates' description said a non-null wp_id "is what makes a template editable via update_template" — false. update_template()'s own description (and behavior) already documents that a wp_id:null template is still editable: calling it creates a new override. Reworded to describe wp_id as existing database backing, matching get_template's accurate framing, without implying editability requires it. Manifest/bundle regenerated for the description change (tool count unchanged at 33). This is the last dispatch on the CodeRabbit-follow-up thread. Claude-Session: https://claude.ai/code/session_013YcSbKroBJjPanX3okQrT3
WalkthroughThe change clarifies ChangesTemplate tooling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Merged
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
CodeRabbit re-reviewed PR #62 and left 3 comments. All 3 verified genuine and fixed — no skips this round.
tests/Templates/TemplateManagerWriteTest.php:514test_update_template_reports_rollback_failure_when_delete_also_fails()registeredpre_insert_term/pre_delete_postfilters and only removed them afterupdate_template()returned. An unexpected exception from that call would skip bothremove_filter()calls, leaking the filters into every later test in the same PHP process — any subsequentwp_insert_term()/wp_delete_post()call anywhere in the suite would be silently affected.try/finallyso cleanup always runs, matching the pattern already used elsewhere in this file.tests/Templates/TemplateManagerWriteTest.php:520$resultasarray|WP_Errorat 4 sites, so theget_error_code()/get_error_data()calls afterassertInstanceOf()fail static analysis.composer analyzeis already clean ondevelop—tests/*is excluded from this repo's own PHPStanpaths, so this was never a real gate failure.@var \WP_Error $resultnarrowing docblocks at all 4 flagged sites — a trivial, readability-neutral-to-positive one-liner each, not a real fix to a real problem.includes/abilities/tools.manifest.json:2119list_templates' description said a non-nullwp_id"is what makes a template editable via update_template" — false.update_template()'s own description (and behavior) already documents that awp_id:nulltemplate is still editable: calling it creates a new override.src/tools/templates.ts'slist_templatesdescription to describewp_idas existing database backing (matchingget_template's already-accurate framing), without implying editability requires it. Manifest + bundle regenerated.Verification
Per the coordinator: this is the last dispatch on the CodeRabbit-follow-up thread — no further re-review chasing after this merges.
Claude-Session: https://claude.ai/code/session_013YcSbKroBJjPanX3okQrT3
Summary by CodeRabbit
Documentation
Tests
💾 Build file (a555fd9).