Skip to content

Fix fedify/next test-each failure, add fedify/next tests - #978

Open
Bananamilk452 wants to merge 6 commits into
fedify-dev:mainfrom
Bananamilk452:fedify-next-tests
Open

Fix fedify/next test-each failure, add fedify/next tests#978
Bananamilk452 wants to merge 6 commits into
fedify-dev:mainfrom
Bananamilk452:fedify-next-tests

Conversation

@Bananamilk452

@Bananamilk452 Bananamilk452 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Description

  • Added a comprehensive test suite in packages/next/src/index.test.ts to cover federation request detection, NodeInfo route handling, middleware delegation, and custom error handling logic.
  • Modified the mise.toml test runner to only run Deno tests if a deno.json file exists for the package, and to always run Node.js and Bun tests with clear output messages.

Github Copilot helped me making title of this PR, gpt-5.6-terra helped checking code quality and code creation.

@netlify

netlify Bot commented Aug 1, 2026

Copy link
Copy Markdown

Deploy Preview for fedify-json-schema canceled.

Name Link
🔨 Latest commit fe605d1
🔍 Latest deploy log https://app.netlify.com/projects/fedify-json-schema/deploys/6a6d9a0b5e690900081e5cdf

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request adds Next.js integration tests for request routing and custom handlers. It adds Node.js and Bun package test scripts. The shared test-each task now runs Deno checks only for packages that contain deno.json.

Changes

Next.js runtime tests

Layer / File(s) Summary
Request handling test coverage
packages/next/src/index.test.ts
Adds tests for ActivityPub request detection, NodeInfo routes, middleware delegation, and custom not-found and not-acceptable handlers.
Runtime-specific test execution
packages/next/package.json, mise.toml
Adds Node.js and Bun test scripts for packages/next. Updates test-each to run Deno checks only for packages with deno.json and to run Node.js and Bun tests for every package.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

  • fedify-dev/fedify#977 — Modifies the same Next.js test file and adds related federation request detection tests.
  • fedify-dev/fedify#936 — Updates mise.toml with overlapping conditional runtime test execution.

Suggested labels: runtime/node, runtime/bun, component/integration

Suggested reviewers: 2chanhaeng, dahlia

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the test-each fix and the added fedify/next tests.
Description check ✅ Passed The description accurately summarizes the added tests and the mise.toml test-runner changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@2chanhaeng

Copy link
Copy Markdown
Member

Next.js does not work well with Deno. Seriously. Instead of adding deno.json to @fedify/next to enable Deno support, could you modify it to exclude cases where deno.json is missing within the package path received during test-each/check-each tasks, or when the package path is not included in the workspace of the root deno.json?

@Bananamilk452
Bananamilk452 force-pushed the fedify-next-tests branch 2 times, most recently from 8b26d33 to b84059d Compare August 1, 2026 06:57
@Bananamilk452
Bananamilk452 marked this pull request as ready for review August 1, 2026 06:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@mise.toml`:
- Around line 308-312: Update the package loop condition around the Deno
commands to require both the package-local packages/($pkg)/deno.json and
membership in the root deno.json workspace; only then run mise run check-each
and deno task --filter. Keep packages lacking either configuration out of this
Deno task path.
🪄 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 Plus

Run ID: 25562d94-d015-474f-ad9a-4ec3cfec14cd

📥 Commits

Reviewing files that changed from the base of the PR and between 9b6f025 and b84059d.

⛔ Files ignored due to path filters (1)
  • deno.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • mise.toml
  • packages/next/package.json
  • packages/next/src/index.test.ts

Comment thread mise.toml
Comment on lines +308 to +312
if ($"packages/($pkg)/deno.json" | path exists) {
mise run check-each $pkg
print $"Running Deno tests for package: ($pkg)"
deno task --filter $"@fedify/($pkg)" test
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "Root Deno workspace:"
jq '.workspace' deno.json

echo
echo "Package-local Deno configurations:"
fd --type f '^deno\.json$' packages | sort

echo
echo "Current test-each gate:"
sed -n '301,315p' mise.toml

Repository: fedify-dev/fedify

Length of output: 2803


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "Root Deno config file:"
if [ -f deno.json ]; then
  jq '{specifiers: .imports, tasks: (.tasks // {} | keys | sort), tools: .tools // {}, workspace: .workspace}' deno.json
fi

echo
echo "Package-local Deno config relevant fields:"
python3 - <<'PY'
import json, pathlib
root = json.load(open("deno.json"))
workspace = root.get("workspace") or []
for p in sorted(pathlib.Path("packages").glob("*/deno.json")):
    name = "packages/" + str(p.parent.relative_to("packages"))
    data = json.load(open(p))
    print(f"{name}: has_tasks={bool(data.get('tasks'))}, has_specifiers={bool(data.get('imports'))}, in_root_workspace={name in workspace}")
PY

echo
echo "Relevant mise.toml lines:"
sed -n '296,318p' mise.toml

Repository: fedify-dev/fedify

Length of output: 7414


Check root Deno workspace membership before running Deno tasks.

packages/<pkg>/deno.json exists for every package, so the current condition runs check-each and deno task --filter even for packages not listed under deno.json.workspace. Gate these commands on the package being present in the root deno.json workspace as well as having a package-local Deno config.

🤖 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 `@mise.toml` around lines 308 - 312, Update the package loop condition around
the Deno commands to require both the package-local packages/($pkg)/deno.json
and membership in the root deno.json workspace; only then run mise run
check-each and deno task --filter. Keep packages lacking either configuration
out of this Deno task path.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/next/src/index.test.ts`:
- Around line 6-7: Replace the test import from `@fedify/fixture` with Node’s
built-in test harness by importing test from node:test in the package test file,
while preserving the existing assertions and test behavior.
🪄 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 Plus

Run ID: 2292e827-1479-4eeb-a805-b0a3e002baf4

📥 Commits

Reviewing files that changed from the base of the PR and between b84059d and fe605d1.

📒 Files selected for processing (3)
  • mise.toml
  • packages/next/package.json
  • packages/next/src/index.test.ts

Comment on lines +6 to +7
import { test } from "@fedify/fixture";
import { strict as assert } from "node:assert";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use node:test for this package test file.

This package now runs tests with node --test and bun test. Use Node’s built-in test harness instead of @fedify/fixture.

Based on learnings: use Node’s built-in node:test when adding package tests.

Proposed fix
-import { test } from "`@fedify/fixture`";
 import { strict as assert } from "node:assert";
+import { test } from "node:test";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { test } from "@fedify/fixture";
import { strict as assert } from "node:assert";
import { strict as assert } from "node:assert";
import { test } from "node:test";
🤖 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 `@packages/next/src/index.test.ts` around lines 6 - 7, Replace the test import
from `@fedify/fixture` with Node’s built-in test harness by importing test from
node:test in the package test file, while preserving the existing assertions and
test behavior.

Source: Learnings

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.

2 participants