Skip to content

Refactor architecture - #43

Merged
sij411 merged 74 commits into
fedify-dev:feat/experiment/architecturefrom
sij411:feat/experiment/architecture
Aug 3, 2026
Merged

Refactor architecture#43
sij411 merged 74 commits into
fedify-dev:feat/experiment/architecturefrom
sij411:feat/experiment/architecture

Conversation

@sij411

@sij411 sij411 commented Aug 3, 2026

Copy link
Copy Markdown
Member
  • feder-core have only traits and shared functions
  • feder-server (originally feder-runtime-server) can build fediverse application for general os (mostly unix)
  • feder-vocab remains as-is

Federog migration confirmed.

sij411 added 30 commits July 28, 2026 21:42
Temporarily restore the stateful core architecture so the HTTP signature runtime work
can be evaluated and integrated before reconsidering the decision-based
architecture separetely. This reverts the changes introduced by PR fedify-dev#39.

Assisted-by: Codex:gpt-5.6-sol
Add the security JSON-LD context and model embedded CryptographicKey values
on ActivityPub actors. Cover the publicKey representation with serialization
tests.

Assisted-by: Codex:gpt-5.6-sol
…r Core.

Accept runtime-provided entropy, validate persisted pairs, and zeroize
private PEM material. Use fixed fixtures for behavioral tests and exercise
all workspace features and targets in CI.

Assisted-by: Codex:gpt-5.6-sol
Enable HTTP signature keys in the server runtime and store validated per-actor
key pairs in the keys table. Reject accidental replacement and test schema
creation, round trips, malformed keys, missing actors, and persistence across
reopen.

Assisted-by: Codex:gpt-5.6-sol
Move HTTP endpoint and startup tests under the tests directory, with shared
fixtures kept private to the integration test crate.

Assisted-by: Codex:gpt-5.6-sol
Generate and persist a 4096-bit RSA key pair with operating system entropy
when an actor has no stored key, and reuse the persisted pair on restart.

Assisted-by: Codex:gpt-5.6-sol
Attach the persisted RSA public key to the local actor as an embedded
CryptographicKey using the #main-key identifier and security context.

Assisted-by: Codex:gpt-5.6-sol
Deliver SendActivity actions synchronously to recipient inboxes as ActivityPub
JSON, report remote failures, and continue attempting later recipients after
individual delivery failures.

Assisted-by: Codex:gpt-5.6-sol
Create draft-Cavage RSA signatures in the portable core and
apply them to outgoing ActivityPub requests using the persisted actor key and
matching #main-key identifier.

Assisted-by: Codex:gpt-5.6-sol
Sign the complete path and query for outgoing ActivityPub requests, and add
regression coverage for inbox URLs containing query parameters.

Assisted-by: Codex:gpt-5.6-sol
Block private and special-use inbox destinations using validated DNS
resolution, with an explicit option for local development. Configure
connection and total request timeouts to prevent stalled deliveries.

Assisted-by: Codex:gpt-5.6-sol
…vered

inbox, and deliver the signed Accept activity. Reuse outbound network
protections and enforce response type, size, and actor ID validation.

Add an end-to-end test covering Mastodon-style actor resolution and Accept
delivery.

Assisted-by: Codex:gpt-5.6-sol
Validate Cavage RSA-SHA256 signatures, signed headers, request dates, body
digests, actor ownership, and public-key identity before processing inbox
activities.

Add tests for valid, tampered, unsigned, and mismatched-actor requests.

Assisted-by: Codex:gpt-5.6-sol
Fetch signature key IDs directly and support standalone key documents as well
as keys embedded in actor documents. Verify that the activity actor owns and
advertises the resolved key before processing the request.

Add coverage for signed Follows using an independent key URL.

Assisted-by: Codex:gpt-5.6-sol
Default omitted public key types to CryptographicKey for compatibility with
Mastodon actor documents. Cover the representation in vocabulary and signed
Follow integration tests.

Assisted-by: Codex:gpt-5.6-sol
Add Undo vocabulary and core handling for follower removal. Validate that the
Undo actor owns the embedded Follow, remove matching in-memory and SQLite
follower state, and cover signed unfollow and forged Undo requests.

