Skip to content

Add conversation activity backfill backfillActivities() API - #1447

Open
sij411 wants to merge 3 commits into
fedify-dev:mainfrom
sij411:feat/backfill-activities
Open

sij411 wants to merge 3 commits into
fedify-dev:mainfrom
sij411:feat/backfill-activities

Conversation

@sij411

@sij411 sij411 commented Nov 17, 2026

Copy link
Copy Markdown
Member

Closes #1251.

Follows the separate backfillActivities() API proposed in the design comment. Streams original activities in collection order, deduplicates by activity ID, and avoids requiring target dereferences. Reuses existing traversal controls while preserving backfill() behaviour.

AI assistance
Codex (gpt-6.1-sol) assisted with implementation, tests, documentation, and this description.

Expose backfillActivities() with existing context and item types and an
explicit subset of traversal options. Preserve activity references and
collection order without requiring target dereferences, and deduplicate
by activity ID.

Use Link placeholders for skipped loads so cached failures cannot leak
into activity output. Add focused API and regression coverage while
preserving the existing post backfill behavior.

fedify-dev#1251

Assisted-by: Codex:gpt-6.1-sol
Add README and manual examples for backfillActivities(), document the
shared traversal controls and activity-specific output, and update agent
guidance. Clarify collection object caching across invocations and the
application's responsibility to authorize discovered activities.

Add a Sacho changelog fragment and its generated entry. Strengthen the
focused failed-load test to check that skips do not consume maxItems.

fedify-dev#1251

Assisted-by: Codex:gpt-6.1-sol
@netlify

netlify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for fedify-json-schema canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 2371e84
🔍 Latest deploy log https://app.netlify.com/projects/fedify-json-schema/deploys/6afc1fa7878ee8a594594cd7

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The backfill package adds backfillActivities() to yield original activities from conversation collections. It preserves activity references and collection order, applies activity-based limits, and uses shared traversal controls. The existing backfill() post output remains unchanged.

Changes: Activity Backfill

Layer / File(s) Summary
Public options and exports
packages/backfill/src/types.ts, packages/backfill/src/mod.ts
The package adds BackfillActivityOptions and exports it with backfillActivities().
Activity traversal and validation
packages/backfill/src/backfill.ts, packages/backfill/src/backfill-activities.test.ts
backfillActivities() traverses collection items, yields activities with collection metadata, deduplicates identified activities, and counts yielded activities toward maxItems. Tests cover ordering, filtering, discovery, request limits, and cancellation.
API documentation and changelog
docs/manual/backfill.md, packages/backfill/README.md, claude-plugin/skills/fedify/SKILL.md, changes.d/backfill/activity-stream.md, CHANGES.md
Documentation describes the new API, its traversal behavior, and its distinction from post backfill. The changelog records the addition and its references.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant backfillActivities
  participant CollectionTraversal
  participant Loader
  Caller->>backfillActivities: seed and traversal options
  backfillActivities->>CollectionTraversal: discover and traverse collection
  CollectionTraversal->>Loader: load referenced item
  Loader-->>CollectionTraversal: loaded item or load failure
  CollectionTraversal-->>backfillActivities: collection item
  backfillActivities-->>Caller: yielded Activity and metadata
Loading

Possibly related issues

  • fedify-dev/fedify#1253 — The change tests skipped loads and item limits, but does not add traversal termination reporting described by the issue.
  • fedify-dev/fedify#1427 — The new traversal uses the existing accessor path; the change does not add the requested crossOrigin option.

Suggested labels: component/backfill

Merge Risk: Minimal · up to 2371e

