Copilot commented on code in PR #13456:
URL: https://github.com/apache/trafficserver/pull/13456#discussion_r3908563574


##########
src/traffic_ctl/ConvertConfigCommand.cc:
##########
@@ -65,6 +74,51 @@ ConvertConfigCommand::ConvertConfigCommand(ts::Arguments 
*args) : CtrlCommand(ar
   }
 }
 
+void
+ConvertConfigCommand::convert_cache()
+{
+  config::CacheConfigParser                 parser;
+  config::ConfigResult<config::CacheConfig> result = parser.parse(_input_file);
+
+  if (result.file_not_found || !result.ok()) {
+    std::string error_msg = "Failed to parse input file '" + _input_file + "'";
+    if (!result.errata.empty()) {
+      error_msg += ": ";
+      error_msg += std::string(result.errata.front().text());
+    }
+    _printer->write_output(error_msg);
+    return;
+  }
+
+  config::CacheConfigMarshaller marshaller;
+  std::string const             yaml_output = marshaller.to_yaml(result.value);
+
+  if (result.value.size() > 1) {
+    std::cerr << "Warning: cache.config can combine actions from overlapping 
rules, but cache.yaml uses only the first matching "
+                 "rule. Review the converted rule order and merge actions 
where needed.\n";
+  }

Review Comment:
   The semantic-change warning is emitted purely based on rule count, so it 
will also trigger when the input file is already YAML (e.g. converting 
cache.yaml -> cache.yaml). That warning specifically references 
cache.config/additive semantics and would be misleading for YAML inputs.



-- 
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