Assisted-by: Codex:gpt-5.6-sol
Add the OrderedCollection vocabulary type and followers property for actors.
Advertise the local actor's followers collection URI and preserve the property
when resolving remote actors.

Assisted-by: Codex:gpt-5.6-sol
Add a storage-backed followers handler and expose it through the runtime
router. Return an ActivityPub OrderedCollection with current follower IDs and
counts, and cover collection updates, response headers, and unknown users.

Assisted-by: Codex:gpt-5.6-sol
Require an explicit ActivityPub-compatible Accept header for actor and
followers collection requests. Return 406 for HTML, wildcard-only, missing,
or unsupported Accept headers, and mark successful responses with Vary:
Accept.

Add coverage for supported media types, quality preferences, HTML requests,
and requests without an ActivityPub Accept header.

Assisted-by: Codex:gpt-5.6-sol
Add Vary: Accept to actor and followers responses that reject requests
without an ActivityPub-compatible Accept header, preventing caches from
reusing those responses across representations.

Assisted-by: Codex:gpt-5.6-sol
Ignore unsupported Accept media types when choosing between HTML and
ActivityPub. Compare the best quality in each supported representation group
and use header order to resolve equal preferences.

Assisted-by: Codex:gpt-5.6-sol
Add to, cc, url, and mediaType fields to the Note vocabulary model. Preserve
ActivityStreams scalar-or-array recipient serialization and omit empty or
absent values.

Assisted-by: Codex:gpt-5.6-sol
Store Note objects emitted through StoreObject actions in SQLite using their
IRI, object type, and serialized payload. Add typed object loading, idempotent
replacement, and persistence across database reopen.

Assisted-by: Codex:gpt-5.6-sol
Add the local post object route with ActivityPub content negotiation,
SQLite-backed lookup, and coverage for persistence and error responses.

Assisted-by: Codex:gpt-5.6-sol
Add a runtime operation for local Note creation that applies storage
actions before synchronously delivering Create activities. Reuse the same
action pipeline for inbox processing and cover successful and failed delivery.

Assisted-by: Codex:gpt-5.6-sol
Remove the in-memory delivery target cache and resolve current follower
inboxes from SQLite when delivering Create activities. Keep delivery
synchronous, deduplicate shared inboxes, and refresh inbox data through
repeated Follow persistence.

Assisted-by: Codex:gpt-5.6-sol
Populate Note addressing and metadata, mirror to and cc onto Create,
and use one SendActivity action with typed inbox or follower recipients.
Resolve follower recipients into concrete inbox deliveries at runtime.

Assisted-by: Codex:gpt-5.6-sol
sij411 added 27 commits July 30, 2026 17:38
Assisted-by: Codex:gpt-5.6-sol
Port RSA actor key generation and persisted PEM validation into
ref-feder-core. Redact private key material from debug output and keep
actor dispatch as a minimal capability called directly by the server
runtime.

Assisted-by: Codex:gpt-5.6-sol
Parse and validate local acct resources, resolve actors through the actor
dispatcher, and return JRD discovery responses from the experimental server
router.

Assisted-by: Codex:gpt-5.6-sol
Introduce a stateless receive_follow transition in ref-feder-core. Validate
that the Follow actor matches the resolved remote actor and that its object
targets the selected local actor, then return the follower facts and Accept
delivery through a transient FollowOutcome without retaining protocol state.

Extend the portable key module with SHA-256 digest generation and
draft-Cavage RSA-SHA256 signing and verification primitives.

Add a personal inbox endpoint to ref-feder-runtime-server. Validate
ActivityPub content types, body size, request host and date, body digests,
signature headers, remote key ownership, and actor identity before invoking
the core Follow transition. Persist the follower before sending the generated
Accept and return 202 Accepted for successfully handled or irrelevant
activities.

Represent local actor access and runtime services through FederServer<A, S>,
while placing Arc only at the Axum router boundary for concurrent request
sharing. Keep signed authentication as the default and temporarily retain an
explicit insecure development policy until the reference example can issue
signed Follow requests.

Update the reference server example with bounded adapters for remote
resolution, follower storage, and Accept sending. Document and exercise the
actor, WebFinger, and personal inbox endpoints without accumulating an
in-memory activity history.

