Skip to content

Conversation

@yixianOu
Copy link

@yixianOu yixianOu commented Dec 6, 2025

Description

This PR unifies the schema definition in the ai-proxy-multi plugin. Previously, the ai_proxy_multi_schema used logging_schema as the key name, which was inconsistent with the ai-proxy plugin (which uses logging). This change ensures the logging configuration key is consistent across AI proxy plugins.

Checklist

  • I have unified the schema key.

Related Issue

Fixes #12671

Signed-off-by: Orician 2018783812@qq.com

Signed-off-by: Orician <2018783812@qq.com>
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Dec 6, 2025
Copy link
Contributor

@Baoyuantop Baoyuantop left a comment

Choose a reason for hiding this comment

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

We need to add additional tests to check the schema configuration in order to avoid encountering similar issues again.

@yixianOu
Copy link
Author

yixianOu commented Dec 8, 2025

Test Summary Report
-------------------
t/plugin/mcp-bridge.t        (Wstat: 0 Tests: 10 Failed: 3)
  Failed tests:  7-9
  Parse errors: No plan found in TAP output
Files=5, Tests=182, 56 wallclock secs ( 0.04 usr  0.01 sys +  4.80 cusr  2.30 csys =  7.15 CPU)
Result: FAIL

I don't know why the mcp-bridge test failed, it should have nothing to do with my modification.

@Baoyuantop
Copy link
Contributor

Test Summary Report
-------------------
t/plugin/mcp-bridge.t        (Wstat: 0 Tests: 10 Failed: 3)
  Failed tests:  7-9
  Parse errors: No plan found in TAP output
Files=5, Tests=182, 56 wallclock secs ( 0.04 usr  0.01 sys +  4.80 cusr  2.30 csys =  7.15 CPU)
Result: FAIL

I don't know why the mcp-bridge test failed, it should have nothing to do with my modification.

Ignoring this test for now, the same issue exists in other PRs.

@Baoyuantop Baoyuantop added the wait for update wait for the author's response in this issue/PR label Dec 10, 2025
@Baoyuantop
Copy link
Contributor

We need to add additional tests to check the schema configuration in order to avoid encountering similar issues again.

Hi @yixianOu, could you add a simple test case?

@yixianOu
Copy link
Author

We need to add additional tests to check the schema configuration in order to avoid encountering similar issues again.

Hi @yixianOu, could you add a simple test case?

ok

…expect unknown logging_schema to be ignored (ok:ok). Also remove error.log requirement in schema test to match validator behavior.
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Dec 13, 2025
@yixianOu
Copy link
Author

add additional tests to check the schema configuration

-- APISIX schema allows additional properties unless explicitly disallowed.
-- So unknown field 'logging_schema' should be ignored and still pass.
ngx.say((ok1 and "ok" or ("bad:" .. (err1 or ""))), ":", (ok2 and "ok" or "invalid"))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is too complicated. Please use if else statements for easier code understanding.


__DATA__
=== TEST 0: schema accepts 'logging' and ignores unknown 'logging_schema'
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add it to the end of the existing test.

@Baoyuantop Baoyuantop removed wait for update wait for the author's response in this issue/PR user responded labels Dec 15, 2025
@yixianOu
Copy link
Author

yixianOu commented Dec 15, 2025

https://github.com/apache/apisix/actions/runs/20191178102/job/58038560408?pr=12795
CI Test Failure Analysis :

  • Failed test: TEST 15 "add plugin with algorithm nanoid" in t/plugin/request-id.t
  • Failure cause: Duplicate IDs occurred when generating 180 nanoids concurrently, leading to test output "ids not unique" instead of the expected "true"
  • Connection to my code changes:
    • ❌ My changes didn’t affect this test. I only modified:
      • apisix/plugins/ai-proxy/schema.lua (renamed field: logging_schema → logging)
      • t/plugin/ai-proxy*.t (AI-proxy test files)
      • .gitignore
    • ✅ Neither request-id.t nor apisix/plugins/request-id.lua was modified
  • Possible root cause:
    • This is an intermittent test failure, usually caused by:
      • Duplicate randomness in the nanoid library under specific concurrent conditions
      • Timing issues due to CI environment resource limits
      • Behavior of LuaJIT’s random number generator at high concurrency
    • The issue isn’t caused by my changes but by pre-existing CI instability

  operators with if-else statements

  - Replace complicated nested ternary operators in TEST 17 with
  clear if-else blocks
  - Improve code readability and maintainability in
  t/plugin/ai-proxy.t
  - Reindex test file for proper formatting
  - All linting checks pass

Signed-off-by: Orician <2018783812@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ai-proxy-multi-schema logging schema error

2 participants