Skip to content

Add @fedify/nuxt package for Nuxt integration#674

Merged
dahlia merged 25 commits intofedify-dev:mainfrom
2chanhaeng:fedify/nuxt
Apr 15, 2026
Merged

Add @fedify/nuxt package for Nuxt integration#674
dahlia merged 25 commits intofedify-dev:mainfrom
2chanhaeng:fedify/nuxt

Conversation

@2chanhaeng
Copy link
Copy Markdown
Contributor

@2chanhaeng 2chanhaeng commented Apr 13, 2026

Closes #149

Tip

Of the 4,315 lines of additions, 3,349 lines are pnpm-lock.yaml
changes. The actual code to review is under 1,000 lines.

Changes

  • Added @fedify/nuxt package that provides a Nuxt module integrating
    Fedify into Nitro middleware with deferred 406 Not Acceptable
    handling for content negotiation.
  • Added Nuxt section to docs/manual/integration.md.
  • Updated workspace configs, package listings, and CHANGES.md.
  • Updated agent skill docs with clarified guidance (non-functional).

Assisted-by: GPT-5.3-codex

@issues-auto-labeler issues-auto-labeler bot added component/build Build system and packaging component/federation Federation object related component/integration Web framework integration labels Apr 13, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new @fedify/nuxt Nuxt 4 / Nitro integration: module wiring, runtime middleware and plugin for deferred 406 handling, request/response helpers and tests; packages, build config, docs, workspace/tooling updates, and minor agent-skill docs edits.

Changes