Shared inbox and Undo handling remain out of scope for this change.

Assisted-by: Codex:gpt-5.6-sol
Define ServerStorage as the application-owned persistence boundary for
follower relationships and per-actor signing keys.

Allow runtimes to persist Follow outcomes and retrieve the appropriate
ActorKeyPair without retaining protocol state inside the core.

Assisted-by: Codex:gpt-5.6-sol
Port protected remote actor and key resolution to the reference server
runtime. Reject private and special-use destinations by default, disable
redirects and proxies, and enforce request timeouts and response size limits.

Give FederServer concrete resolver and activity sender components. Verify
signed inbox requests, persist Follow relationships through ServerStorage,
load per-actor signing keys, and deliver signed Accept activities.

Migrate the reference actor-server example to ServerStorage and the fallible
server constructor. Use the bundled test key pair and a local recipient inbox
to demonstrate signed Accept delivery without generating keys at startup.

Assisted-by: Codex:gpt-5.6-sol
Reject the deprecated fec0::/10 site-local range when outbound networking uses
the PublicOnly policy, closing an SSRF path through literal URLs and DNS
resolution.

Assisted-by: Codex:gpt-5.6-sol
Extend ServerStorage with an idempotent follower-removal operation for the
upcoming Undo Follow transition.

Update the reference actor-server storage adapter to remove its retained
follower only when both sides of the relationship match.

Assisted-by: Codex:gpt-5.6-sol
Validate that an Undo actor owns its embedded Follow and that the Follow
targets the local actor.

Return a transient follower-removal outcome without retaining protocol state
or performing storage operations inside core.

Assisted-by: Codex:gpt-5.6-sol
Dispatch Undo activities through the pure core transition and remove
validated follower relationships through ServerStorage.

Update the reference actor server example with idempotent follower removal
and a documented Follow-to-Undo flow.

Assisted-by: Codex:gpt-5.6-sol
Add canonical actor ID lookup to ActorDispatcher so shared inbox activities
can be routed without assuming an application URL structure.

Route Follow and Undo Follow activities from the shared inbox through the
existing authentication, core transition, storage, and delivery flow.

Update the reference actor server to advertise and demonstrate the shared
inbox endpoint.

Assisted-by: Codex:gpt-5.6-sol
Add a follower-listing capability to ServerStorage and expose each local
actor's followers as an ActivityStreams OrderedCollection.

Advertise the collection from the example actor and demonstrate how Follow
and Undo requests update its contents.

Assisted-by: Codex:gpt-5.6-sol
Add a pure core operation that constructs an outbound Follow activity and its
transient pending relationship.

Extend ServerStorage with pending Follow persistence and add
FederServer::follow_actor to resolve the remote actor, persist intent, load
the local signing key, and deliver the signed activity.

Allow applications to retain shared FederServer state alongside the router,
and update the reference example with bounded pending storage and an
end-to-end outbound Follow demonstration.

Assisted-by: Codex:gpt-5.6-sol
Add a pure core transition that validates inbound Accept activities against
the authenticated remote actor and the stored pending Follow relationship.

Extend ServerStorage with pending Follow lookup and compare-and-set
confirmation capabilities.

Route linked and embedded Accept Follow activities through personal and shared
inboxes, and update the reference example with a bounded pending-to-accepted
state transition.

Assisted-by: Codex:gpt-5.6-sol
Add a pure core operation that constructs a local Note and its corresponding
Create activity from runtime-provided IDs, addressing, and content.

Introduce a dedicated NoteStore capability and add FederServer::create_note
to load the local actor and persist only the durable Note without retaining
protocol history.

Update the reference example with bounded Note storage and a local creation
flow while leaving Create delivery for the next migration step.

Assisted-by: Codex:gpt-5.6-sol
Derive transient delivery intents from Note addressing in core without
retaining recipient or activity history.

Add follower delivery and shared storage error capabilities, then expand
followers, resolve direct actors, deduplicate inboxes, and deliver signed
Create activities after Note persistence.

Update the reference example to demonstrate signed Create delivery to a
stored follower.

Assisted-by: Codex:gpt-5.6-sol
Extend NoteStore with typed Note loading and add a pure core check for public
ActivityStreams addressing.

