Skip to content

revert: drop configurable request JSON library#13449

Open
nic-6443 wants to merge 3 commits into
apache:masterfrom
nic-6443:codex/simdjson-decode-fallback
Open

revert: drop configurable request JSON library#13449
nic-6443 wants to merge 3 commits into
apache:masterfrom
nic-6443:codex/simdjson-decode-fallback

Conversation

@nic-6443
Copy link
Copy Markdown
Member

@nic-6443 nic-6443 commented May 28, 2026

Description

This PR reverts the previous configurable request JSON library change and keeps request body JSON handling on cjson only.

The previous switch to new JSON libraries was too aggressive. After more testing, the new libraries did not meet the stability bar we need for request-body parsing, so this PR removes the request_body_json_lib option, removes the simdjson/qjson dependencies and setup, and routes AI transport body encoding back through the existing core.json path.

Checklist

  • Tests updated
  • Documentation updated

Tests

  • prove -Itest-nginx/lib -I. -r t/core/config-default.t t/core/request.t

Copilot AI review requested due to automatic review settings May 28, 2026 11:28
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 28, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves robustness of JSON request-body decoding when apisix.request_body_json_lib is set to simdjson by retrying with cjson after simdjson decode failures, aiming to keep simdjson as the fast path while preserving previous cjson compatibility.

Changes:

  • Add a simdjson→cjson fallback path in apisix.core.request_json.decode() with a warning log on simdjson decode failures.
  • Update api7-lua-resty-simdjson dependency to 0.1.2-1.
  • Add/adjust tests and update ai-proxy documentation (EN/ZH) to reflect the fallback behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apisix/core/request_json.lua Adds simdjson decode wrapper that logs and falls back to cjson decoding on failure.
apisix-master-0.rockspec Bumps api7-lua-resty-simdjson version to include decoder cleanup after errors.
t/core/request.t Adds a regression test ensuring fallback to cjson occurs and warning is logged; renumbers subsequent tests.
docs/en/latest/plugins/ai-proxy.md Documents warning + retry-with-cjson behavior for simdjson mode.
docs/zh/latest/plugins/ai-proxy.md Same documentation update in Chinese.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apisix/core/request_json.lua Outdated
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 28, 2026
AlinsRan
AlinsRan previously approved these changes Jun 1, 2026
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jun 1, 2026
@nic-6443 nic-6443 changed the title fix: fallback to cjson after simdjson decode errors revert: drop configurable request JSON library Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants