Merge branch 'fix/v2.10.2-reply-context' for v2.10.2 release
Build Container / build (push) Successful in 7m43s
Build Container / build (push) Successful in 7m43s
This commit is contained in:
commit
9f17e145ff
8 files changed
+103
-5
No files matched your search
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [2.10.2] - 2026-11-03
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- The context shown above replies, likes and reposts (the post being replied to: its title, author and text) was never fetched since v2.7.0: a change to the shared fetcher wasn't carried over, so every new context was saved as an error and the note showed only the bare link. Relative links on the other page now also resolve against its address after redirects
|
||||||
|
|
||||||
## [2.10.1] - 2026-11-03
|
## [2.10.1] - 2026-11-03
|
||||||
|
|
||||||
WebSub fixes from an adversarial review of v2.10.0 against the [W3C Recommendation](https://www.w3.org/TR/websub/) (details in ADR-071, Amendments).
|
WebSub fixes from an adversarial review of v2.10.0 against the [W3C Recommendation](https://www.w3.org/TR/websub/) (details in ADR-071, Amendments).
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ is in `../architecture/`; decisions are in `../decisions/` (ADRs).
|
|||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
[v1.0.0](#v100) · [v1.1.1](#v111) · [v1.1.2](#v112) · [v1.2.0](#v120) · [v1.3.0](#v130) · [v1.3.1](#v131) · [v1.4.0](#v140) · [v1.4.1](#v141) · [v1.4.2](#v142) · [v1.5.0](#v150) · [v1.6.0](#v160) · [v2.0.0](#v200) · [v2.0.1](#v201) · [v2.0.2](#v202) · [v2.1.0](#v210) · [v2.2.0](#v220) · [v2.3.0](#v230) · [v2.3.1](#v231) · [v2.3.2](#v232) · [v2.3.3](#v233) · [v2.4.0](#v240) · [v2.5.0](#v250) · [v2.6.0](#v260) · [v2.6.1](#v261) · [v2.6.2](#v262) · [v2.6.3](#v263) · [v2.6.4](#v264) · [v2.6.5](#v265) · [v2.6.6](#v266) · [v2.6.7](#v267) · [v2.6.8](#v268) · [v2.6.9](#v269) · [v2.7.0](#v270) · [v2.7.1](#v271) · [v2.7.2](#v272) · [v2.8.0](#v280) · [v2.8.1](#v281) · [v2.9.0](#v290) · [v2.10.0](#v2100) · [v2.10.1](#v2101) · [hotfix](#hotfix)
|
[v1.0.0](#v100) · [v1.1.1](#v111) · [v1.1.2](#v112) · [v1.2.0](#v120) · [v1.3.0](#v130) · [v1.3.1](#v131) · [v1.4.0](#v140) · [v1.4.1](#v141) · [v1.4.2](#v142) · [v1.5.0](#v150) · [v1.6.0](#v160) · [v2.0.0](#v200) · [v2.0.1](#v201) · [v2.0.2](#v202) · [v2.1.0](#v210) · [v2.2.0](#v220) · [v2.3.0](#v230) · [v2.3.1](#v231) · [v2.3.2](#v232) · [v2.3.3](#v233) · [v2.4.0](#v240) · [v2.5.0](#v250) · [v2.6.0](#v260) · [v2.6.1](#v261) · [v2.6.2](#v262) · [v2.6.3](#v263) · [v2.6.4](#v264) · [v2.6.5](#v265) · [v2.6.6](#v266) · [v2.6.7](#v267) · [v2.6.8](#v268) · [v2.6.9](#v269) · [v2.7.0](#v270) · [v2.7.1](#v271) · [v2.7.2](#v272) · [v2.8.0](#v280) · [v2.8.1](#v281) · [v2.9.0](#v290) · [v2.10.0](#v2100) · [v2.10.1](#v2101) · [v2.10.2](#v2102) · [hotfix](#hotfix)
|
||||||
|
|
||||||
## v1.0.0
|
## v1.0.0
|
||||||
|
|
||||||
@@ -406,6 +406,10 @@ OIDC admin login and built-in IndieAuth server.
|
|||||||
|
|
||||||
- [2026-11-03-websub-hardening.md](v2.10.1/2026-11-03-websub-hardening.md) — WebSub hardening (implementation report) *(reconstructed)*
|
- [2026-11-03-websub-hardening.md](v2.10.1/2026-11-03-websub-hardening.md) — WebSub hardening (implementation report) *(reconstructed)*
|
||||||
|
|
||||||
|
## v2.10.2
|
||||||
|
|
||||||
|
- [2026-11-03-reply-context-fetch.md](v2.10.2/2026-11-03-reply-context-fetch.md) - Reply contexts fetched again (fetch_source returns three values since v2.7.0)
|
||||||
|
|
||||||
## hotfix
|
## hotfix
|
||||||
|
|
||||||
Not a release folder.
|
Not a release folder.
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# v2.10.2: Reply context fetch
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
`webmention_processor.fetch_source()` has returned
|
||||||
|
`(content, content_type, final_url)` since v2.7.0, but
|
||||||
|
`reply_context.fetch_reply_context()` still unpacked two values. The
|
||||||
|
`ValueError` was caught by its generic handler, so every new reply, like and
|
||||||
|
repost context was stored with `fetch_status='error'`. Found during the
|
||||||
|
documentation refresh (docs/design/v1.6.0/database-schema.md). Production had
|
||||||
|
no reply-context rows yet, so nothing needed repairing.
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- `starpunk/reply_context.py`: unpack three values; parse microformats with
|
||||||
|
the final URL so relative links (author URL, photos) resolve correctly.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
`tests/test_reply_context_fetch.py` runs `fetch_reply_context` through the
|
||||||
|
mocked network (other tests stub it out, which is why this went unnoticed).
|
||||||
|
It fails on v2.10.1.
|
||||||
@@ -46,3 +46,4 @@ Future work and per-release plans. See `../DOCUMENTATION.md` (PROJECTPLAN).
|
|||||||
- **[v2.9.0](v2.9.0/RELEASE.md)** - Micropub review (Released 2026-11-03)
|
- **[v2.9.0](v2.9.0/RELEASE.md)** - Micropub review (Released 2026-11-03)
|
||||||
- **[v2.10.0](v2.10.0/RELEASE.md)** - WebSub (Released 2026-11-03)
|
- **[v2.10.0](v2.10.0/RELEASE.md)** - WebSub (Released 2026-11-03)
|
||||||
- **[v2.10.1](v2.10.1/RELEASE.md)** - WebSub hardening (Released 2026-11-03)
|
- **[v2.10.1](v2.10.1/RELEASE.md)** - WebSub hardening (Released 2026-11-03)
|
||||||
|
- **[v2.10.2](v2.10.2/RELEASE.md)** - Reply context fetch fix (Released 2026-11-03)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# v2.10.2
|
||||||
|
|
||||||
|
- **Date**: 2026-11-03
|
||||||
|
- **Status**: Released
|
||||||
|
|
||||||
|
## Bugs fixed
|
||||||
|
|
||||||
|
- Reply, like and repost contexts were never fetched since v2.7.0 (stored as errors); fixed, with relative links resolved after redirects
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [CHANGELOG](../../../CHANGELOG.md)
|
||||||
|
- [Design note](../../design/v2.10.2/2026-11-03-reply-context-fetch.md)
|
||||||
@@ -470,5 +470,5 @@ def create_app(config=None):
|
|||||||
|
|
||||||
# Package version (Semantic Versioning 2.0.0)
|
# Package version (Semantic Versioning 2.0.0)
|
||||||
# See docs/standards/versioning-strategy.md for details
|
# See docs/standards/versioning-strategy.md for details
|
||||||
__version__ = "2.10.1"
|
__version__ = "2.10.2"
|
||||||
__version_info__ = (2, 10, 1)
|
__version_info__ = (2, 10, 2)
|
||||||
@@ -76,14 +76,16 @@ def fetch_reply_context(
|
|||||||
# Fetch and parse context
|
# Fetch and parse context
|
||||||
try:
|
try:
|
||||||
# Fetch URL content
|
# Fetch URL content
|
||||||
content, content_type = fetch_source(reply_url, site_url)
|
# fetch_source also returns the URL after redirects (v2.7.0); relative
|
||||||
|
# links in the page resolve against it (v2.10.2)
|
||||||
|
content, content_type, final_url = fetch_source(reply_url, site_url)
|
||||||
|
|
||||||
# Parse microformats (only for HTML)
|
# Parse microformats (only for HTML)
|
||||||
if 'html' not in content_type.lower():
|
if 'html' not in content_type.lower():
|
||||||
# Not HTML - store minimal context
|
# Not HTML - store minimal context
|
||||||
return _store_minimal_context(db_path, reply_url, "Not HTML content")
|
return _store_minimal_context(db_path, reply_url, "Not HTML content")
|
||||||
|
|
||||||
parsed_mf2 = mf2py.parse(doc=content, url=reply_url)
|
parsed_mf2 = mf2py.parse(doc=content, url=final_url)
|
||||||
|
|
||||||
# Extract h-entry data
|
# Extract h-entry data
|
||||||
entry_data = _extract_entry_data(parsed_mf2)
|
entry_data = _extract_entry_data(parsed_mf2)
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
"""
|
||||||
|
Reply contexts are fetched for real (v2.10.2)
|
||||||
|
|
||||||
|
v2.7.0 made fetch_source return (content, content_type, final_url) but
|
||||||
|
fetch_reply_context still unpacked two values, so every new reply, like and
|
||||||
|
repost stored fetch_status='error'. Other tests stub fetch_reply_context out;
|
||||||
|
this one runs it through the mocked network.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from starpunk.reply_context import fetch_reply_context
|
||||||
|
|
||||||
|
PUBLIC = [(2, 1, 6, "", ("93.184.216.34", 0))]
|
||||||
|
|
||||||
|
PAGE = """<html><head><title>Their site</title></head><body>
|
||||||
|
<article class="h-entry">
|
||||||
|
<h1 class="p-name">A post worth replying to</h1>
|
||||||
|
<a class="p-author h-card" href="/about">Ada Example</a>
|
||||||
|
<time class="dt-published" datetime="2026-11-01T10:00:00Z">Nov 1</time>
|
||||||
|
<div class="e-content"><p>Some thoughts.</p></div>
|
||||||
|
</article></body></html>"""
|
||||||
|
|
||||||
|
|
||||||
|
def test_reply_context_is_fetched_and_stored(app, monkeypatch):
|
||||||
|
def site(request):
|
||||||
|
if request.url.path == "/old":
|
||||||
|
return httpx.Response(301, headers={"Location": "https://their.example/posts/1"})
|
||||||
|
return httpx.Response(200, html=PAGE)
|
||||||
|
|
||||||
|
monkeypatch.setattr("starpunk.webmention_ssrf.socket.getaddrinfo", lambda *a, **k: PUBLIC)
|
||||||
|
monkeypatch.setattr("starpunk.webmention_ssrf.TRANSPORT", httpx.MockTransport(site))
|
||||||
|
|
||||||
|
with app.app_context():
|
||||||
|
context = fetch_reply_context(app.config["DATABASE_PATH"], "https://their.example/old",
|
||||||
|
app.config["SITE_URL"])
|
||||||
|
|
||||||
|
assert context["fetch_status"] == "fetched", context
|
||||||
|
assert context["title"] == "A post worth replying to"
|
||||||
|
assert context["author_name"] == "Ada Example"
|
||||||
|
# Relative links resolve against the URL after the redirect
|
||||||
|
assert context["author_url"] == "https://their.example/about"
|
||||||
|
assert "Some thoughts" in (context["content_snippet"] or "")
|
||||||
|
|
||||||
|
row = sqlite3.connect(app.config["DATABASE_PATH"]).execute(
|
||||||
|
"SELECT fetch_status FROM reply_contexts WHERE url = ?", ("https://their.example/old",)
|
||||||
|
).fetchone()
|
||||||
|
assert row == ("fetched",)
|
||||||
Reference in new issue
Block a user