aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/aflow/flow/patching/patching.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2026-01-27 08:57:52 +0100
committerDmitry Vyukov <dvyukov@google.com>2026-01-27 10:21:28 +0000
commit71ad32b1e95a1c1dfca8e6ca4a530b77afcc4974 (patch)
tree20e883dba3741a1a9016c74e2547abf2ecc849bf /pkg/aflow/flow/patching/patching.go
parent65e102377f285f4cdf3f95214e06843a2052e9ae (diff)
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.
Diffstat (limited to 'pkg/aflow/flow/patching/patching.go')
-rw-r--r--pkg/aflow/flow/patching/patching.go14
1 files changed, 10 insertions, 4 deletions
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}}
`