Skip to content

Emit create note actions#19

Merged
sij411 merged 1 commit into
fedify-dev:nextfrom
sij411:phase1-create-note
Jun 17, 2026
Merged

Emit create note actions#19
sij411 merged 1 commit into
fedify-dev:nextfrom
sij411:phase1-create-note

Conversation

@sij411

@sij411 sij411 commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Implements the Phase 1 Create(Note) core flow for feder-core.

When Input::UserCreateNote targets the configured local actor, core now:

  • creates and records a minimal Note
  • wraps it in a Create<Note> activity and records that activity
  • emits Action::StoreObject for the created note
  • emits Action::SendActivity(Activity::CreateNote(...)) once per known delivery target

Design Notes

The core still performs no HTTP, storage backend writes, signing, delivery, async work, clock reads, or ID generation.

FederState keeps in-memory test/core state, while Action::StoreObject tells a future runtime that the created object should be persisted outside the portable core.

Delivery is limited to known delivery targets. Shared inbox grouping, follower resolution, public addressing (to/cc), mentions, media, and delivery workers remain out of scope for this issue.

Validation

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

Refs #9

Summary by CodeRabbit

  • Bug Fixes
    • User note creation now properly records created notes and associated activities in storage
    • Creation activities are now sent to configured delivery targets for proper distribution
    • Enhanced validation of note creator information during creation workflow

Assisted-by: Codex:gpt-5.5
@sij411

sij411 commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

@codex review

@sij411 sij411 self-assigned this Jun 17, 2026
@sij411 sij411 added enhancement New feature or request phase 1 labels Jun 17, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: e35007658f

ℹ️ 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 4dfc103 into fedify-dev:next Jun 17, 2026
1 check passed
@coderabbitai

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

@coderabbitai

coderabbitai Bot commented Jun 17, 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: e63426b6-4065-4057-b47d-b1216f62585b

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

FederCore::handle now routes Input::UserCreateNote to FederState::record_created_note, which returns Vec<Action> instead of (). On success it produces a StoreObject action and one SendActivity action per delivery target inbox. Unit tests are updated and extended to assert this behavior.

Changes

UserCreateNote action emission

Layer / File(s) Summary
record_created_note return type and action construction
crates/feder-core/src/lib.rs
record_created_note signature changes from () to Vec<Action>; early exits return Vec::new(); success path builds StoreObject for the new note and SendActivity for each delivery target inbox. FederCore::handle wraps the returned actions in HandleResult::new(actions).
Updated and new unit tests
crates/feder-core/src/lib.rs
Existing records_created_object test updated to assert one StoreObject action; two new tests cover SendActivity emission for one and multiple delivery targets; embedded-local-actor normalization test updated to assert one action.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • Create(Note) flow #9: This PR directly implements the behavior described in that issue — handling Input::UserCreateNote by recording a Note, wrapping it in a CreateNote activity, and emitting StoreObject and SendActivity actions for delivery targets.

Possibly related PRs

  • fedify-dev/feder#16: Previously stubbed out the UserCreateNote branch in FederCore::handle by returning an empty HandleResult; this PR replaces that stub with the actual record_created_note wiring.
  • fedify-dev/feder#17: Overlaps directly at FederState::record_created_note and FederCore::handle for UserCreateNote, covering local-actor normalization and delivery-target logic at the same code paths.

Poem

🐇 Hop, hop, a note is born today,
Wrapped in a CreateNote without delay,
StoreObject tucked in my warren so neat,
SendActivity sent to each inbox I greet,
The delivery targets all know what to say —
A rabbit just posted and hopped on its way! 🌿

✨ 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.

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