Skip to content

Add minimal core state#17

Merged
sij411 merged 4 commits into
fedify-dev:nextfrom
sij411:phase1-core-state
Jun 16, 2026
Merged

Add minimal core state#17
sij411 merged 4 commits into
fedify-dev:nextfrom
sij411:phase1-core-state

Conversation

@sij411

@sij411 sij411 commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

Adds the minimal in-memory core state needed for Phase 1 flows in feder-core.

This introduces:

  • FederConfig with runtime-provided local actor configuration
  • FederState owned by FederCore
  • follower relation tracking for received Follow activities
  • known delivery target tracking when embedded actor data includes an inbox
  • created Note and Create<Note> state for local note creation tests
  • local actor normalization for UserCreateNote, so stored note/activity actor references use the configured local actor ID

Design Notes

This keeps issue #7 scoped to portable state mutation only. The core still performs no HTTP, async work, persistence, fetching, signing, delivery, clock reads, or ID generation.

Delivery targets are intentionally "known delivery targets," not a complete resolved follower inbox index. If a Follow contains only an actor IRI, the follower relation is recorded, but no delivery target is created until a runtime or later core flow resolves actor data.

Validation

  • cargo test -p feder-core
  • mise run check

Refs #7

Summary by CodeRabbit

Release Notes

  • Refactor
    • Federation core now maintains persistent state to track followers, delivery targets, and created objects
    • Improved event processing for follow requests and note creation
    • Updated core initialization with configuration requirements

sij411 added 3 commits June 16, 2026 11:53
Assisted-by: Codex:gpt-5.5
Assisted-by: Codex:gpt-5.5
Assisted-by: Codex:gpt-5.5
@coderabbitai

coderabbitai Bot commented Jun 16, 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 517e5ad6-ae8c-42f9-b713-bf8dd0c735a4

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

crates/feder-core/src/lib.rs replaces the placeholder FederCore unit struct with a stateful core that owns a FederState. New public types FederConfig, FederState, Follower, and DeliveryTarget are introduced. handle() now routes ReceivedFollow and UserCreateNote inputs to internal state-recording helpers. The test suite is rewritten to assert state mutations.

Changes

Stateful FederCore Implementation

Layer / File(s) Summary
Public data types: FederConfig, FederState, Follower, DeliveryTarget
crates/feder-core/src/lib.rs
FederConfig (holds local_actor), FederState (tracks followers, delivery targets, objects, activities with read-only accessors), Follower, and DeliveryTarget are introduced as the public contract layer for configuration and in-memory state.
FederCore handle() routing and state mutation helpers
crates/feder-core/src/lib.rs
FederCore is refactored from a unit struct to own a FederState field; new() now accepts FederConfig; handle() dispatches to record_follow (conditional follower + delivery target recording) and record_created_note (note/activity creation with attribution normalization).
Rewritten ReceivedFollow and UserCreateNote tests
crates/feder-core/src/lib.rs
Test module is rewritten with a core() helper using FederConfig; tests assert follower/delivery-target recording, Object::Note and Activity::CreateNote creation, attribution normalization, and that events from non-local actors are ignored.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • Minimal FederCore state #7: This PR directly implements the acceptance criteria from issue #7, including FederState ownership within FederCore, the FederCore::new(config) constructor, and state mutation through handle() input processing.

Possibly related PRs

  • fedify-dev/feder#16: Both PRs modify FederCore::handle and the same Input variants (ReceivedFollow, UserCreateNote); this PR extends the earlier empty-action boundary core into a stateful implementation.

Suggested labels

enhancement, phase 1

Poem

🐇 Hoppity-hop through the federation,
The core grew a state — what a revelation!
Followers tracked, delivery targets too,
Notes and activities, all fresh and new.
No longer a placeholder, blank and bare —
FederCore now has data to care! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add minimal core state' directly and accurately summarizes the main change: introducing state infrastructure (FederConfig and FederState) to FederCore.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

@sij411 sij411 self-assigned this Jun 16, 2026
@sij411

sij411 commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 16, 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.

@sij411

sij411 commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f594690593

ℹ️ 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".

Comment thread crates/feder-core/src/lib.rs Outdated
Assisted-by: Codex:gpt-5.5
@sij411

sij411 commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: a332df7d55

ℹ️ 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".

@sij411 sij411 merged commit 824d486 into fedify-dev:next Jun 16, 2026
2 checks passed
@sij411 sij411 added enhancement New feature or request phase 1 labels Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request phase 1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant