Copilot commented on code in PR #13842:
URL: https://github.com/apache/trafficserver/pull/13842#discussion_r4292554130
##########
src/traffic_ctl/CtrlCommands.cc:
##########
@@ -351,6 +366,8 @@ ConfigCommand::config_status()
for (const auto &task : resp.tasks) {
_printer->as<ConfigReloadPrinter>()->print_reload_report(task, true);
}
+ // The server lists the newest reload last. Older ones shown with --count
are history and are not graded.
+ grade_reload(resp.tasks.back());
Review Comment:
`resp.tasks.back()` is undefined behavior if `resp.tasks` is empty.
`track_config_reload_progress()` already treats an empty task list as an error
case, so `config_status()` should similarly guard this path (e.g., only grade
when `!resp.tasks.empty()`, otherwise set the appropriate exit code / show the
existing error output for 'no reload found').
##########
src/traffic_ctl/TrafficCtlStatus.h:
##########
@@ -27,6 +27,7 @@ limitations under the License.
#include <string>
#include <string_view>
+#include "jsonrpc/ctrl_yaml_codecs.h"
Review Comment:
Including `jsonrpc/ctrl_yaml_codecs.h` from `TrafficCtlStatus.h` tightly
couples this widely-included header to YAML-cpp and decode logic, which can
increase build times and propagate heavier dependencies across the binary.
`appExitCodeFromReload()` only needs the reload types/levels (e.g.,
`ConfigReloadResponse` / `DiagsLevel`), so prefer including the narrow
request/response types header and leaving YAML codec headers in the `.cc` files
that actually perform decoding.
--
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]