Expose canonical local post paths through the reference server runtime with
ActivityPub content negotiation while hiding missing and non-public Notes.

Update the reference example to load and serve its bounded persisted Note.

Assisted-by: Codex:gpt-5.6-sol
Require FederServer users to provide the authoritative WebFinger handle
host and validate acct resources against it.

Stop trusting the client-controlled Host header when deciding whether an
account belongs to the local deployment, and update the reference actor
server with its configured handle host.

Assisted-by: Codex:gpt-5.6-sol
Preserve the inbox endpoint selected during request routing and use its
authority when verifying signed requests.

Personal inbox requests continue to use the actor inbox, while shared inbox
requests use the actor's advertised sharedInbox endpoint. Treat requests for
actors without a shared inbox as accepted no-ops.

Assisted-by: Codex:gpt-5.6-sol
Restore the http-signatures feature boundary around actor keys, digest
generation, and draft-Cavage signing and verification.

Keep RSA, Base64, and zeroization out of the portable core dependency tree
unless explicitly requested. Enable the feature from the server runtime and
reference actor example.

Assisted-by: Codex:gpt-5.6-sol
  Replace complete stored Actor values in follower fan-out with the minimal
  addressing facts required for delivery: actor ID, inbox, and optional shared
  inbox.

  Update Note delivery and the reference example to use the compact target,
  keeping the storage contract compatible with the existing SQLite follower
  schema and avoiding unnecessary actor retention.

  Assisted-by: Codex:gpt-5.6-sol
Provide file-backed and in-memory SQLite storage implementing the new server,
Note, and follower-delivery storage capabilities.

Preserve the existing followers, actor keys, and objects schema while adding
persistent outbound Follow state. Synchronize connection access for shared
Axum state and use an immediate transaction for exact pending-Follow
confirmation.

Add focused coverage for follower delivery facts, Notes, pending Follow
transitions, actor keys, and Send and Sync compatibility.

Assisted-by: Codex:gpt-5.6-sol
Add a SQLite-backed load-or-generate operation for actor signing identities.

Reuse existing actor keys without invoking the random number generator.
When a key is absent, generate it outside the database lock and insert it
without replacing an identity established by a concurrent provisioner.

Add focused coverage that verifies initial provisioning and stable reuse.

Assisted-by: Codex:gpt-5.6-sol
  Replace the original RuntimeConfig-based example with the new FederServer,
  actor dispatcher, and built-in SQLite storage adapter.

  Provision the actor signing key through SQLite, publish its public key on the
  actor document, and preserve the signing identity across server restarts.
  Allow the database path to be configured through FEDER_DATABASE.

  Update the example documentation with actor and WebFinger requests.

  Assisted-by: Codex:gpt-5.6-sol
Move protocol transition tests into ref-feder-core/tests, covering Follow,
Accept, Undo, Note construction, actor keys, digests, and HTTP signatures.

Move the SQLite adapter tests out of the implementation module and into the
ref-feder-runtime-server integration test suite.

Add runtime coverage for actor and object endpoints, WebFinger, follower
collections, actor resolution, outbound delivery, signed personal and shared
inboxes, outbound Follow, incoming Undo, and Note persistence and delivery.

Keep test keys and shared test infrastructure local to each crate so the
reference crates can be tested independently.

Assisted-by: Codex:gpt-5.6-sol
Replace the previous stateful feder-core implementation with the portable
protocol transition functions and capability traits developed in the
reference crate.

Publish the standard operating system runtime as feder-server and update its
dependencies, imports, tests, and documentation to use the final feder-core
package.

Remove the superseded feder-runtime-server, temporary ref-* crates, and the
redundant custom-storage example. Retain the SQLite single-user server as a
non-publishable end-to-end example.

Restrict release version stamping to publishable workspace packages and update
the project documentation to describe the stateless core and server runtime
boundaries.

 Assisted-by: Codex:gpt-5.6-sol
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

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 Plus

Run ID: 29da8eb9-1c8e-4861-b6fa-e145a1b8065a

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

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.

@sij411 sij411 self-assigned this Aug 3, 2026
@sij411
sij411 merged commit 96866ad into fedify-dev:feat/experiment/architecture Aug 3, 2026
6 checks passed
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.

1 participant