Skip to content

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

Open
Bananamilk452 wants to merge 7 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 7 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 c933943
🔍 Latest deploy log https://app.netlify.com/projects/fedify-json-schema/deploys/6a719bfe020188000862982d

@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 test scripts. The shared test-each task now selects checks by package manifest, and Deno excludes the Next.js package.

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, deno.json, mise.toml
Adds Node.js and Bun test scripts. Excludes the Next.js package from Deno tests. Gates shared test commands by deno.json and package.json.

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

Possibly related issues

Possibly related PRs

  • fedify-dev/fedify#977 — Modifies the same test file and adds related federation request detection tests.

Suggested labels: component/integration

Suggested reviewers: dahlia

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the test-runner fix and the addition of fedify/next tests.
Description check ✅ Passed The description accurately covers the new 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
🧪 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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.
see 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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 thread packages/next/src/index.test.ts

@2chanhaeng 2chanhaeng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great work! Please check the point that I commented on.

Comment thread mise.toml Outdated

@2chanhaeng 2chanhaeng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add packages/next to test.exclude in root deno.json

Comment thread packages/next/package.json Outdated

@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/package.json`:
- Line 62: Update the test scripts in packages/next/package.json by adding
pretest and pretest:bun hooks that run pnpm build, matching the packages/amqp
pattern so dist/ is built before pnpm test or the Bun test command executes.
🪄 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: 907b44d1-6698-4b78-8c5d-8e8ed8bdf9cc

📥 Commits

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

📒 Files selected for processing (3)
  • deno.json
  • mise.toml
  • packages/next/package.json

"prepack": "pnpm build",
"prepublish": "pnpm build"
"prepublish": "pnpm build",
"test": "node --test dist/",

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 | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

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

python3 - <<'PY'
import json
from pathlib import Path

scripts = json.loads(
    Path("packages/next/package.json").read_text()
).get("scripts", {})

for name in ("prepublish", "pretest", "test", "pretest:bun", "test:bun"):
    print(f"{name}: {scripts.get(name)!r}")

if scripts.get("test") == "node --test dist/" and scripts.get("pretest") != "pnpm build":
    raise SystemExit("Node.js tests are not gated by a build")

if scripts.get("test:bun") and scripts.get("pretest:bun") != "pnpm build":
    raise SystemExit("Bun tests are not gated by a build")

Repository: fedify-dev/fedify

Length of output: 385


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== packages/next/package.json scripts =="
python3 - <<'PY'
import json
from pathlib import Path
p=Path("packages/next/package.json")
data=json.loads(p.read_text())
for k in sorted(data.get("scripts", {}).keys()):
    if k in ("pretest","test","pretest:bun","test:bun","prepublish"):
        print(f"{k}: {data['scripts'][k]}")
PY

echo
echo "== relevant mises =="
rg -n 'packages/next|test:"|test:bun|pnpm --filter|test b?un|pnpm test' mise.toml packages -g 'mise.toml' -g 'package.json' || true

echo
echo "== packages/amqp test/build scripts =="
python3 - <<'PY'
import json
from pathlib import Path
for name in ("packages/amqp/package.json","packages/fet/package.json",):
    p=Path(name)
    if not p.exists(): continue
    data=json.loads(p.read_text())
    print(name)
    for k in ("pretest","test","pretest:bun","test:bun"):
        print(f"  {k}: {data['scripts'].get(k)!r}")
PY

Repository: fedify-dev/fedify

Length of output: 7043


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== package manager / lifecycle settings =="
for f in package.json .npmrc pnpm-workspace.yaml .npm/global; do
  if [ -f "$f" ]; then
    echo "-- $f --"
    sed -n '1,220p' "$f"
  fi
done

echo
echo "== precise script lifecycle hooks in package.json =="
python3 - <<'PY'
import json
from pathlib import Path
p=Path("package.json")
data=json.loads(p.read_text())
print("packageManager:", data.get("packageManager"))
for k, v in data.get("scripts", {}).items():
    if k.startswith(("pre") or "pre") in k:
        print(f"{k}: {v}")
PY

Repository: fedify-dev/fedify

Length of output: 3798


Gate the dist-based tests with build hooks.

packages/next/package.json runs node --test dist/, but test has no pretest hook. mise.toml invokes pnpm test, so prepublish does not satisfy this contract. Use the same pattern as packages/amqp: add pretest and pretest:bun that run pnpm build before testing against dist/.

🤖 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/package.json` at line 62, Update the test scripts in
packages/next/package.json by adding pretest and pretest:bun hooks that run pnpm
build, matching the packages/amqp pattern so dist/ is built before pnpm test or
the Bun test command executes.

@Bananamilk452

Copy link
Copy Markdown
Contributor Author

I made a change! Please take an another look!

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