Cohort / File(s) Summary
Nuxt integration core
packages/nuxt/src/mod.ts, packages/nuxt/src/runtime/server/lib.ts, packages/nuxt/src/runtime/server/logic.ts, packages/nuxt/src/runtime/server/middleware.ts, packages/nuxt/src/runtime/server/plugin.ts
New Nuxt module and runtime: exported types/options, template-based middleware registration, deferred-406 constants, fetch normalization (fetchWithFedify), middleware factory (createFedifyMiddleware) and server plugin that resolves/applies deferred 406 responses.
Module implementation & helpers
packages/nuxt/src/module.ts, packages/nuxt/src/runtime/server/lib.ts, packages/nuxt/src/runtime/server/logic.ts
Module-level helpers to resolve module paths, build context-data resolver code, and runtime logic to normalize federation fetch outcomes and compute deferred 406 responses.
Package manifests & build
packages/nuxt/package.json, packages/nuxt/deno.json, packages/nuxt/tsdown.config.ts, packages/nuxt/deno.json
New npm/Deno manifests and tsdown config: exports map, peer/dev deps, scripts, deno metadata, and tsdown ESM/CJS outputs with dual-type declarations.
Tests
packages/nuxt/src/mod.test.ts, packages/nuxt/src/module.test.ts, packages/nuxt/src/runtime/server/logic.test.ts, packages/nuxt/src/runtime/server/plugin.test.ts
Added unit and fixture tests validating fetchWithFedify, resolveDeferredNotAcceptable, plugin behavior, module path resolution, and context-factory resolver code generation/error handling.
Docs & changelog
packages/nuxt/README.md, docs/manual/integration.md, CHANGES.md, packages/fedify/README.md
Documentation and changelog entries for the Nuxt integration, including README, integration docs, and changelog additions describing behavior and configuration.
Workspace & tooling
deno.json, pnpm-workspace.yaml, mise.toml, cspell.json, .hongdown.toml
Workspace and tooling updates: added packages/nuxt to Deno/pnpm workspaces, new mise tunnel task, added nuxt/nuxi to cspell, and added @fedify/nuxt to proper-nouns.
Agent skills & example docs
.agents/skills/.../SKILL.md, .agents/skills/create-example-app-with-integration/example/README.md, .agents/skills/add-to-fedify-init/SKILL.md
Documentation edits in agent skill instructions and example README: replace placeholder refs with relative links, checklist template files, server config note, and expanded testing fallback instructions.
Monorepo lists
AGENTS.md, CONTRIBUTING.md, packages/fedify/README.md
Updated monorepo package lists and README tables to include packages/nuxt/* / @fedify/nuxt entries.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Nitro as Nitro/H3_Event_Handler
    participant FedifyMiddleware as Fedify_Middleware
    participant FedifyFetch as fetchWithFedify
    participant Federation as Federation_Instance
    participant Framework as Nuxt_Handler
    participant Plugin as Deferred_Response_Plugin

    Client->>Nitro: HTTP Request
    Nitro->>FedifyMiddleware: Invoke handler (H3 event)
    FedifyMiddleware->>FedifyMiddleware: toWebRequest / compute contextData
    FedifyMiddleware->>FedifyFetch: fetchWithFedify(fetch, request, contextData)
    FedifyFetch->>Federation: federation.fetch(request, { onNotFound, onNotAcceptable, ... })
    alt federation handled (ActivityPub)
        Federation-->>FedifyFetch: ActivityPub Response (e.g., 200, application/activity+json)
        FedifyFetch-->>FedifyMiddleware: { kind: "handled", response }
        FedifyMiddleware->>Nitro: return federation response
        Nitro-->>Client: federation response
    else not-found
        Federation-->>FedifyFetch: NotFound sentinel (internal)
        FedifyFetch-->>FedifyMiddleware: { kind: "not-found" }
        FedifyMiddleware->>Nitro: return undefined (delegate)
        Nitro->>Framework: continue to Nuxt handler
        Framework-->>Nitro: framework response
        Nitro-->>Client: framework response
    else not-acceptable
        Federation-->>FedifyFetch: NotAcceptable sentinel (internal)
        FedifyFetch-->>FedifyMiddleware: { kind: "not-acceptable" }
        FedifyMiddleware->>FedifyMiddleware: set deferred flag in event.context
        FedifyMiddleware->>Nitro: return undefined (delegate)
        Nitro->>Framework: continue to Nuxt handler
        Framework-->>Nitro: framework response
        Nitro->>Plugin: beforeResponse hook
        Plugin->>Plugin: resolveDeferredNotAcceptable(deferred, frameworkStatus)
        alt returns 406
            Plugin->>Nitro: set status, headers, body -> 406 Not Acceptable
        else undefined
            Plugin->>Nitro: leave framework response intact
        end
        Nitro-->>Client: final response
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • dahlia
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding a new @fedify/nuxt package for Nuxt integration.
Description check ✅ Passed The description clearly explains the changes, including the new package, documentation updates, and workspace configuration modifications related to the PR objectives.
Linked Issues check ✅ Passed The PR fully addresses issue #149 by providing an official Nuxt integration package with module setup, middleware handlers, proper 406 content negotiation, and documentation.
Out of Scope Changes check ✅ Passed All changes are within scope: the @fedify/nuxt package, documentation, workspace configs, and agent skill clarifications directly support the Nuxt integration objective from #149.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the @fedify/nuxt package to integrate Fedify with the Nuxt framework, providing a module, Nitro middleware, and a plugin for deferred 406 Not Acceptable handling. It also updates documentation, agent skills, and workspace configurations. Feedback recommends improving TypeScript type safety by using specific types from @nuxt/kit and h3, and suggests extracting the "Not acceptable" response body into a shared constant to prevent duplication across the runtime logic and plugin.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.agents/skills/create-example-app-with-integration/SKILL.md (1)

180-193: ⚠️ Potential issue | 🟠 Major

Close the bash fence immediately after the curl example.

Line 180 opens a fence, but it is only closed at Line 193. That makes the “Lint, format, and final checks” section render as code.

Suggested fix
 ~~~~ bash
 curl -H "Accept: application/activity+json" http://localhost:0000/users/demo
+~~~~
 
 Lint, format, and final checks
 ------------------------------
@@
-~~~~
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/skills/create-example-app-with-integration/SKILL.md around lines 180
- 193, The markdown code fence opened with "~~~~ bash" around the curl example
is left open; close that fence immediately after the curl command so the
following "Lint, format, and final checks" section is not rendered as code—i.e.,
move or add the matching closing fence "~~~~" directly after the line with `curl
-H "Accept: application/activity+json" http://localhost:0000/users/demo` (refer
to the fenced block starting with "~~~~ bash" in SKILL.md) and ensure subsequent
text is plain markdown outside the fence.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/skills/create-example-app-with-integration/SKILL.md:
- Line 178: Update the wording in SKILL.md where the sentence reads "If the
`test:examples` can not be run, just run the server and test with curl:" to use
the standard single-word form "cannot" (i.e., change "can not" to "cannot") so
the line becomes "If the `test:examples` cannot be run, just run the server and
test with curl:".

In `@docs/manual/integration.md`:
- Around line 397-418: The Nuxt docs use inconsistent path styling; update the
Nuxt section so all file and module paths are wrapped in asterisks instead of
underscores or backticks—replace occurrences like _server/federation.ts_,
_nuxt.config.ts_, and `~/server/federation` with *server/federation.ts*,
*nuxt.config.ts*, and *~/server/federation* respectively (in the block that
shows createFederation / MemoryKvStore and the module enablement) so path
styling matches the repo guideline.

In `@packages/nuxt/README.md`:
- Around line 71-72: Replace the inline code backticks around the default module
path with asterisks: change the instance that reads "`@fedify/nuxt` loads your
Federation instance from `~/server/federation`" so that the module and path use
asterisk wrapping (e.g., *@fedify/nuxt* and *~/server/federation*) to comply
with the repo Markdown rule; update the README line containing "@fedify/nuxt"
and "~/server/federation" accordingly.

In `@packages/nuxt/src/mod.test.ts`:
- Line 2: Replace the runtime-specific import of the test entrypoint by
importing the test function from the runtime-agnostic package: change the import
of test from "node:test" to "@fedify/fixture" (i.e., replace the existing import
statement that references node:test with one that imports test from
`@fedify/fixture`), ensuring any usages of the test identifier remain unchanged.

In `@packages/nuxt/src/runtime/server/logic.ts`:
- Around line 47-53: Add a JSDoc block above the exported function
resolveDeferredNotAcceptable that documents its purpose (handle deferred
requests that should return a 406 Not Acceptable when the framework routed to
404), describes parameters isDeferred:boolean and frameworkStatus:number,
explains the return type Response|undefined and the conditions when
createNotAcceptableResponse() is returned, and notes that this is part of the
deferred 406 handling pattern for public API consumers; keep the comment concise
and follow existing project JSDoc style.
- Around line 22-45: Add a JSDoc block to the exported function fetchWithFedify
describing its purpose, parameters (fetcher: (request: Request, options:
FederationFetchOptions<unknown>) => Promise<Response>, request: Request,
contextData: unknown) and return value (Promise<FetchResult>), and note the
behavior/assumption that a response equal to DUMMY_NOT_FOUND_RESPONSE maps to {
kind: "not-found" } and any Response with status 406 is treated as { kind:
"not-acceptable" } (which relies on user handlers not returning 406 for
unrelated reasons); reference DUMMY_NOT_FOUND_RESPONSE and
createNotAcceptableResponse in the doc so callers understand the special-case
mappings.

In `@packages/nuxt/src/runtime/server/middleware.ts`:
- Around line 20-23: Add a JSDoc block above the exported createFedifyMiddleware
function that documents its parameters and return value: describe the
"federation" parameter type/expected shape (unknown but clarify expected usage),
the optional "contextDataFactory" callback signature ((event: unknown, request:
Request) => unknown) and when it is invoked, the middleware behavior (what the
returned function does, side effects, and that it returns a
Connect/Node/Fetch-style middleware handler), and the return type expectations
(e.g., middleware function or handler). Use the function name
createFedifyMiddleware and mention the contextDataFactory callback to make the
doc discoverable.

---

Outside diff comments:
In @.agents/skills/create-example-app-with-integration/SKILL.md:
- Around line 180-193: The markdown code fence opened with "~~~~ bash" around
the curl example is left open; close that fence immediately after the curl
command so the following "Lint, format, and final checks" section is not
rendered as code—i.e., move or add the matching closing fence "~~~~" directly
after the line with `curl -H "Accept: application/activity+json"
http://localhost:0000/users/demo` (refer to the fenced block starting with "~~~~
bash" in SKILL.md) and ensure subsequent text is plain markdown outside the
fence.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 833b06e0-e342-4d98-af3c-fa0f0c532116

📥 Commits

Reviewing files that changed from the base of the PR and between 5323388 and 90757cb.

⛔ Files ignored due to path filters (2)
  • deno.lock is excluded by !**/*.lock
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (24)
  • .agents/skills/add-to-fedify-init/SKILL.md
  • .agents/skills/create-example-app-with-integration/SKILL.md
  • .agents/skills/create-example-app-with-integration/example/README.md
  • .agents/skills/create-example-app-with-integration/example/src/logging.ts
  • .agents/skills/create-integration-package/SKILL.md
  • .hongdown.toml
  • AGENTS.md
  • CHANGES.md
  • CONTRIBUTING.md
  • cspell.json
  • deno.json
  • docs/manual/integration.md
  • mise.toml
  • packages/fedify/README.md
  • packages/nuxt/README.md
  • packages/nuxt/deno.json
  • packages/nuxt/package.json
  • packages/nuxt/src/mod.test.ts
  • packages/nuxt/src/mod.ts
  • packages/nuxt/src/runtime/server/logic.ts
  • packages/nuxt/src/runtime/server/middleware.ts
  • packages/nuxt/src/runtime/server/plugin.ts
  • packages/nuxt/tsdown.config.ts
  • pnpm-workspace.yaml

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 70.18634% with 48 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/nuxt/src/module.ts 47.25% 48 Missing ⚠️
Files with missing lines Coverage Δ
packages/nuxt/src/runtime/server/lib.ts 100.00% <100.00%> (ø)
packages/nuxt/src/runtime/server/logic.ts 100.00% <100.00%> (ø)
packages/nuxt/src/runtime/server/plugin.ts 100.00% <100.00%> (ø)
packages/nuxt/src/module.ts 47.25% <47.25%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In @.agents/skills/add-to-fedify-init/SKILL.md:
- Around line 37-39: Replace the inline link and plain file paths in the
sentence that mentions WebFrameworkDescription, changing `./init/framework.ts`
and `packages/init/src/types.ts` to wrapped paths (*./init/framework.ts*,
*packages/init/src/types.ts*) and convert the inline link to a reference-style
link (e.g., [init/framework.ts][init-framework]) with the corresponding
reference entry placed at the end of the section; update the sentence to refer
to the reference label and ensure the symbol WebFrameworkDescription remains
mentioned so you can find the exact line to edit.

