feat: init connection and blocks parser from WP - #2950
petesfrench wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2950 +/- ##
==========================================
+ Coverage 75.84% 77.11% +1.27%
==========================================
Files 20 21 +1
Lines 2596 2845 +249
==========================================
+ Hits 1969 2194 +225
- Misses 627 651 +24
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved access-control, caching, and heading-content issues remain.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a WordPress Gutenberg integration that fetches, parses, and renders hero content through a demo route.
Changes:
- Maps Gutenberg blocks to the
vf_heroschema. - Adds the WordPress demo route and template.
- Adds tests, fixtures, and environment configuration.
File summaries
| File | Summary | Findings |
|---|---|---|
webapp/wordpress.py |
Gutenberg parsing, hero mapping, and API helpers | Moderate (1 vote): preserve sanitized heading HTML. Nit (1 vote): align the signpost contract with behavior. |
webapp/app.py |
WordPress hero demo endpoint | Critical (3 votes): add preview access restrictions. Moderate (3 votes): prevent stale one-hour caching. Nit (1 vote): add route branch tests. |
tests/test_wordpress.py |
Parser and API helper tests | No final comments. |
tests/fixtures/hero_content_raw_wp.html |
WordPress content fixture | No final comments. |
templates/wp-hero-demo.html |
Hero rendering template | No final comments. |
konf/site.yaml |
Demo WordPress secret configuration | No final comments. |
.env |
Local environment placeholders | No final comments. |
Review details
Suppressed comments (3)
webapp/app.py:239
- The new endpoint has no app-level tests;
tests/test_wordpress.pyonly exercises the helpers and never verifies the route's 503, 502, 404, or successful rendered-response branches. Add tests with patched credentials and session so regressions in this externally exposed integration are caught.
@app.route("/wp-hero-demo")
def wp_hero_demo():
webapp/wordpress.py:25
- The module contract says only a second image with the
signpostclass becomessignpost_image, but_is_signpostbelow classifies the first or only matching image that way too (andtest_signpost_imagecodifies that behavior). Update this description to match the implemented mapping, or enforce the second-image rule.
* ``core/image`` -> ``image`` block (a second image with
the ``signpost`` class becomes the
``signpost_image`` block)
webapp/wordpress.py:364
_text()removes all markup before assigning the heading values.vf_heroaccepts HTML intitle_text/subtitle_text(existing templates use elements such as<br>and<sup>), and Gutenberg headings can contain the same inline markup; for example,Take<br>controlbecomesTakecontrol. Preserve the heading's sanitized inner HTML instead of flattening it.
level = block.attrs.get("level", 2)
if level == 1 and not title_text:
title_text = _text(block.inner_html)
elif level == 2 and not subtitle_text:
subtitle_text = _text(block.inner_html)
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # maps it to the vf_hero schema and renders it. Access to this preview route is | ||
| # intended to be restricted at the ingress (VPN IP allowlist), not in the app - | ||
| # see the commented nginx location block in konf/site.yaml. |
| if not hero: | ||
| flask.abort(404, "No hero block found on the configured page.") | ||
|
|
||
| return flask.render_template("wp-hero-demo.html", hero=hero) |
Done
[List of work items including drive-bys]
QA
dotrunIssue / Card
Fixes #
Screenshots
[if relevant, include a screenshot]