Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
b1cd1c3
Add custom background task API
2chanhaeng Jun 11, 2026
a096f2c
Restructure mise install tasks and update docs
2chanhaeng Jun 11, 2026
bc71b3f
Add PR #803 link in changelog
2chanhaeng Jun 11, 2026
6bc8bdf
Revive vocab nested in null-prototype objects
2chanhaeng Jun 11, 2026
f7c9a34
Guard against an unparsable task started time
2chanhaeng Jun 11, 2026
58c01ca
Store task definitions in a prototype-safe Map
2chanhaeng Jun 11, 2026
e36d692
Simplify task payload revival to a single matching reviver
2chanhaeng Jun 11, 2026
29dec04
Start workers for dedicated per-task queues
2chanhaeng Jun 11, 2026
3681747
Removed overly detailed comments and unused code
2chanhaeng Jun 11, 2026
7d5c3a1
Remove *codec-fn.ts*
2chanhaeng Jun 11, 2026
42153cb
Document the idempotent-validation requirement for task schemas
2chanhaeng Jun 11, 2026
0cd3155
Reject enqueuing a task unknown to the federation
2chanhaeng Jun 11, 2026
bd3f2ac
Polish task enqueue path and queue-isolation docs
2chanhaeng Jun 11, 2026
29a5dcb
Type the task codec's reviver dispatch
2chanhaeng Jun 11, 2026
f935cd5
Hide the task handle's phantom context-data marker
2chanhaeng Jun 11, 2026
7be32de
Pin deep-nesting support in the task codec
2chanhaeng Jun 11, 2026
5e14a01
Reject foreign task handles by identity, not name
2chanhaeng Jun 12, 2026
f7a9f38
Validate task payloads in the testing mock
2chanhaeng Jun 12, 2026
a2deb39
Hoist @standard-schema/spec to the workspace root
2chanhaeng Jun 12, 2026
33dfd68
Start the queue worker on custom task enqueue
2chanhaeng Jun 12, 2026
8e41a7e
Vet the whole mock task batch before any handler
2chanhaeng Jun 12, 2026
45b4e89
Reject foreign task handles in the testing mock
2chanhaeng Jun 12, 2026
80b1d12
Use 2.x.x @since for new task APIs
2chanhaeng Jun 12, 2026
193025b
Fix doc and comment inaccuracies found in review
2chanhaeng Jun 12, 2026
4303ac4
Cover enqueueTask(Many) in middleware tests
2chanhaeng Jun 14, 2026
1d82b19
Append revived array elements without spread
2chanhaeng Jun 18, 2026
369e01f
Polish task payload docs and cover Temporal
2chanhaeng Jun 18, 2026
de7cad5
Ignore `Temporal` test in Bun
2chanhaeng Jun 18, 2026
d8727b7
Move custom background task changelog to v2.4.0
2chanhaeng Jun 26, 2026
c12bba6
Support deduplicationKey for task enqueue
2chanhaeng Jun 14, 2026
6ebba53
Extract task enqueue pipeline out of ContextImpl
2chanhaeng Jun 14, 2026
8c02ddd
Merge task test helpers back into tasks.ts
2chanhaeng Jun 14, 2026
5e3944f
Roll back dedup marker when a task enqueue fails
2chanhaeng Jun 15, 2026
afdaa61
Fix and simplify task queue worker startup
2chanhaeng Jun 22, 2026
01c3fab
Resolve MockQueue.listen() on a pre-aborted signal
2chanhaeng Jun 22, 2026
ed64469
Fall back to enqueue() for single deduplicated batch
2chanhaeng Jun 22, 2026
5319c1e
Give each task test its own MemoryKvStore
2chanhaeng Jun 22, 2026
ae0d9c7
Clarify task docs and add missing JSDoc
2chanhaeng Jun 22, 2026
b100954
Finalized `@since` tag related to custom tasks from 2.x.x to 2.4.0
2chanhaeng Jun 27, 2026
ffd842a
Soften emphasis and fix jsr-ref tildes in tasks.md
2chanhaeng Jul 1, 2026
7ccdc0d
Clarify that deduplicationKey only requests dedup
2chanhaeng Jul 1, 2026
77109fe
Reject dedup batch on cas path through wrapper
2chanhaeng Jul 1, 2026
2703445
Support deduplicationKey for task enqueue
2chanhaeng Jun 14, 2026
3117772
Add OpenTelemetry observability to custom tasks
2chanhaeng Jun 20, 2026
3fb3d8b
Drop the build step from the Deno test task
2chanhaeng Jun 11, 2026
72929a6
Record only terminal task failures in telemetry
2chanhaeng Jul 4, 2026
c7c512d
Make task enqueue metrics survive partial fan-out
2chanhaeng Jul 4, 2026
f590b30
Fix docs and versions
2chanhaeng Jul 4, 2026
728d480
Clarify result type of `FederationImpl.metrics`
2chanhaeng Jul 6, 2026
89a1a67
Clarify task telemetry semantics in docs and code
2chanhaeng Jul 6, 2026
b48b549
Distinguish task retry re-enqueue failures
2chanhaeng Jul 6, 2026
0052bb9
Deduplicate queue worker-boundary instrumentation
2chanhaeng Jul 6, 2026
b37fdfd
Add `wait_for = ["build"]` in `tasks."test:deno"`
2chanhaeng Jul 6, 2026
6eb234c
Deflake the stale-rollback dedup marker test
2chanhaeng Jul 6, 2026
eae895c
Combine duplicate `@fedify/fedify` sections in `Version 2.4.0` and ad…
2chanhaeng Jul 7, 2026
3b0a453
Revive `To be released.`
2chanhaeng Jul 7, 2026
2c99806
Update `markdown-it-jsr-ref` version to 0.5.0
2chanhaeng Jul 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,29 @@ Development workflow
the editor/LSP after editing YAML.
- **Building Packages**: All packages are built automatically as part of
setup. Run `mise run build` to rebuild everything, or
`mise run prepare-each <pkg>` to rebuild just one (without the `@fedify/`
prefix).
- **Checking Code**: Run `mise run check` before committing.
- **Running Tests**: Use `mise run test:deno` for Deno tests or
`mise run test` for all environments.
`mise run prepare-each <pkgs>` to rebuild specific packages (without the
`@fedify/` prefix).
- **Checking Code**: Run `mise run check` before committing, or run
`mise run check-each <pkgs>` to check specific packages. If any issues from
`check:fmt`, `check:lint` or `check:md`, are found, refers
**Formatting and Linting** section.
- **Formatting and Linting**: Run `mise run fmt` to format all code and docs.
- **Running Tests**:
While testing is certainly important, blindly running every test suite every
time is inefficient. Since Deno executes TS source code directly, it doesn't
waste resources on builds. Therefore, during development, run
`mise run test:deno {TEST_PATH} --filter <TEST_TITLE>` for most tests that
are independent of the runtime. If the test is dependent on a specific
runtime other than Deno, replace `test:deno` with `test:node` or `test:bun`.
Once development is complete, run `mise run test-each <pkgs>` to test the
modified packages (without the `@fedify/` prefix).
Finally, when ready for deployment, run `mise run test` to execute the
whole codebase-wide tests.
- `mise run test`: Executes all the tests in every runtime.
- `mise run test:<runtime:deno,node,bun>`:
Executes all the tests by the runtime.
- `mise run test-each <pkgs>`: Executes tests in packages that include
`pkgs` in every runtime (without the `@fedify/` prefix).

