codeant-ai-for-open-source[bot] commented on code in PR #41550:
URL: https://github.com/apache/superset/pull/41550#discussion_r3704263244
##########
superset/commands/deletion_retention/audit.py:
##########
@@ -135,6 +136,11 @@ def finalize(record_id: UUID | None, status: str,
**details: Any) -> None:
removed_dashboard_slices = details.get("removed_dashboard_slices")
if removed_dashboard_slices is not None:
values["removed_dashboard_slices"] = removed_dashboard_slices
+ elif status in (STATUS_FAILED, STATUS_BLOCKED):
+ # The write-ahead row recorded the count the purge INTENDED to
+ # remove. On a failed or blocked attempt the cleanup rolled back,
+ # so leaving it would assert removals that never happened.
+ values["removed_dashboard_slices"] = 0
Review Comment:
**Suggestion:** The `target_absent` reconciliation path leaves the
write-ahead `removed_dashboard_slices` count unchanged, even though this status
explicitly means the audit cannot establish that this purge attempt removed
anything; a concurrent purge or unrelated deletion may have removed the target
instead. This causes the audit record to report an intended removal count as if
it were attributable to the reconciled attempt. Reset the count for
`STATUS_TARGET_ABSENT` as well, or otherwise represent it as unknown. [logic
error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Purge audit records retain unattributable slice-removal counts.
- ⚠️ Compliance reporting can misstate effects of crashed purges.
- ⚠️ Retention reconciliation produces misleading immutable audit history.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=261f5c032f544df09ceffbe1e4cc77fc&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=261f5c032f544df09ceffbe1e4cc77fc&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/commands/deletion_retention/audit.py
**Line:** 139:143
**Comment:**
*Logic Error: The `target_absent` reconciliation path leaves the
write-ahead `removed_dashboard_slices` count unchanged, even though this status
explicitly means the audit cannot establish that this purge attempt removed
anything; a concurrent purge or unrelated deletion may have removed the target
instead. This causes the audit record to report an intended removal count as if
it were attributable to the reconciled attempt. Reset the count for
`STATUS_TARGET_ABSENT` as well, or otherwise represent it as unknown.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41550&comment_hash=002b0e9e6e7424dfc93b6f522e45a529ebf42d52b221d657d0e2779f702b4288&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41550&comment_hash=002b0e9e6e7424dfc93b6f522e45a529ebf42d52b221d657d0e2779f702b4288&reaction=dislike'>👎</a>
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]