You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ez...@apache.org on 2026/10/19 22:03:19 UTC

(trafficserver) 15/30: Replace the vacuous SDK_Overridable_Configs assertion with an accurate note

This is an automated email from the ASF dual-hosted git repository.

ezelkow1 pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 09842e10aafdba6ef4d92cdef46ad8aaf85a0afc
Author: Evan Zelkowitz <e_...@apple.com>
AuthorDate: Fri Aug 28 19:14:15 2026 -0600

    Replace the vacuous SDK_Overridable_Configs assertion with an accurate note
    
    The array is declared with size TS_CONFIG_LAST_ENTRY, so asserting that
    .size() equals TS_CONFIG_LAST_ENTRY is a tautology; it cannot detect the
    missing-entry case its comment described, and too many initializers is
    already a hard error. The comment therefore misled rather than helped.
    
    Record what is actually true instead: three keys have no entry because
    Overridable_Txn_Vars maps them through the OutboundConnTrack::CONFIG_VAR_*
    constants rather than string literals, so indices past that point are
    shifted and the trailing slots are empty. Also note what a guard that
    works would require.
---
 src/traffic_server/InkAPITest.cc | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/traffic_server/InkAPITest.cc b/src/traffic_server/InkAPITest.cc
index 26a4fcce99..31d8861c4b 100644
--- a/src/traffic_server/InkAPITest.cc
+++ b/src/traffic_server/InkAPITest.cc
@@ -8775,12 +8775,18 @@ std::array<std::string_view, TS_CONFIG_LAST_ENTRY> SDK_Overridable_Configs = {
    "proxy.config.http.strict_chunk_parsing",
    "proxy.config.http.reject_head_with_content"}};
 
-// Nothing else keeps this array in step with TSOverridableConfigKey, and a
-// missing entry is not a build failure by itself: std::array simply
-// default-constructs the tail, and the empty name then trips
-// sdk_sanity_check_null_ptr inside TSHttpTxnConfigFind at run time.
-static_assert(SDK_Overridable_Configs.size() == TS_CONFIG_LAST_ENTRY,
-              "SDK_Overridable_Configs size must match TS_CONFIG_LAST_ENTRY");
+// NOTE: this array is short of TS_CONFIG_LAST_ENTRY and its order diverges from
+// TSOverridableConfigKey partway through. TS_CONFIG_HTTP_SERVER_MIN_KEEP_ALIVE_CONNS,
+// TS_CONFIG_HTTP_PER_SERVER_CONNECTION_MAX and TS_CONFIG_HTTP_PER_SERVER_CONNECTION_MATCH
+// have no entry, because Overridable_Txn_Vars maps them through the
+// OutboundConnTrack::CONFIG_VAR_* constants rather than string literals, so there was
+// no literal here to copy. Every index past that point is shifted and the trailing
+// slots are default-constructed, which limits what the loop below actually validates.
+//
+// A size assertion cannot catch this: the array is declared with size
+// TS_CONFIG_LAST_ENTRY, so comparing .size() against it is a tautology, and too many
+// initializers is already a hard error. A working guard needs either a constexpr array
+// with a non-empty check on the last element, or a deduced size compared to the enum.
 
 extern ClassAllocator<HttpSM> httpSMAllocator;