ruanweihong-aaa opened a new pull request, #14085: URL: https://github.com/apache/apisix/pull/14085
### Description Environment references in commented-out Standalone YAML configuration can cause startup or reload to fail when the variable is unset. This builds on #13686 by @asdf2014, retaining and extending the original standalone test. It addresses the three review comments on that PR: - Preserve references in hash-prefixed block-scalar content. - Preserve references spanning physical lines. - Test a file change while APISIX is running, rather than initial loading alone. Resolve references in source order using the existing substitution rules. When the expanded prefix contains a hash, use the existing libyaml scanner to distinguish comments from data. Incomplete syntax is left for final YAML parsing, preserving dynamic YAML fragments and mapping/sequence expansion. Keep the scanner input alive throughout iteration. This implementation has no scan cache or batch masking layer. The standalone test updates the configuration of a running instance, polls the changed response, and confirms the master PID is unchanged. The update covers both block-scalar content and a cross-line reference. #### Which issue(s) this PR fixes: Fixes #13685. Follow-up to #13686; this does not modify or close the original PR. ### Draft: unresolved performance limitation Repeated prefix scanning can be quadratic for configurations containing hashes and many environment references. In the test environment, 1,000 simple references took about 1.016 seconds; a roughly 100 KB configuration with 1,000 routes and one reference per route took about 11.073 seconds. Parsed results were verified. Even a leading comment can trigger repeated scanning. This PR remains a draft pending resolution or review of this performance tradeoff. Concurrent request latency during reload has not been measured. ### Validation The exact committed changes match the locally verified patch: - Full `t/cli/test_standalone.sh`: passed. - Existing `t/config-center-yaml/route.t`: 26/26 assertions passed; Test::Nginx emitted shutdown timeout/forced-cleanup warnings. - Changed-file luacheck and lj-releng, test style, patch application, and diff checks: passed. - Separate local validation scripts: 71 parsing cases plus a forced-GC scanner test, and 16 actual startup/update cases passed. These scripts are not included in this two-file patch. They cover dynamic block headers, directive arguments, closing quotes, rejected updates, and recovery. - Repository-wide lint reports the same existing ERROR lines on pinned master and the candidate. Full-source tests used master `cea64fbf40c6244ebbd99b139e6896ee72aea295` plus this patch with the APISIX 3.19.0 runtime/dependencies (OpenResty 1.29.2.4, lyaml 6.2.8-1). Dependencies were not rebuilt for HEAD and the complete CI suite was not run. Environment values remain raw YAML fragments; this does not add automatic escaping or change SSL interpolation. ### Checklist - [x] I have explained the need for this PR and the problem it solves - [x] I have explained the changes or the new features added to this PR - [x] I have added tests corresponding to this change - [ ] I have updated the documentation to reflect this change - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first) Documentation is unchanged to keep this draft focused on the original review comments. Functional compatibility cases pass, but the compatibility checkbox remains open because of the performance regression described above. -- 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]