This PR adds a new activity-backfill API and documents it, and it leaves the existing post backfill output unchanged. No concrete merge-blocking risk was identified in the supplied changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a new conversation activity backfill API, backfillActivities(). The changeset adds that exported function, its options type, re-exports, tests, and docs, so the title …
Description check Passed The description links issue #1251 and the design comment. It states the new API streams original activities in collection order, deduplicates by activity ID, and reuses traversal controls while leavin…
Linked Issues check Passed Issue #1251 requires an opt-in activity traversal that yields original activities in collection order, keeps actor, ID, and object reference, deduplicates by activity ID, counts yielded activities tow…
Out of Scope Changes check Passed All changes support the #1251 objective. backfill.ts adds the new function and changes the skipped-item placeholder type. types.ts adds BackfillActivityOptions, which picks shared traversal options an…
Full details: Title check

Explanation

The title names the main change: a new conversation activity backfill API, backfillActivities(). The changeset adds that exported function, its options type, re-exports, tests, and docs, so the title matches the primary change.

Full details: Description check

Explanation

The description links issue #1251 and the design comment. It states the new API streams original activities in collection order, deduplicates by activity ID, and reuses traversal controls while leaving backfill() unchanged. This matches the changeset and linked objectives.

Full details: Linked Issues check

Explanation

Issue #1251 requires an opt-in activity traversal that yields original activities in collection order, keeps actor, ID, and object reference, deduplicates by activity ID, counts yielded activities toward maxItems, avoids dereferencing activity targets, and never exposes bare Activity placeholders. The diff at packages/backfill/src/backfill.ts adds backfillActivities(). It discovers the collection through the shared discoverConversationCollection() and getCollectionItems() path. It yields only items where object instanceof Activity, so Create, Update, Delete, and Like pass through unchanged. It deduplicates by object.id.href through seenIds, and it applies maxItems to yielded items only. It does not call any target dereference. Failed or skipped item placeholders change from type Activity to type Link in skippedCollectionItemDocument(), so they are filtered out by the instanceof check. This also keeps backfill() from leaking placeholders. Request budgeting, signal handling, and MaxRequestsExceeded handling reuse the existing budget. The PR description and summary report tests for the ordering, dedupe, failed-load, and budget cases in packages/backfill/src/backfill-activities.test.ts. I did not read the test file, so test behavior rests on the summary. Reply-tree traversal is post-only, as the issue permits.

Full details: Out of Scope Changes check

Explanation

All changes support the #1251 objective. backfill.ts adds the new function and changes the skipped-item placeholder type. types.ts adds BackfillActivityOptions, which picks shared traversal options and excludes post-extraction strategies. mod.ts re-exports the new symbols. README.md, docs/manual/backfill.md, CHANGES.md, changes.d/backfill/activity-stream.md, and claude-plugin/skills/fedify/SKILL.md document the new API and its authorization caveat. The changelog and docs describe the new API, so they are supporting changes. The Activity-to-Link placeholder change also affects backfill(). The commit summary links it to preventing placeholder leaks, so it is connected to the objective. No unrelated change is evident in the summaries or the inspected diff.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 158be315-f9af-4e05-b736-072688c4d489
Commits

Reviewing files that changed from the base of the PR and between 3ed9e77 and 2371e84.

Files selected for processing: 9

  • CHANGES.md
  • changes.d/backfill/activity-stream.md
  • claude-plugin/skills/fedify/SKILL.md
  • docs/manual/backfill.md
  • packages/backfill/README.md
  • packages/backfill/src/backfill-activities.test.ts
  • packages/backfill/src/backfill.ts
  • packages/backfill/src/mod.ts
  • packages/backfill/src/types.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.22034% with 4 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/backfill/src/backfill.ts 92.59% 0 Missing and 4 partials ⚠️
Files with missing lines Coverage Δ
packages/backfill/src/mod.ts 100.00% <100.00%> (ø)
packages/backfill/src/backfill.ts 94.33% <92.59%> (-0.12%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sij411
sij411 marked this pull request as ready for review November 17, 2026 09:59
@sij411

sij411 commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T03:54:25.170086Z 2371e84 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 2371e84189

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose conversation activities without reducing them to posts

1 participant