Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d4244c7
Add custom background task API
2chanhaeng Jun 11, 2026
5f9af33
Restructure mise install tasks and update docs
2chanhaeng Jun 11, 2026
b3070ea
Make codegen a prerequisite of the install subtasks
2chanhaeng Jun 11, 2026
d07ea05
Add PR #803 link in changelog
2chanhaeng Jun 11, 2026
3ada130
Revive vocab nested in null-prototype objects
2chanhaeng Jun 11, 2026
c2a2d4c
Guard against an unparsable task started time
2chanhaeng Jun 11, 2026
6c0766f
Store task definitions in a prototype-safe Map
2chanhaeng Jun 11, 2026
9b3c8a5
Simplify task payload revival to a single matching reviver
2chanhaeng Jun 11, 2026
fc0af86
Start workers for dedicated per-task queues
2chanhaeng Jun 11, 2026
058fa84
Removed overly detailed comments and unused code
2chanhaeng Jun 11, 2026
e8bd70d
Remove *codec-fn.ts*
2chanhaeng Jun 11, 2026
d88a5a1
Document the idempotent-validation requirement for task schemas
2chanhaeng Jun 11, 2026
3a924f9
Reject enqueuing a task unknown to the federation
2chanhaeng Jun 11, 2026
a6f9137
Polish task enqueue path and queue-isolation docs
2chanhaeng Jun 11, 2026
39e6ec7
Type the task codec's reviver dispatch
2chanhaeng Jun 11, 2026
5237e13
Hide the task handle's phantom context-data marker
2chanhaeng Jun 11, 2026
40a9948
Pin deep-nesting support in the task codec
2chanhaeng Jun 11, 2026
14313a1
Reject foreign task handles by identity, not name
2chanhaeng Jun 12, 2026
e4f1880
Validate task payloads in the testing mock
2chanhaeng Jun 12, 2026
23fc263
Hoist @standard-schema/spec to the workspace root
2chanhaeng Jun 12, 2026
bccbd9f
Start the queue worker on custom task enqueue
2chanhaeng Jun 12, 2026
0e31bdd
Vet the whole mock task batch before any handler
2chanhaeng Jun 12, 2026
fc3965d
Reject foreign task handles in the testing mock
2chanhaeng Jun 12, 2026
ec87fc0
Use 2.x.x @since for new task APIs
2chanhaeng Jun 12, 2026
b444a6e
Fix doc and comment inaccuracies found in review
2chanhaeng Jun 12, 2026
ed60ecd
Cover enqueueTask(Many) in middleware tests
2chanhaeng Jun 14, 2026
94633f1
Append revived array elements without spread
2chanhaeng Jun 18, 2026
e095d6c
Polish task payload docs and cover Temporal
2chanhaeng Jun 18, 2026
3b5b5c8
Ignore `Temporal` test in Bun
2chanhaeng Jun 18, 2026
89ff332
Support deduplicationKey for task enqueue
2chanhaeng Jun 14, 2026
d96293b
Extract task enqueue pipeline out of ContextImpl
2chanhaeng Jun 14, 2026
cbd54b3
Merge task test helpers back into tasks.ts
2chanhaeng Jun 14, 2026
77a3510
Roll back dedup marker when a task enqueue fails
2chanhaeng Jun 15, 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
24 changes: 19 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,18 @@ Development workflow
- **Code Generation**: Run `mise run codegen` whenever vocabulary YAML files
or code generation scripts change.
- **Building Packages**: After installation, all packages are automatically
built. To rebuild a specific package and its dependencies, run `pnpm build`
in that package's directory.
- **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.
built. To rebuild a specific package and its dependencies, run
`mise run prepare`, or run `mise run prepare-each <pkgs>` to build
specific packages.
- **Checking Code**: Run `mise run check` before committing, or run
`mise run check-each <pkgs>` to check specific packages.
- **Running 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. If some specific tests are needed, execute
`mise run test:<runtime> <test-file-path-from-the-root>`.
Comment on lines +137 to +139

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use concrete runnable task names instead of pseudo-syntax.

mise run test:<runtime:deno,node,bun> reads like an executable command but is placeholder syntax. Please list concrete commands (test:deno, test:node, test:bun) to avoid copy-paste failures.

Suggested doc fix
-     -  `mise run test:<runtime:deno,node,bun>`: Executes all the tests by the
-        runtime. If some specific tests are needed, execute
-        `mise run test:<runtime> <test-file-path-from-the-root>`.
+     -  `mise run test:deno`, `mise run test:node`, `mise run test:bun`:
+        Execute all tests for a specific runtime. For a specific test file, run
+        `mise run test:<runtime> <test-file-path-from-the-root>`.
🤖 Prompt for 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.

In `@AGENTS.md` around lines 137 - 139, Replace the placeholder syntax `mise run
test:<runtime:deno,node,bun>` with concrete, runnable task names. List the
actual commands explicitly as `mise run test:deno`, `mise run test:node`, and
`mise run test:bun` so users can copy and paste them directly without having to
interpret pseudo-syntax. This makes the documentation immediately actionable and
prevents confusion.

- `mise run test-each <pkgs>`: Executes tests in packages that include
`pkgs` in every runtime.

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

Expand All @@ -151,6 +158,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
44 changes: 44 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,47 @@ To be released.
the dispatcher overload hot path; other contributors to `check-all` cost
may remain. [[#613], [#800] by ChanHaeng Lee]

- 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], [#803] by ChanHaeng Lee]

[Standard Schema]: https://standardschema.dev/
[#206]: https://github.com/fedify-dev/fedify/issues/206
[#316]: https://github.com/fedify-dev/fedify/issues/316
[#418]: https://github.com/fedify-dev/fedify/issues/418
[#613]: https://github.com/fedify-dev/fedify/issues/613
Expand Down Expand Up @@ -288,7 +329,10 @@ To be released.
[#778]: https://github.com/fedify-dev/fedify/pull/778
[#782]: https://github.com/fedify-dev/fedify/issues/782
[#787]: https://github.com/fedify-dev/fedify/pull/787
[#797]: https://github.com/fedify-dev/fedify/issues/797
[#798]: https://github.com/fedify-dev/fedify/issues/798
[#800]: https://github.com/fedify-dev/fedify/pull/800
[#803]: https://github.com/fedify-dev/fedify/pull/803

### @fedify/cli

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 @@ -145,6 +145,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