fix(ai-proxy): correct logging schema key in ai-proxy-multi#12795
Conversation
Signed-off-by: Orician <[email protected]>
Baoyuantop
left a comment
There was a problem hiding this comment.
We need to add additional tests to check the schema configuration in order to avoid encountering similar issues again.
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: FAILI 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. |
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.
|
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")) |
There was a problem hiding this comment.
This is too complicated. Please use if else statements for easier code understanding.
|
|
||
| __DATA__ | ||
|
|
||
| === TEST 0: schema accepts 'logging' and ignores unknown 'logging_schema' |
There was a problem hiding this comment.
We should add it to the end of the existing test.
|
https://github.com/apache/apisix/actions/runs/20191178102/job/58038560408?pr=12795
|
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 <[email protected]>
| local ok2, err2 = plugin.check_schema({ | ||
| provider = "openai", | ||
| auth = { header = { apikey = "token" } }, | ||
| options = { model = "gpt-4" }, | ||
| logging_schema = { summaries = true }, | ||
| }) |
There was a problem hiding this comment.
Shouldn't this be checking for failures? Why is the test result "ok"?
There was a problem hiding this comment.
- Why the test was originally written this way: It verified that the valid
loggingfield passes and that old/unknown fields (e.g.,logging_schema) don’t block schema validation, sinceadditionalPropertiesis allowed. - Why I changed it: We only care that
loggingpasses. Removing the extra check reduces noise and decouples the test from the “allow unknown fields” behavior, keeping the test focused and stable.
https://github.com/apache/apisix/actions/runs/20239133460/job/58149992555?pr=12795
https://github.com/apache/apisix/actions/runs/20239133460/job/58149992556?pr=12795
The failed CI test should have nothing to do with the code I modified
|
confirmed again, this is a bug, current way is right |
Description
This PR unifies the schema definition in the
ai-proxy-multiplugin. Previously, theai_proxy_multi_schemausedlogging_schemaas the key name, which was inconsistent with theai-proxyplugin (which useslogging). This change ensures the logging configuration key is consistent across AI proxy plugins.Checklist
Related Issue
Fixes #12671
Signed-off-by: Orician [email protected]