In `@packages/nuxt/deno.json`:
- Line 24: The "check" npm script currently only runs deno check on "src/*.ts"
which skips nested runtime files (e.g., src/runtime/server/); update the "check"
script (the "check" key value that currently contains "deno fmt --check && deno
lint && deno check src/*.ts") to use a recursive glob such as "src/**/*.ts" or
explicitly include the runtime folder (for example add
"src/runtime/server/**/*.ts") so that deno check covers all nested runtime
TypeScript files.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 44c494fa-0e71-490b-ad31-ac3a6bde1a5c

📥 Commits

Reviewing files that changed from the base of the PR and between 90757cb and 7c3f831.

⛔ Files ignored due to path filters (2)
  • deno.lock is excluded by !**/*.lock
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (25)
  • .agents/skills/add-to-fedify-init/SKILL.md
  • .agents/skills/create-example-app-with-integration/SKILL.md
  • .agents/skills/create-example-app-with-integration/example/README.md
  • .agents/skills/create-example-app-with-integration/example/src/logging.ts
  • .agents/skills/create-integration-package/SKILL.md
  • .hongdown.toml
  • AGENTS.md
  • CHANGES.md
  • CONTRIBUTING.md
  • cspell.json
  • deno.json
  • docs/manual/integration.md
  • mise.toml
  • packages/fedify/README.md
  • packages/nuxt/README.md
  • packages/nuxt/deno.json
  • packages/nuxt/package.json
  • packages/nuxt/src/mod.test.ts
  • packages/nuxt/src/mod.ts
  • packages/nuxt/src/runtime/server/lib.ts
  • packages/nuxt/src/runtime/server/logic.ts
  • packages/nuxt/src/runtime/server/middleware.ts
  • packages/nuxt/src/runtime/server/plugin.ts
  • packages/nuxt/tsdown.config.ts
  • pnpm-workspace.yaml

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/nuxt/src/mod.ts`:
- Around line 87-93: The current contextFactoryResolver silently treats a
non-function export from contextDataFactoryModule as undefined, causing hidden
misconfiguration; update the resolver logic around contextFactoryResolver to
check whether contextDataFactoryModule.default ??
contextDataFactoryModule.contextDataFactory is present and is a function, and if
it exists but is not a function throw a descriptive Error (mentioning
contextDataFactoryModule and the expected function export) instead of assigning
undefined, otherwise assign the function to contextDataFactory as before.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d6eaeee1-e713-4a85-9ec6-0ff5fd614e21

📥 Commits

Reviewing files that changed from the base of the PR and between a5b7b8d and a2d0460.

📒 Files selected for processing (2)
  • packages/nuxt/deno.json
  • packages/nuxt/src/mod.ts

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
packages/nuxt/src/mod.ts (1)

87-93: ⚠️ Potential issue | 🟠 Major

Validate contextDataFactoryModule export type instead of silently ignoring bad config.

At Line 90–93, a non-function export is accepted and later treated as undefined, which hides configuration errors and drops context data unexpectedly.

🔧 Proposed fix
           const contextFactoryResolver = contextDataFactoryModule == null
             ? "const contextDataFactory = undefined;"
             : [
               "const contextDataFactory =",
               "  contextFactoryModule.default ??",
               "  contextFactoryModule.contextDataFactory;",
+              "if (contextDataFactory != null && typeof contextDataFactory !== 'function') {",
+              "  throw new TypeError(",
+              "    '@fedify/nuxt: contextDataFactoryModule must export a function as default export or named export \"contextDataFactory\".',",
+              "  );",
+              "}",
             ].join("\n");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/nuxt/src/mod.ts` around lines 87 - 93, The current resolver silently
treats a non-function export from contextDataFactoryModule as undefined; update
the contextFactoryResolver logic to validate that the resolved export
(contextDataFactoryModule.default ??
contextDataFactoryModule.contextDataFactory) is a function and throw a clear
error (or call Nuxt's logger/error) if it's not; specifically, in the code that
builds contextFactoryResolver, replace the unconditional assignment to
contextDataFactory with a runtime type-check that verifies typeof
contextDataFactory === "function" and fails fast referencing
contextDataFactoryModule/contextDataFactory to surface misconfiguration instead
of silently dropping context data.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/skills/create-integration-package/SKILL.md:
- Line 250: Update the final validation command text that currently reads "mise
run fmt && mise run check" to the repository-standard "mise run fmt && mise
check"; locate the string in SKILL.md (the sentence starting "After
implementation, run") and replace the second invocation "mise run check" without
changing surrounding wording or formatting so the documented convention matches
the CI-style check.

In `@packages/nuxt/src/runtime/server/plugin.ts`:
- Around line 32-43: The current deferred 406 rewrite uses only the final status
(via resolveDeferredNotAcceptable/getResponseStatus) and thus converts
legitimate downstream 404 responses into 406; change the logic to only apply the
negotiated 406 when there is an actual route-miss signal rather than any 404.
Concretely, update the call/site using resolveDeferredNotAcceptable/deferred
(and related code paths) so you first check a route-miss indicator (e.g., a
boolean on deferred such as deferred.routeMiss or an explicit framework "not
found" flag on the event/context) and only proceed to setResponseStatus,
setResponseHeader and payload.body = NOT_ACCEPTABLE_BODY when negotiatedResponse
is non-null AND that route-miss flag is true; leave responses alone when a
downstream handler legitimately returned 404 but the route was matched.

---

Duplicate comments:
In `@packages/nuxt/src/mod.ts`:
- Around line 87-93: The current resolver silently treats a non-function export
from contextDataFactoryModule as undefined; update the contextFactoryResolver
logic to validate that the resolved export (contextDataFactoryModule.default ??
contextDataFactoryModule.contextDataFactory) is a function and throw a clear
error (or call Nuxt's logger/error) if it's not; specifically, in the code that
builds contextFactoryResolver, replace the unconditional assignment to
contextDataFactory with a runtime type-check that verifies typeof
contextDataFactory === "function" and fails fast referencing
contextDataFactoryModule/contextDataFactory to surface misconfiguration instead
of silently dropping context data.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c7d0ca7b-05f4-4d60-9211-cd5a98f3de04

📥 Commits

Reviewing files that changed from the base of the PR and between a2d0460 and 58807b9.

⛔ Files ignored due to path filters (2)
  • deno.lock is excluded by !**/*.lock
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (25)
  • .agents/skills/add-to-fedify-init/SKILL.md
  • .agents/skills/create-example-app-with-integration/SKILL.md
  • .agents/skills/create-example-app-with-integration/example/README.md
  • .agents/skills/create-example-app-with-integration/example/src/logging.ts
  • .agents/skills/create-integration-package/SKILL.md
  • .hongdown.toml
  • AGENTS.md
  • CHANGES.md
  • CONTRIBUTING.md
  • cspell.json
  • deno.json
  • docs/manual/integration.md
  • mise.toml
  • packages/fedify/README.md
  • packages/nuxt/README.md
  • packages/nuxt/deno.json
  • packages/nuxt/package.json
  • packages/nuxt/src/mod.test.ts
  • packages/nuxt/src/mod.ts
  • packages/nuxt/src/runtime/server/lib.ts
  • packages/nuxt/src/runtime/server/logic.ts
  • packages/nuxt/src/runtime/server/middleware.ts
  • packages/nuxt/src/runtime/server/plugin.ts
  • packages/nuxt/tsdown.config.ts
  • pnpm-workspace.yaml

@dahlia dahlia self-assigned this Apr 14, 2026
@dahlia dahlia added this to the Fedify 2.2 milestone Apr 14, 2026
@dahlia
Copy link
Copy Markdown
Member

dahlia commented Apr 14, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5b22a1e4b

ℹ️ 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".

2chanhaeng added a commit to 2chanhaeng/fedify that referenced this pull request Apr 14, 2026
 - Use en dash instead of hyphen in example README template
   title ("Fedify–프레임워크")
 - Wrap HTTP status codes in backticks and use official reason
   phrases in SKILL.md headings ("404 Not Found",
   "406 Not Acceptable")
 - Capitalize "Acceptable" in CHANGES.md to match the official
   HTTP status phrase

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
2chanhaeng added a commit to 2chanhaeng/fedify that referenced this pull request Apr 14, 2026
The test file imports from @fedify/fixture but it was missing
from devDependencies, which would cause ERR_MODULE_NOT_FOUND
in a clean install when running Node.js tests.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
2chanhaeng added a commit to 2chanhaeng/fedify that referenced this pull request Apr 14, 2026
Add failing tests that reproduce four bugs identified in PR
review comments:

 - logic.test.ts: handler-returned 406 is misclassified as
   "not-acceptable" instead of "handled" (review fedify-dev#5)
 - logic.test.ts: framework's intentional 404 on shared routes
   is rewritten to 406 by resolveDeferredNotAcceptable (review fedify-dev#6)
 - module.test.ts: resolveAlias does not resolve plain relative
   paths to absolute, breaking .nuxt/ imports (review fedify-dev#7)
 - module.test.ts: missing default/contextDataFactory exports
   silently return undefined instead of throwing (review fedify-dev#9)

All four tests fail against the current implementation and will
pass once the corresponding bugs are fixed.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6

Add regression tests for PR review issues

Add regression tests for PR review issues
2chanhaeng added a commit to 2chanhaeng/fedify that referenced this pull request Apr 14, 2026
Replace the status-code-based check (response.status === 406) with
an identity comparison against the synthetic response created by
the onNotAcceptable callback.  This prevents genuine handler-returned
406 responses from being misclassified as "not-acceptable".

The fix mirrors the existing pattern used for not-found detection,
where DUMMY_NOT_FOUND_RESPONSE is compared by reference.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
2chanhaeng added a commit to 2chanhaeng/fedify that referenced this pull request Apr 14, 2026
Add a routeHandled parameter to resolveDeferredNotAcceptable so
that it can distinguish a framework's intentional 404 (e.g., a
matched page returning "user not found") from a genuine route
miss.  When routeHandled is true, the framework's 404 is
preserved instead of being rewritten to 406.

The plugin now passes event.context.matchedRoute to detect
whether a Nitro route handler processed the request.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
2chanhaeng added a commit to 2chanhaeng/fedify that referenced this pull request Apr 14, 2026
resolveAlias() only expands aliases like ~ and @, leaving plain
relative paths (./server/federation) unchanged.  These paths
then resolve against .nuxt/ at runtime instead of the project
root, causing ERR_MODULE_NOT_FOUND.

Add resolveModulePath() that wraps resolveAlias and falls back
to path.resolve() against nuxt.options.rootDir for non-absolute
results.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
2chanhaeng added a commit to 2chanhaeng/fedify that referenced this pull request Apr 14, 2026
When contextDataFactoryModule is configured but exports neither
a default function nor a named contextDataFactory, the resolver
previously set contextDataFactory to undefined silently.  This
made misconfiguration hard to detect.

Now it throws a descriptive TypeError when both exports are
missing, matching the existing behavior for non-function exports.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
2chanhaeng added a commit to 2chanhaeng/fedify that referenced this pull request Apr 14, 2026
Add plugin-level tests for the Nuxt beforeResponse hook. The
new coverage verifies deferred 404 responses are rewritten to
406, ordinary 404 responses are left untouched when no
deferred flag is present, and shared-route 404 responses
remain unchanged when Nuxt matched the route.

fedify-dev#674

Assisted-by: GitHub Copilot:GPT-5.4
@2chanhaeng 2chanhaeng requested a review from dahlia April 14, 2026 20:16
@2chanhaeng
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

✅ Actions performed

Review triggered.

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.

@2chanhaeng
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Copy link
Copy Markdown
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

Just one more thing: shouldn't we update the table in the README.md in the root?

@2chanhaeng
Copy link
Copy Markdown
Contributor Author

Just one more thing: shouldn't we update the table in the README.md in the root?

Already did!

- Use @fedify/fixture instead of node:test in mod.test.ts
- Type event parameter as H3Event instead of unknown in middleware.ts

Co-Authored-By: Claude (claude-opus-4-20250514)
Move NOT_ACCEPTABLE_BODY and DEFERRED_NOT_ACCEPTABLE_CONTEXT_KEY into
a shared lib.ts to avoid string duplication across logic.ts and
plugin.ts.

Co-Authored-By: Claude (claude-opus-4-20250514)
- Close unclosed bash code fence in SKILL.md
- Fix "can not" to "cannot" in SKILL.md
- Use asterisk-wrapped file paths in README.md and integration.md

Co-Authored-By: Claude (claude-opus-4-20250514)
 - Use en dash instead of hyphen in example README template
   title ("Fedify–프레임워크")
 - Wrap HTTP status codes in backticks and use official reason
   phrases in SKILL.md headings ("404 Not Found",
   "406 Not Acceptable")
 - Capitalize "Acceptable" in CHANGES.md to match the official
   HTTP status phrase

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
The test file imports from @fedify/fixture but it was missing
from devDependencies, which would cause ERR_MODULE_NOT_FOUND
in a clean install when running Node.js tests.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
Add failing tests that reproduce four bugs identified in PR
review comments:

 - logic.test.ts: handler-returned 406 is misclassified as
   "not-acceptable" instead of "handled" (review fedify-dev#5)
 - logic.test.ts: framework's intentional 404 on shared routes
   is rewritten to 406 by resolveDeferredNotAcceptable (review fedify-dev#6)
 - module.test.ts: resolveAlias does not resolve plain relative
   paths to absolute, breaking .nuxt/ imports (review fedify-dev#7)
 - module.test.ts: missing default/contextDataFactory exports
   silently return undefined instead of throwing (review fedify-dev#9)

All four tests fail against the current implementation and will
pass once the corresponding bugs are fixed.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6

Add regression tests for PR review issues

Add regression tests for PR review issues
Replace the status-code-based check (response.status === 406) with
an identity comparison against the synthetic response created by
the onNotAcceptable callback.  This prevents genuine handler-returned
406 responses from being misclassified as "not-acceptable".

The fix mirrors the existing pattern used for not-found detection,
where DUMMY_NOT_FOUND_RESPONSE is compared by reference.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
Add a routeHandled parameter to resolveDeferredNotAcceptable so
that it can distinguish a framework's intentional 404 (e.g., a
matched page returning "user not found") from a genuine route
miss.  When routeHandled is true, the framework's 404 is
preserved instead of being rewritten to 406.

The plugin now passes event.context.matchedRoute to detect
whether a Nitro route handler processed the request.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
resolveAlias() only expands aliases like ~ and @, leaving plain
relative paths (./server/federation) unchanged.  These paths
then resolve against .nuxt/ at runtime instead of the project
root, causing ERR_MODULE_NOT_FOUND.

Add resolveModulePath() that wraps resolveAlias and falls back
to path.resolve() against nuxt.options.rootDir for non-absolute
results.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
When contextDataFactoryModule is configured but exports neither
a default function nor a named contextDataFactory, the resolver
previously set contextDataFactory to undefined silently.  This
made misconfiguration hard to detect.

Now it throws a descriptive TypeError when both exports are
missing, matching the existing behavior for non-function exports.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
Add plugin-level tests for the Nuxt beforeResponse hook. The
new coverage verifies deferred 404 responses are rewritten to
406, ordinary 404 responses are left untouched when no
deferred flag is present, and shared-route 404 responses
remain unchanged when Nuxt matched the route.

fedify-dev#674

Assisted-by: GitHub Copilot:GPT-5.4
When resolveAlias() passes through a bare package specifier like
"@acme/federation" unchanged, the previous code resolved it
against rootDir, producing an invalid filesystem path such as
"/app/@acme/federation".

Now only explicit relative paths (./ or ../) are resolved against
rootDir.  Bare specifiers are returned as-is so the bundler can
resolve them from node_modules.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
Add a TContextData type parameter (defaulting to unknown) so that
typed context data produced by ContextDataFactory flows through
the fetcher signature end-to-end instead of being erased to
unknown at the helper boundary.

fedify-dev#674

Assisted-by: GitHub Copilot:claude-opus-4.6
@dahlia dahlia merged commit 4c2bace into fedify-dev:main Apr 15, 2026
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/build Build system and packaging component/federation Federation object related component/integration Web framework integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nuxt integration

2 participants