Skip to content

Conversation

@dahlia
Copy link
Member

@dahlia dahlia commented May 26, 2025

Implements clone() method for all context types (Context, RequestContext, InboxContext) to create new contexts with modified data while preserving other properties. Updates documentation and tests accordingly.

@dahlia dahlia added this to the Fedify 1.6 milestone May 26, 2025
@dahlia dahlia requested a review from Copilot May 26, 2025 14:54
@dahlia dahlia self-assigned this May 26, 2025
@dahlia dahlia added the type/enhancement Improvements to existing features label May 26, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a new Context.clone() method for Context, RequestContext, and InboxContext in order to easily create new context instances with updated data while preserving the remaining properties. Key changes include adding a default clone implementation in factory functions, overriding clone in concrete context classes, and updating tests and documentation to verify and demonstrate the new functionality.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
fedify/testing/context.ts Added default clone implementations in createContext, createRequestContext, and createInboxContext.
fedify/federation/middleware.ts Implemented clone overrides in ContextImpl, RequestContextImpl, and InboxContextImpl.
fedify/federation/middleware.test.ts Added test steps to verify the behavior of Context.clone() and RequestContext.clone().
fedify/federation/handler.test.ts Updated InboxContext factory usage to ensure the new clone property is not propagated unintentionally.
fedify/federation/context.ts Updated context interfaces to include the clone method.
docs/manual/context.md Revised documentation to include instructions and examples for using Context.clone().
CHANGES.md Added a changelog entry for Context.clone() implementation.

@github-actions
Copy link
Contributor

The latest push to this pull request has been published to JSR and npm
as a pre-release:

@github-actions
Copy link
Contributor

The latest push to this pull request has been published to JSR and npm as a pre-release:

@github-actions
Copy link
Contributor

The latest push to this pull request has been published to JSR and npm as a pre-release:

@dahlia dahlia temporarily deployed to github-pages May 27, 2025 09:38 — with Image GitHub Actions Inactive
@github-actions
Copy link
Contributor

github-actions bot commented May 27, 2025

🎉 Published on https://unstable.fedify.dev as production
🚀 Deployed on https://6835aabeb1b24da4a93813f8--fedify.netlify.app

@github-actions github-actions bot temporarily deployed to production May 27, 2025 09:42 Inactive
@github-actions
Copy link
Contributor

The latest push to this pull request has been published to JSR and npm as a pre-release:

@dahlia dahlia temporarily deployed to github-pages May 27, 2025 10:26 — with Image GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to production May 27, 2025 10:30 Inactive
@github-actions
Copy link
Contributor

The latest push to this pull request has been published to JSR and npm as a pre-release:

Implements clone() method for all context types (Context, RequestContext,
InboxContext) to create new contexts with modified data while preserving
other properties. Updates documentation and tests accordingly.
@github-actions
Copy link
Contributor

The latest push to this pull request has been published to JSR and npm as a pre-release:

@dahlia dahlia temporarily deployed to github-pages May 27, 2025 14:31 — with Image GitHub Actions Inactive
@github-actions
Copy link
Contributor

The docs for this pull request have been published:

https://97b38ea1.fedify.pages.dev

@dahlia dahlia merged commit 58ee54a into fedify-dev:main May 27, 2025
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/enhancement Improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant