Skip to content

Support FEP-f228 activity collection backfill#801

Open
sij411 wants to merge 1 commit into
fedify-dev:feat/backfillfrom
sij411:feat/backfill
Open

Support FEP-f228 activity collection backfill#801
sij411 wants to merge 1 commit into
fedify-dev:feat/backfillfrom
sij411:feat/backfill

Conversation

@sij411

@sij411 sij411 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds the next FEP-f228 context collection path for @fedify/backfill: context collections whose items are Activity objects.

The new strategy handling keeps BackfillItem.object focused on conversation objects. When a supported Create activity is found, backfill extracts and yields the activity's object rather than yielding the activity itself.

Related to #275

Included

  • Add context-auto, context-objects, and context-activities strategy handling
  • Make context-auto the default classifier for direct objects and supported activities
  • Extract embedded or dereferenced Create.object values from activity collections
  • Reuse existing request budgets, abort handling, interval handling, and dedupe behavior
  • Add tests for explicit, automatic, empty, overlapping, duplicate, embedded, URL, and budget cases
  • Document the strategy behavior in @fedify/backfill

Validation

  • deno task -f @fedify/backfill check
  • deno task -f @fedify/backfill test
  • pnpm --filter @fedify/backfill test

AI assistance disclosed in commit message with Assisted-by: Codex:gpt-5.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 07948fa7-9ffb-43b7-bc45-011431d88285

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The backfill package extends its traversal capability from a single hardcoded strategy to a configurable, multi-strategy system. The change introduces three strategies (context-objects, context-activities, context-auto) as a type union, refactors the core logic into composable generators that handle strategy selection and Create activity unwrapping, and adds comprehensive test coverage validating all strategy combinations and edge cases.

Changes

Multi-Strategy Backfill System

Layer / File(s) Summary
Type system and contracts
packages/backfill/src/types.ts
BackfillStrategy expands from "context-posts" to a three-literal union: "context-objects", "context-activities", "context-auto". BackfillOptions gains an optional strategies array property with default ["context-auto"].
Core backfill refactoring and strategy-driven logic
packages/backfill/src/backfill.ts
Backfill normalizes input strategies and refactors per-item processing via new async generators: getBackfillItems yields context-objects and unwraps Create activities; getCollectionItems and loadCollectionItemDocument handle document loading; getCreateActivityObject extracts Create objects with budget/abort handling; normalizeStrategies normalizes and deduplicates strategy lists. Main loop deduplicates by object ID and enforces maxItems.
Comprehensive strategy and edge case test coverage
packages/backfill/src/backfill.test.ts
Tests cover context-objects behavior, context-auto unwrapping of Create, context-activities collection/dereferencing, combined strategies, deduplication by object ID, empty strategies (no dereferencing), strategy precedence, unsupported activity types (Announce), missing objects, maxRequests limits, and maxItems caps.
Strategy documentation and user guidance
packages/backfill/README.md
Documents the default context-auto strategy and adds a context-activities section with TypeScript example, explaining how collection items and Create activities are traversed and that the activity's object is yielded rather than the activity itself.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • fedify-dev/fedify#779: Introduced the initial @fedify/backfill package; this PR extends its traversal strategy system and adds configurable multi-strategy support.

Suggested labels

component/federation, component/collections, type/documentation

Suggested reviewers

  • dahlia
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding FEP-f228 activity collection backfill support to the backfill package.
Description check ✅ Passed The description is directly related to the changeset, detailing the new strategies, behavior changes, included work, and validation steps performed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces multiple backfill strategies (context-objects, context-activities, and context-auto) to the backfill utility, replacing the previous single context-posts strategy. The default strategy is now context-auto, which automatically handles both plain objects and embedded Create activities. The changes also include comprehensive unit tests for the new strategies and updated documentation in the README. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.49123% 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 96.49% 1 Missing and 3 partials ⚠️
Files with missing lines Coverage Δ
packages/backfill/src/backfill.ts 84.89% <96.49%> (+5.98%) ⬆️

... 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 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new backfill strategies (context-objects, context-activities, and context-auto) to the @fedify/backfill package, replacing the previous context-posts strategy. It updates the documentation, types, and implementation to support these strategies, with context-auto acting as the default. Extensive unit tests are added to cover the new behaviors, deduplication, and request limits. The reviewer feedback highlights that removing context-posts is a breaking change. They suggest keeping context-posts as a deprecated alias of context-objects in the BackfillStrategy type and updating normalizeStrategies to map context-posts to context-objects while ensuring null-safety.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/backfill/src/types.ts
Comment thread packages/backfill/src/backfill.ts
@sij411

sij411 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces configurable backfill strategies (context-objects, context-activities, and context-auto) to the backfill package, replacing the previous hardcoded context-posts strategy. The default strategy is now context-auto, which automatically handles both activities and objects. The changes include updating the backfill function and options to support these strategies, adding helper functions for processing activities and loading documents, updating the README documentation, and adding comprehensive unit tests covering the new strategies and their limits. No review comments were provided, and I have no feedback to offer.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@sij411 sij411 marked this pull request as ready for review June 10, 2026 03:08
@sij411

sij411 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@dahlia dahlia self-assigned this Jun 10, 2026
@dahlia dahlia added component/backfill Backfiller-related (@fedify/backfill) component/federation Federation object related component/collections Collections related activitypub/interop Interoperability issues activitypub/compliance Specification compliance labels Jun 10, 2026
@dahlia dahlia linked an issue Jun 10, 2026 that may be closed by this pull request
@dahlia

dahlia commented Jun 10, 2026

Copy link
Copy Markdown
Member

It's trivial, but I think the Assisted-by trailer on your commit should be:

Assisted-by: Codex:gpt-5.5

… instead of:

Assisted-by: Codex:gpt-5

Add context-auto, context-objects, and context-activities strategy
handling for context collection backfill.  The auto strategy classifies
ordinary objects directly and extracts objects from supported Create
activities while preserving shared request budgets, deduplication, abort,
and interval behavior.

Document the strategy behavior and add coverage for explicit, automatic,
empty, overlapping, and duplicate strategy configurations.

Assisted-by: Codex:gpt-5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

activitypub/compliance Specification compliance activitypub/interop Interoperability issues component/backfill Backfiller-related (@fedify/backfill) component/collections Collections related component/federation Federation object related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@fedify/backfill package for FEP-f228 conversation backfill

2 participants