From 71ad32b1e95a1c1dfca8e6ca4a530b77afcc4974 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 27 Jan 2026 08:57:52 +0100 Subject: pkg/aflow/flow/patching: harden against empty generated patches Make codeeditor error on nop changes that don't actually change the code. Make patch testing error on empty patch. Perhaps we need a notion of "mandatory" tools that must be called successfully at least once... not sure yet. --- pkg/aflow/flow/patching/patching.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'pkg/aflow/flow/patching/patching.go') diff --git a/pkg/aflow/flow/patching/patching.go b/pkg/aflow/flow/patching/patching.go index a5aba0ccc..407dcee2a 100644 --- a/pkg/aflow/flow/patching/patching.go +++ b/pkg/aflow/flow/patching/patching.go @@ -131,14 +131,17 @@ The explanation of the root cause of the bug is: {{.BugExplanation}} {{if .TestError}} -Another developer tried to fix this bug, and come up with the following patch: -{{.PatchDiff}} - -and the following explanation: +Another developer tried to fix this bug, and come up with the following strategy for fixing: {{.PatchExplanation}} +{{/* A TestError without PatchDiff means the previous invocation did not generate any patch. */}} +{{if .PatchDiff}} +and the following patch: + +{{.PatchDiff}} + However, the patch testing failed with the following error: {{.TestError}} @@ -150,6 +153,9 @@ then create a new patch from scratch. Note: in both cases the source tree does not contain the patch yet (so if you want to create a new fixed patch, you need to recreate it in its entirety from scratch using the codeeditor tool). +{{else}} +If the strategy looks reasonable to you, proceed with patch generation. +{{end}} {{end}} ` -- cgit mrf-deployment