From d1e1b7689d3b6ffde14b23da5f53bda804cdf9ba Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Wed, 29 Jul 2026 01:41:43 -0500 Subject: [PATCH] Added the promisee to verbose output for reports promises A comment on a reports promise showed up in verbose output but its promisee did not, because the promise never went through cfPS() the way other promise types do. cfPS() logs the promise context, which is the only place the promisee is printed. Ticket: CFE-4228 Changelog: Title Co-Authored-By: Claude Opus 5 (1M context) --- libpromises/verify_reports.c | 4 ++- .../reports_promisee_emitted_in_verbose.cf | 26 +++++++++++++++++++ ...reports_promisee_emitted_in_verbose.cf.sub | 5 ++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tests/acceptance/14_reports/reports_promisee_emitted_in_verbose.cf create mode 100644 tests/acceptance/14_reports/reports_promisee_emitted_in_verbose.cf.sub diff --git a/libpromises/verify_reports.c b/libpromises/verify_reports.c index e9fe09cf88..e0d8c626d8 100644 --- a/libpromises/verify_reports.c +++ b/libpromises/verify_reports.c @@ -129,7 +129,9 @@ PromiseResult VerifyReportPromise(EvalContext *ctx, const Promise *pp) YieldCurrentLock(thislock); - ClassAuditLog(ctx, pp, &a, result); + /* cfPS calls ClassAuditLog itself and also logs the promise context, + * which is where the promisee comes from */ + cfPS(ctx, LOG_LEVEL_VERBOSE, result, pp, &a, "Reports promise '%s' processed", pp->promiser); return result; } diff --git a/tests/acceptance/14_reports/reports_promisee_emitted_in_verbose.cf b/tests/acceptance/14_reports/reports_promisee_emitted_in_verbose.cf new file mode 100644 index 0000000000..e04a881554 --- /dev/null +++ b/tests/acceptance/14_reports/reports_promisee_emitted_in_verbose.cf @@ -0,0 +1,26 @@ +body common control +{ + inputs => { "../default.sub.cf" }; + bundlesequence => { default("$(this.promise_filename)") }; +} + +####################################################### +bundle agent test +{ + meta: + "description" -> { "CFE-4228" } + string => "Test that promisees on reports are emitted in verbose output."; +} + +####################################################### +bundle agent check +{ + methods: + "" + usebundle => dcs_passif_output( + ".*promisee 'the_promisee_of_a_report'.*", + "", + "$(sys.cf_agent) -Kvf $(this.promise_filename).sub", + $(this.promise_filename) + ); +} diff --git a/tests/acceptance/14_reports/reports_promisee_emitted_in_verbose.cf.sub b/tests/acceptance/14_reports/reports_promisee_emitted_in_verbose.cf.sub new file mode 100644 index 0000000000..5e050f7459 --- /dev/null +++ b/tests/acceptance/14_reports/reports_promisee_emitted_in_verbose.cf.sub @@ -0,0 +1,5 @@ +bundle agent main +{ + reports: + "This is an example report" -> "the_promisee_of_a_report"; +}