For detailed contribution guidelines, see *CONTRIBUTING.md*.

Expand All @@ -169,6 +187,13 @@ When working with federation code:
Common tasks
------------

### **BE WELL-ACQUAINTED WITH `mise tasks`**

*mise.toml* has useful tasks. **Acquaint all of them** and use them in the right
place at the right time. If it has too much information, use `mise tasks`. This
command shows the summary of the tasks and descriptions. If `mise tasks` does
not make it clear, use `mise tasks <task>` to check the details for the task.

### Adding ActivityPub vocabulary types

1. Create a new YAML file in *packages/vocab/vocab/* following existing
Expand Down
49 changes: 49 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,59 @@ To be released.
as a remote JSON-LD document, which is required for [FEP-ef61]
portable objects. [[#827], [#915]]

- Added a custom background task API that generalizes Fedify's
enqueue-and-process-later pattern to arbitrary application-defined jobs:

- `Federation` and `FederationBuilder` gained a `defineTask()` method
through the new `TaskRegistry` interface, which `Federatable` now
extends.
- `Context` gained `enqueueTask()` and `enqueueTaskMany()` methods,
with `delay` and `orderingKey` options
(new `TaskEnqueueOptions` interface).
- Every task requires a [Standard Schema]
(`schema` option) from which the payload type is inferred; payloads
are validated at enqueue time (fail fast) and again at dequeue time
(protection against schema drift across deployments).
- Payloads are serialized by Fedify with devalue, so `Date`, `Map`,
`Set`, `URL`, `bigint`, circular references, and Activity Vocabulary
objects round-trip faithfully across every message queue backend.
- Failed handlers are retried with exponential backoff by default;
tasks support per-task `retryPolicy` and `onError` options, the new
`FederationOptions.taskRetryPolicy` sets the federation-wide default,
and queues with `nativeRetrial` delegate retries to the backend.
- Tasks can be isolated from activity delivery through the new
`FederationQueueOptions.task` slot or a per-task `queue` option;
without them, tasks fall back to the outbox queue unless the new
`FederationOptions.taskQueueResolution` option is set to `"strict"`.
`Federation.startQueue()` now accepts `queue: "task"` to run
a task-only worker.
- Tasks can request at-most-once enqueue with a `deduplicationKey`
(new `TaskEnqueueOptions.deduplicationKey`). A queue declaring the new
`MessageQueue.nativeDeduplication` capability owns the check and
receives the key through the new
`MessageQueueEnqueueOptions.deduplicationKey`; otherwise Fedify
performs a best-effort key–value guard through the optional
`KvStore.cas` primitive, under a new `taskDeduplication` key prefix.
The marker TTL and the no-`cas` fallback are tunable with the new
`FederationOptions.taskDeduplicationTtl` and
`FederationOptions.taskDeduplicationFallback` options.

[[#206], [#797], [#798], [#799], [#803], [#806], [#812], [#923] by
ChanHaeng Lee]

[FEP-8b32]: https://w3id.org/fep/8b32
[FEP-ef61]: https://w3id.org/fep/ef61
[Standard Schema]: https://standardschema.dev/
[#206]: https://github.com/fedify-dev/fedify/issues/206
[#797]: https://github.com/fedify-dev/fedify/issues/797
[#798]: https://github.com/fedify-dev/fedify/issues/798
[#799]: https://github.com/fedify-dev/fedify/issues/799
[#803]: https://github.com/fedify-dev/fedify/pull/803
[#806]: https://github.com/fedify-dev/fedify/pull/806
[#812]: https://github.com/fedify-dev/fedify/pull/812
[#827]: https://github.com/fedify-dev/fedify/issues/827
[#915]: https://github.com/fedify-dev/fedify/pull/915
[#923]: https://github.com/fedify-dev/fedify/pull/923

### @fedify/vocab

Expand Down
8 changes: 5 additions & 3 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ const MANUAL = {
{ text: "Pragmatics", link: "/manual/pragmatics.md" },
{ text: "Key–value store", link: "/manual/kv.md" },
{ text: "Message queue", link: "/manual/mq.md" },
{ text: "Background tasks", link: "/manual/tasks.md" },
{ text: "Circuit breaker", link: "/manual/circuit-breaker.md" },
{ text: "Integration", link: "/manual/integration.md" },
{ text: "Migration", link: "/manual/migrate.md" },
Expand Down
Loading
Loading