From 113f28aff18311cac2c9f713a1a89a4cc2256582 Mon Sep 17 00:00:00 2001 From: Phil Date: Tue, 10 Nov 2026 13:16:19 -0700 Subject: [PATCH] fix: count opted-out likes and reposts without naming them (v2.13.3) Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 +++++ docs/decisions/ADR-073-backfeed.md | 9 ++++++++ docs/design/INDEX.md | 6 ++++- .../v2.13.3/2026-11-10-count-opted-out.md | 22 +++++++++++++++++++ docs/standards/versioning-strategy.md | 2 +- starpunk/__init__.py | 4 ++-- starpunk/backfeed.py | 22 ++++++++++++++++--- templates/partials/responses.html | 5 +++-- tests/test_backfeed.py | 18 +++++++++++++++ 9 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 docs/design/v2.13.3/2026-11-10-count-opted-out.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d629aa7..b7c9331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.13.3] - 2026-11-10 + +### Changed + +- Likes and reposts by people who opted out of backfeed (`#nobridge` or `#nobot` in their profile, or Bluesky's "don't show me to logged-out users" label) are counted in a note's totals, without their name or avatar ("+1 on Bluesky"). Before, they were left out entirely, so totals were lower than on the silo + ## [2.13.2] - 2026-11-10 ### Changed diff --git a/docs/decisions/ADR-073-backfeed.md b/docs/decisions/ADR-073-backfeed.md index 193cce7..44e2bb5 100644 --- a/docs/decisions/ADR-073-backfeed.md +++ b/docs/decisions/ADR-073-backfeed.md @@ -235,6 +235,15 @@ While at it, the Threads client moves from `graph.threads.net` to the same action on each crosspost. No web-action polyfill is loaded; handlers such as browser extensions can use the markup. +## Amendments (v2.13.3, 2026-11-10) + +- **Opted-out people are counted.** Their likes, reposts and quotes are + still not stored or named (Decision 5), but each check records how many + there were on the copy's `syndications` row (`likes_count`, + `reposts_count`, `quotes_count`, the columns Threads' counts use), and + the counts line adds them to the totals as "N on ". Totals then + match the silo. + ## Consequences - Responses on all three silos show on the note within 15 minutes for new diff --git a/docs/design/INDEX.md b/docs/design/INDEX.md index d424e32..53bcc82 100644 --- a/docs/design/INDEX.md +++ b/docs/design/INDEX.md @@ -21,7 +21,7 @@ is in `../architecture/`; decisions are in `../decisions/` (ADRs). ## 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) · [v2.10.2](#v2102) · [v2.11.0](#v2110) · [v2.12.0](#v2120) · [v2.12.1](#v2121) · [v2.13.0](#v2130) · [v2.13.1](#v2131) · [v2.13.2](#v2132) · [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) · [v2.11.0](#v2110) · [v2.12.0](#v2120) · [v2.12.1](#v2121) · [v2.13.0](#v2130) · [v2.13.1](#v2131) · [v2.13.2](#v2132) · [v2.13.3](#v2133) · [hotfix](#hotfix) ## v1.0.0 @@ -434,6 +434,10 @@ OIDC admin login and built-in IndieAuth server. - [2026-11-10-reaction-counts.md](v2.13.2/2026-11-10-reaction-counts.md) - Likes/reposts as a counts line with hover lists; web actions +## v2.13.3 + +- [2026-11-10-count-opted-out.md](v2.13.3/2026-11-10-count-opted-out.md) - Opted-out people's likes and reposts counted without names + ## hotfix Not a release folder. diff --git a/docs/design/v2.13.3/2026-11-10-count-opted-out.md b/docs/design/v2.13.3/2026-11-10-count-opted-out.md new file mode 100644 index 0000000..cfa5bf3 --- /dev/null +++ b/docs/design/v2.13.3/2026-11-10-count-opted-out.md @@ -0,0 +1,22 @@ +# v2.13.3: Count opted-out people without naming them + +## Why + +A note's Bluesky copy had 1 like on Bluesky and 0 on the note. The liker's +account has the `!no-unauthenticated` label, so backfeed skipped them +(ADR-073 Decision 5). Every other Bluesky copy's like and repost counts +matched what StarPunk had stored. + +## Change + +`backfeed.hidden_counts(harvest)`: the silo's own counts when it gives no +names (Threads), else the number of opted-out likes, reposts and quotes in +the harvest. `check()` stores it on the copy's `syndications` row, and the +counts line (v2.13.2) already adds those columns to the totals as +"N on ". Opted-out people are still not stored. + +## Verification + +`tests/test_backfeed.py::test_people_who_opt_out_are_counted_not_named`: +label, `#nobot` and `#nobridge` opt-outs counted (2 likes, 1 repost), not +stored, not named on the page; totals include them. diff --git a/docs/standards/versioning-strategy.md b/docs/standards/versioning-strategy.md index c9d9bf1..3941060 100644 --- a/docs/standards/versioning-strategy.md +++ b/docs/standards/versioning-strategy.md @@ -4,7 +4,7 @@ **Last Updated**: 2026-11-03 (v2.10.1) StarPunk uses [Semantic Versioning 2.0.0](https://semver.org/): -`MAJOR.MINOR.PATCH`, currently **2.13.2**. Every release is a git tag +`MAJOR.MINOR.PATCH`, currently **2.13.3**. Every release is a git tag `vX.Y.Z` and a `CHANGELOG.md` entry. Where the number is stored and how to write the changelog entry is in [version-implementation-guide.md](version-implementation-guide.md); the diff --git a/starpunk/__init__.py b/starpunk/__init__.py index 9d89d38..11763f8 100644 --- a/starpunk/__init__.py +++ b/starpunk/__init__.py @@ -465,5 +465,5 @@ def create_app(config=None): # Package version (Semantic Versioning 2.0.0) # See docs/standards/versioning-strategy.md for details -__version__ = "2.13.2" -__version_info__ = (2, 13, 2) +__version__ = "2.13.3" +__version_info__ = (2, 13, 3) diff --git a/starpunk/backfeed.py b/starpunk/backfeed.py index 4e367af..dd2a6cf 100644 --- a/starpunk/backfeed.py +++ b/starpunk/backfeed.py @@ -64,7 +64,9 @@ class Harvest: """What one check found. complete=False: some list was cut short.""" responses: List[Response] complete: bool = True - counts: Optional[Dict[str, int]] = None # Threads likes/reposts/quotes + # Likes/reposts/quotes shown only as numbers: all of them on Threads + # (its API doesn't say who); elsewhere, those by people who opted out + counts: Optional[Dict[str, int]] = None # --- Text ----------------------------------------------------------------- @@ -243,11 +245,25 @@ def _display_state(db, note_id: int) -> list: )] +def hidden_counts(harvest: Harvest) -> Dict[str, int]: + """ + Likes, reposts and quotes to show only as numbers: the silo's own counts + when it gives no names (Threads), else those by people who opted out + (v2.13.3: they're counted, not named) + """ + if harvest.counts is not None: + return harvest.counts + hidden = [r.kind for r in harvest.responses if _opted_out(r)] + return {k: hidden.count(kind) for k, kind in + (("likes", "like"), ("reposts", "repost"), ("quotes", "quote"))} + + def store(db, note_id: int, target_url: str, origin: str, harvest: Harvest) -> None: """ Upsert a check's responses for one note and silo. With a complete harvest, that silo's responses for the note that weren't found are - marked invalid. Responses from people who opted out are removed. + marked invalid. Responses from people who opted out are removed (they + are counted instead, see `hidden_counts`). """ from starpunk.webmention_processor import _snippet @@ -358,7 +374,7 @@ def check(row, target) -> None: site = current_app.config["SITE_URL"].rstrip("/") harvest = target.client.responses(row["remote_id"], row["remote_url"] or "") store(db, row["note_id"], f"{site}/note/{row['note_slug']}", row["target"], harvest) - _store_counts(db, row["id"], harvest.counts) + _store_counts(db, row["id"], hidden_counts(harvest)) def process_due(limit: int = 3) -> int: diff --git a/templates/partials/responses.html b/templates/partials/responses.html index 8d898d5..e9c98d7 100644 --- a/templates/partials/responses.html +++ b/templates/partials/responses.html @@ -56,8 +56,9 @@ like other sites (v2.13.2). Hovering or focusing a count lists who, and offers the same action on the note's crossposts. Each action is an (https://indieweb.org/webactions) with those silo links as - its fallback, so web action handlers can take over. Counts a silo gives - without names (Threads) are added to the total. The people stay in the + its fallback, so web action handlers can take over. Counts without names + (all of Threads; elsewhere people who opted out, v2.13.3) are added to the + total. The people stay in the markup as u-like / u-repost / u-bookmark h-cites. #} {% set ICONS = { 'like': '', diff --git a/tests/test_backfeed.py b/tests/test_backfeed.py index 9b47392..addfda1 100644 --- a/tests/test_backfeed.py +++ b/tests/test_backfeed.py @@ -604,3 +604,21 @@ def test_own_gotosocial_redirect_to_remote_avatar_is_followed(app, web, monkeypa monkeypatch.setattr("starpunk.webmention_ssrf.TRANSPORT", httpx.MockTransport(fake)) with app.app_context(): assert avatars.fetch(app.config["DATA_PATH"], f"{GTS}/fileserver/x/avatar.jpeg", SITE) + + +def test_people_who_opt_out_are_counted_not_named(app, client): + """v2.13.3: likes and reposts by people who opted out add to the totals anonymously""" + note, sid = crossposted(app) + shy = like(5, opted_out=True) + client.harvest = Harvest([like(1), shy, like(6, bio="#nobot"), + Response(kind="repost", source_url=f"{COPY}#reposted-by-7", remote_id="7", + author_name="Quiet", author_bio="#nobridge")]) + run(app) + with app.app_context(): + s = get_db(app).execute("SELECT likes_count, reposts_count FROM syndications WHERE id = ?", + (sid,)).fetchone() + assert (s["likes_count"], s["reposts_count"]) == (2, 1) + assert [r["source_url"] for r in rows(app, note.id)] == [like(1).source_url] + page = app.test_client().get(f"/note/{note.slug}").get_data(as_text=True) + assert '3' in page and "+2 on GoToSocial" in page + assert "Liker 5" not in page and "Quiet" not in page