lxbme opened a new pull request, #3437:
URL: https://github.com/apache/apisix-dashboard/pull/3437

   **Why submit this pull request?**
   
   - [x] Bugfix
   - [ ] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   **What changes will this PR take into?**
   
   Part of #3417 (Data-integrity section): "Stream routes: create path bypasses 
`pipeProduce` (only resource whose create/edit run different cleaning 
pipelines), and the reused plugins section offers a `plugin_config_id` input 
the resource schema doesn't have — typed values silently vanish."
   
   **Phantom `plugin_config_id` input (the user-visible bug).** The 
stream-route form reuses the HTTP-route plugins section, which renders a Plugin 
Config ID input — but the stream_routes resource has no such field. Verified 
against a live gateway: the Admin API rejects `plugin_config_id` on 
stream_routes with 400; in practice the dashboard's zod resolver strips the 
typed value before the request is built, so whatever the user enters there 
silently vanishes on a "successful" save and never takes effect. 
`FormSectionPlugins` gains a `showConfigId` flag (default `true`, HTTP routes 
unchanged) and the stream-route form turns it off. The regression spec asserts 
the input is absent on the stream-route add and detail pages and still present 
on the HTTP-route form.
   
   **Pipeline asymmetry (the hardening).** Stream routes were the only resource 
whose create and edit paths ran different cleaning pipelines:
   
   - create used a bare `pipe` **without** `pipeProduce` — no `__`-flag 
removal, no empty-value cleaning, no empty-plugin restore. The only thing 
keeping form-internal `__` flags out of the request body was the zod resolver's 
unknown-key stripping — and the Admin API rejects unknown root keys with 400 
(verified live), so that protection was load-bearing by accident;
   - edit borrowed the **HTTP-route** producer (`produceRoute`), whose `vars` 
JSON.parse stage is dead code for stream routes.
   
   `produceStreamRoute` now wraps `pipeProduce` (gaining the same explicit 
defenses every other resource has) and **both** paths use it. Unit tests pin 
the new behavior (`__` flags stripped at root and nested, empty strings 
cleaned) and the preserved behavior (name/status deletes, empty-protocol 
cleanup, inline-upstream removal when a reference id is present, empty-config 
plugins restored).
   
   One more live-verified correction, disclosed for reviewers: the Admin API 
nowadays *accepts* `name` on stream routes, so the old "Stream Routes do not 
support name" comment was outdated — the deletes are kept as defense for values 
arriving through reused generic components, with the comment corrected.
   
   **Tests** (red on the unfixed build at the intended assertions, green after):
   
   - Unit `FormPartStreamRoute/util.test.ts`: 5 cases (2 red pre-fix: `__`-flag 
stripping, empty-string cleaning; 3 behavior-preservation guards).
   - E2E regression `stream-routes.no-phantom-plugin-config-id.spec.ts`: no 
Plugin Config ID on stream-route add/detail (plugins section itself still 
present), input still offered on the HTTP-route form.
   
   Blast radius: full local e2e suite — **175 passed**, all stream_routes 
suites green; the failures are documented environment items unrelated to this 
change (two Monaco read-back races that reproduce at the same rate on a 
pristine master build, one late-serial-run pagination load flake green on 
isolated rerun, and `stream_routes.show-disabled-error`, which cannot run 
outside the repo's own compose project). Unit tests 38/38, lint and build clean.
   
   **Related issues**
   
   Part of #3417 (please do not auto-close the tracking issue)
   
   **Checklist:**
   
   - [x] Did you explain what problem does this PR solve? Or what new features 
have been added?
   - [x] Have you added corresponding test cases?
   - [ ] Have you modified the corresponding document? (no user-facing document 
covers the stream-route form)
   - [x] Is this PR backward compatible? If it is not backward compatible, 
please discuss on the mailing list first


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to