Skip to content

Add mocked core flow test#20

Merged
sij411 merged 5 commits into
fedify-dev:nextfrom
sij411:phase1-e2e-core-flow
Jun 17, 2026
Merged

Add mocked core flow test#20
sij411 merged 5 commits into
fedify-dev:nextfrom
sij411:phase1-e2e-core-flow

Conversation

@sij411

@sij411 sij411 commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a mocked end-to-end core flow test for the portable core boundary.
  • Cover ReceivedFollow producing follower relation storage, delivery-target storage, and Accept delivery.
  • Cover UserCreateNote producing object storage plus Create(Note) delivery to the known follower inbox.
  • Emit StoreFollower only when the follower relation is newly recorded, while emitting StoreDeliveryTarget when embedded actor inbox data is new or refreshed.
  • Reword public doc comments to avoid milestone-specific terminology.

Notes

This stays inside feder-core: no HTTP server, real storage, async runtime, signing, or delivery implementation is introduced.

Refs #10

Validation

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

sij411 added 2 commits June 17, 2026 17:44
Assisted-by: Codex:gpt-5.5
Assisted-by: Codex:gpt-5.5
@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: 8246d9de-6f2e-4516-bf5e-47152bb4a3af

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

FederState::record_follow is changed to emit Action::StoreFollower only when a follower is newly inserted into in-memory state, not on subsequent re-follows. Doc comments in feder-core and feder-vocab drop "Phase 1" phrasing. An existing test expectation is reduced from two actions to one, and a new test covers a combined follow-then-create-note flow.

Changes

Conditional StoreFollower emission and test coverage

Layer / File(s) Summary
Doc comment cleanup
crates/feder-core/src/lib.rs, crates/feder-vocab/src/lib.rs
Doc comments on FederState, DeliveryTarget, Reference<T>, and Actor replace "Phase 1" wording with plain descriptions of portable core flows and minimal ActivityPub types.
record_follow: StoreFollower emitted only on new insertion
crates/feder-core/src/lib.rs
StoreFollower action emission is moved inside the new-follower insertion branch so that re-follows or inbox refreshes for already-known followers no longer produce a duplicate StoreFollower action.
Updated and new tests
crates/feder-core/src/lib.rs
received_follow_updates_existing_delivery_target_by_actor is updated to expect one action instead of two on re-follow. New test mocked_core_flow_accepts_follow_then_delivers_created_note validates delivery actions and accumulated follower/delivery-target/object/activity counts across a full follow-then-create-note flow.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • fedify-dev/feder#17: Introduced the minimal in-memory core state and initial FederState::record_follow semantics that this PR directly modifies.
  • fedify-dev/feder#18: Previously changed record_follow to conditionally emit follow-related actions along the same code path that this PR further refines.

Suggested labels

enhancement

🐇 A follower comes knocking — once is enough!
No double-storing when the path gets tough.
Phase 1 is gone, just plain flows remain,
Accept the follow, deliver the note refrain.
Hippity-hop, the state's crisp and bright! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add mocked core flow test' directly corresponds to the main change: introducing a new mocked end-to-end core flow test covering ReceivedFollow and UserCreateNote scenarios.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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.

Assisted-by: Codex:gpt-5.5
@sij411

sij411 commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/feder-core/src/lib.rs`:
- Around line 132-139: The StoreFollower action is only pushed inside the
condition checking for new followers (when relation is not already in
self.followers), but inbox refreshes for existing followers may occur elsewhere
in the code. This creates a gap where updated delivery targets are not persisted
to storage. Refactor the code so that inbox/delivery target updates for existing
followers are also exposed through actions: either make the StoreFollower action
explicitly idempotent and push it regardless of whether the relation already
exists, or create a separate action variant to handle actor metadata updates
(like inbox refreshes) that is pushed independently from the new follower check.
- Around line 472-480: The test for the second_result.actions matching the
Accept shape is incomplete and doesn't verify that the Accept was sent to the
refreshed inbox. After the current assert_eq and matches assertions for
second_result.actions, add specific assertions that extract the SendActivity and
Accept from second_result.actions[0], then verify both the inbox field value
matches the refreshed inbox URL (not the stale one) and the Accept ID matches
the expected refreshed state's Accept ID to ensure the test would catch
regressions where the state is refreshed but the immediate Accept is still sent
to an outdated inbox.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9757f40c-699d-4712-95de-69c7028c1d9d

📥 Commits

Reviewing files that changed from the base of the PR and between 4dfc103 and fa97e1f.

📒 Files selected for processing (2)
  • crates/feder-core/src/lib.rs
  • crates/feder-vocab/src/lib.rs

Comment thread crates/feder-core/src/lib.rs
Comment thread crates/feder-core/src/lib.rs Outdated
@sij411 sij411 added enhancement New feature or request phase 1 labels Jun 17, 2026
sij411 added 2 commits June 17, 2026 23:46
Assisted-by: Codex:gpt-5.5
Assisted-by: Codex:gpt-5.5
@sij411

sij411 commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 9962e5e3b1

ℹ️ 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 self-assigned this Jun 17, 2026
@sij411 sij411 merged commit e386616 into fedify-dev:next Jun 17, 2026
2 checks passed
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