Skip to content

chore: update accepts to v2 - #2016

Open
shuaiyafei wants to merge 1 commit into
koajs:masterfrom
shuaiyafei:chore/accepts-v2
Open

shuaiyafei wants to merge 1 commit into
koajs:masterfrom
shuaiyafei:chore/accepts-v2

Conversation

@shuaiyafei

@shuaiyafei shuaiyafei commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Koa directly uses mime-types v3 but still pulls a separate v2 tree through accepts v1. Upgrade accepts to v2 and refresh the lockfile to share the existing MIME dependency and use negotiator v1.

References #1903.

Validation: npm ci --ignore-scripts, npm run build, npm run lint, and npm test (466 passed). A focused compatibility check also confirmed that constructor identity is not stable across two separate copies of accepts@1, while the sampled public negotiation results match between v1 and v2.

@sourcery-ai

sourcery-ai Bot commented Oct 16, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the project to accepts v2, with a regenerated lockfile that consolidates MIME type resolution on the direct v3 dependency and upgrades negotiator; validation was limited to whitespace checks, with tests not run.

File-Level Changes

Change Details Files
Upgrade the direct accepts dependency to v2 and refresh the resolved dependency graph.
  • Change the declared accepts range from ^1.3.8 to ^2.0.0.
  • Regenerate the lockfile to use negotiator v1 and the existing direct mime-types v3 dependency.
  • Remove the duplicate transitive mime-types v2 dependency tree.
package.json
package-lock.json

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4d83184c-e07c-4e41-99ab-0d3926bd3676
📥 Commits

Reviewing files that changed from the base of the PR and between 2fecd02 and cac3f92.

⛔ Files ignored due to path filters: 1
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing: 1
  • package.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The package manifest changes the declared accepts dependency range from ^1.3.8 to ^2.0.0.

Suggested reviewers: jonathanong

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to cac3f

The upgrade preserves the request-negotiation APIs Koa uses and its supported runtime. Some extensions may match updated MIME types, consistent with the documented contract; no actionable merge-blocking risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: upgrading the accepts dependency to version 2.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.90%. Comparing base (2fecd02) to head (cac3f92).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2016   +/-   ##
=======================================
  Coverage   99.90%   99.90%           
=======================================
  Files           9        9           
  Lines        2144     2144           
=======================================
  Hits         2142     2142           
  Misses          2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sourcery-ai sourcery-ai 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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="package.json" line_range="39" />
<code_context>
       "license": "MIT",
       "dependencies": {
-        "accepts": "^1.3.8",
+        "accepts": "^2.0.0",
         "content-disposition": "~1.0.1",
         "content-type": "^1.0.5",
</code_context>
<issue_to_address>
**Accept instance checks fail**

When a consumer installs `accepts@1` separately and uses its constructor to check Koa's `ctx.accept`, a consumer with its own `accepts@1` import gets `false` from `ctx.accept instanceof Accept`, because Koa now creates `ctx.accept` with the `accepts@2` constructor; constructor-based integrations reject the exposed object.

Avoid making constructor identity part of the exposed contract, or document that consumers must use the same `accepts` major version as Koa.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: package.json:39


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread package.json Resolved
@yowainwright

Copy link
Copy Markdown
Member

@shuaiyafei this is the right approach, but we should hold this off for v4, which will be started very soon, hopefully.

Thank you so much!

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