Add ActivityPub engagement ingestion #19

Closed
opened 2026-05-19 19:51:44 -05:00 by erik · 4 comments
Owner

Goal

Store incoming ActivityPub likes and boosts for local posts through the Fedify inbox foundation so the existing read-only engagement API routes show real network activity.

The management API engagement routes are view-only:

  • GET /api/v1/posts/{slug}/engagement
  • GET /api/v1/posts/{slug}/likes
  • GET /api/v1/posts/{slug}/boosts

Likes and boosts should be created by ActivityPub/Fediverse inbound activity handling, not by management API write routes.

Requirements

  • Handle incoming ActivityPub Like activities targeting local posts through the existing Fedify federation route setup.
  • Handle incoming ActivityPub Announce activities targeting local posts as boosts through the Fedify inbox foundation.
  • Avoid adding custom raw inbox routes outside Fedify for ActivityPub protocol handling.
  • Resolve or extract actor profile URL, display name, and handle where available.
  • Store engagement records in post_engagements with kind = like or kind = boost.
  • Deduplicate by stable activity identifier such as activity_url.
  • Ignore or reject activities targeting unknown or non-local posts.
  • Preserve existing engagement API response shapes.
  • Keep reply/comment ingestion in its dedicated task.
  • Add tests for like ingestion, boost ingestion, duplicate handling, unknown target handling, and engagement API visibility after ingestion.

Acceptance criteria

  • Incoming Like handled through Fedify for a local post creates a post_engagements row with kind = like.
  • Incoming Announce handled through Fedify for a local post creates a post_engagements row with kind = boost.
  • Duplicate activities do not create duplicate engagement rows.
  • Activities targeting unknown posts do not affect engagement counts.
  • Engagement summary includes counts from ingested ActivityPub likes and boosts.
  • Like and boost list endpoints expose ingested actor/activity data.
  • Existing engagement API response shapes are unchanged.
  • No duplicate hand-rolled ActivityPub inbox routes are added outside the Fedify route setup.
  • Relevant tests and checks pass.

Dependencies

  • task-e025ad45
  • task-2775b988
## Goal Store incoming ActivityPub likes and boosts for local posts through the Fedify inbox foundation so the existing read-only engagement API routes show real network activity. The management API engagement routes are view-only: - `GET /api/v1/posts/{slug}/engagement` - `GET /api/v1/posts/{slug}/likes` - `GET /api/v1/posts/{slug}/boosts` Likes and boosts should be created by ActivityPub/Fediverse inbound activity handling, not by management API write routes. ## Requirements - Handle incoming ActivityPub `Like` activities targeting local posts through the existing Fedify federation route setup. - Handle incoming ActivityPub `Announce` activities targeting local posts as boosts through the Fedify inbox foundation. - Avoid adding custom raw inbox routes outside Fedify for ActivityPub protocol handling. - Resolve or extract actor profile URL, display name, and handle where available. - Store engagement records in `post_engagements` with `kind = like` or `kind = boost`. - Deduplicate by stable activity identifier such as `activity_url`. - Ignore or reject activities targeting unknown or non-local posts. - Preserve existing engagement API response shapes. - Keep reply/comment ingestion in its dedicated task. - Add tests for like ingestion, boost ingestion, duplicate handling, unknown target handling, and engagement API visibility after ingestion. ## Acceptance criteria - [ ] Incoming `Like` handled through Fedify for a local post creates a `post_engagements` row with `kind = like`. - [ ] Incoming `Announce` handled through Fedify for a local post creates a `post_engagements` row with `kind = boost`. - [ ] Duplicate activities do not create duplicate engagement rows. - [ ] Activities targeting unknown posts do not affect engagement counts. - [ ] Engagement summary includes counts from ingested ActivityPub likes and boosts. - [ ] Like and boost list endpoints expose ingested actor/activity data. - [ ] Existing engagement API response shapes are unchanged. - [ ] No duplicate hand-rolled ActivityPub inbox routes are added outside the Fedify route setup. - [ ] Relevant tests and checks pass. ## Dependencies - task-e025ad45 - task-2775b988
Collaborator

Synced from todu comment by @todu on 2026-05-31T04:16:04.291Z

Review update

  • PR: #77
  • Result: approved
  • Verification: make check, ./scripts/pre-pr.sh, and Forgejo CI CI / build-lint-test (pull_request) passed.
  • Acceptance criteria: 7/7 met.
  • Follow-up: waiting for explicit human merge approval.
