This is discussed in Discord ptrace AppArmor denials - #8 by jdstrand. While we can suppress the logging with an explicit deny rule, we cannot later undo that rule. What is really needed is an apparmor ‘quiet’ rule that allows suppressing the log without explicitly denying it, and then we need to design in snapd what log suppression should like like.
That said, we’ve recently devised a method of suppressing ptrace under certain conditions (interfaces/apparmor: conditionally add explicit deny rules for ptrace by jdstrand · Pull Request #5980 · canonical/snapd · GitHub). It looks like deny capability ptrace
could be added to ptraceTraceDenySnippet. I’ll consider this in the next batch of policy updates.