Skip to content

Test the 406 fallback in @fedify/express - #1000

Merged
dahlia merged 1 commit into
fedify-dev:mainfrom
co2plant:issue-858-express-not-acceptable-test
Aug 18, 2026
Merged

Test the 406 fallback in @fedify/express#1000
dahlia merged 1 commit into
fedify-dev:mainfrom
co2plant:issue-858-express-not-acceptable-test

Conversation

@co2plant

Copy link
Copy Markdown
Contributor

Resolves #858.

Summary

@fedify/express uses onNotAcceptable to let Express try HTML routes before falling back to a 406, which is what keeps an actor and its HTML profile page shareable on one URL. The fallback branch—no route matched, so the middleware sends the 406 itself—had no test.

This adds a test in packages/express/src/index.test.ts that drives integrateFederation() with a mock federation calling onNotAcceptable(), and asserts the response status is 406.

Tests

  • mise run test:deno packages/express/src/index.test.ts
  • mise run check-each express

AI disclosure

Assisted-by: Claude Code:claude-opus 4.8

This change was written with assistance from Claude Code (claude-opus-4-8), reviewed and verified by me.

integrateFederation() calls onNotAcceptable to let Express try HTML
routes before falling back to 406, but that fallback had no test. Add
a test that asserts the middleware responds with 406 when
onNotAcceptable is used and no Express route matches the request.

Changelog: none
Assisted-by: Claude Code:claude-opus-4-8
@netlify

netlify Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploy Preview for fedify-json-schema canceled.

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

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: caa80aa0-8038-44a3-b4f3-18c0f78b69a3

📥 Commits

Reviewing files that changed from the base of the PR and between bf6d525 and f27d436.

📒 Files selected for processing (1)
  • packages/express/src/index.test.ts

Included review availability: Your plan includes up to 4 reviews per rolling hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Express not-acceptable handling

Layer / File(s) Summary
406 fallback regression test
packages/express/src/index.test.ts
Adds an integration test for the onNotAcceptable callback. The test verifies a 406 response when no Express route handles the request.

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

Merge Risk: ⚪ Minimal · up to f27d4

This change adds coverage for the Express 406 fallback without changing production behavior. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: 2chanhaeng, dahlia

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the 406 fallback test in @fedify/express.
Description check ✅ Passed The description accurately explains the regression test, its purpose, and the related validation commands.
Linked Issues check ✅ Passed The test covers onNotAcceptable with no matching Express route and verifies the 406 fallback required by issue #858.
Out of Scope Changes check ✅ Passed The changes add only the regression test described in issue #858 and the pull request objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.
see 1 file 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.

@dahlia dahlia added the integration/express Express.js integration (@fedify/express) label Aug 18, 2026
@dahlia dahlia added this to the Fedify 2.4 milestone Aug 18, 2026

@dahlia dahlia 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.

Thanks for your contribution!

@dahlia
dahlia merged commit fe6babc into fedify-dev:main Aug 18, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration/express Express.js integration (@fedify/express)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test not-acceptable handling in @fedify/express

2 participants