_Synced from todu comment by @todu on 2026-05-31T04:16:04.291Z_ ### Review update - PR: https://forge.caradoc.com/erik/slugkit/pulls/77 - Result: approved - Verification: `make check`, `./scripts/pre-pr.sh`, and Forgejo CI `CI / build-lint-test (pull_request)` passed. - Acceptance criteria: 7/7 met. - Follow-up: waiting for explicit human merge approval.
Collaborator

Synced from todu comment by @todu on 2026-05-31T04:27:12.660Z

Completed

  • Implemented authenticated engagement API routes for summary, likes, and boosts.
  • Added protocol-neutral post_engagements persistence for like and boost records.
  • Added engagement summaries with like count, boost count, total comment count, and pending comment count.
  • Added likes and boosts actor list responses using profile URL, display name, handle, activity URL, object URL, and received timestamp.
  • Added shared missing-post 404 behavior and standardized 501 Not Implemented behavior when engagement storage is unavailable.
  • Documented all engagement routes in OpenAPI with operation IDs posts.engagement.get, posts.engagement.likes.list, and posts.engagement.boosts.list.
  • Added tests for auth, summary, likes, boosts, missing post, unsupported behavior, OpenAPI coverage, and migration coverage.
  • Verified with make check, ./scripts/pre-pr.sh, and passing Forgejo CI.
  • Merged PR #77 into main.
_Synced from todu comment by @todu on 2026-05-31T04:27:12.660Z_ ### Completed - Implemented authenticated engagement API routes for summary, likes, and boosts. - Added protocol-neutral `post_engagements` persistence for `like` and `boost` records. - Added engagement summaries with like count, boost count, total comment count, and pending comment count. - Added likes and boosts actor list responses using profile URL, display name, handle, activity URL, object URL, and received timestamp. - Added shared missing-post `404` behavior and standardized `501 Not Implemented` behavior when engagement storage is unavailable. - Documented all engagement routes in OpenAPI with operation IDs `posts.engagement.get`, `posts.engagement.likes.list`, and `posts.engagement.boosts.list`. - Added tests for auth, summary, likes, boosts, missing post, unsupported behavior, OpenAPI coverage, and migration coverage. - Verified with `make check`, `./scripts/pre-pr.sh`, and passing Forgejo CI. - Merged PR #77 into `main`.
erik changed title from Implement engagement API routes to Add ActivityPub engagement ingestion 2026-06-03 07:26:51 -05:00
Author
Owner

Synced from todu comment by @todu on 2026-06-06T04:37:40.491Z

Review update

  • PR: #120 open, CI green.
  • Result: approved.
  • Criteria: 9/9 met, 0 blocking issues, 0 warnings.
  • Follow-up: stop at human merge approval gate.
_Synced from todu comment by @todu on 2026-06-06T04:37:40.491Z_ ### Review update - PR: #120 open, CI green. - Result: approved. - Criteria: 9/9 met, 0 blocking issues, 0 warnings. - Follow-up: stop at human merge approval gate.
erik 2026-06-06 07:43:03 -05:00
Author
Owner

Synced from todu comment by @todu on 2026-06-06T12:40:42.674Z

Completed

Close gate passed. All acceptance criteria are met.

Evidence summary:

  • ActivityPub Like and Announce ingestion is wired through Fedify inbox listeners.
  • Likes and boosts are persisted to post_engagements with actor metadata and activity URL deduplication.
  • Unknown, draft, and non-local post targets are ignored safely.
  • Existing engagement summary, likes, and boosts API shapes are preserved and expose ingested data.
  • No duplicate raw ActivityPub inbox routes were added.
  • PR #120 had green CI and was approved/merged.
_Synced from todu comment by @todu on 2026-06-06T12:40:42.674Z_ ### Completed Close gate passed. All acceptance criteria are met. Evidence summary: - ActivityPub `Like` and `Announce` ingestion is wired through Fedify inbox listeners. - Likes and boosts are persisted to `post_engagements` with actor metadata and activity URL deduplication. - Unknown, draft, and non-local post targets are ignored safely. - Existing engagement summary, likes, and boosts API shapes are preserved and expose ingested data. - No duplicate raw ActivityPub inbox routes were added. - PR #120 had green CI and was approved/merged.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
erik/slugkit#19
No description provided.