Skip to content

feat: add stable diffusion rediffuse artifact probe#257

Merged
DeliciousBuding merged 1 commit into
mainfrom
feat/rediffuse-sd-artifact-probe
May 17, 2026
Merged

feat: add stable diffusion rediffuse artifact probe#257
DeliciousBuding merged 1 commit into
mainfrom
feat/rediffuse-sd-artifact-probe

Conversation

@DeliciousBuding
Copy link
Copy Markdown
Owner

Summary

  • add a Stable Diffusion ReDiffuse artifact probe to the diffaudit CLI for collaborator-transferred result bundles
  • add a candidate-evidence note and sync the Research roadmap, AGENTS, queue, and black-box workspace docs
  • cover the new probe with focused tests and keep the result candidate-only rather than reopening GPU or download work

Verification

  • python -m unittest tests.test_rediffuse_sd_artifacts tests.test_rediffuse_assets tests.test_rediffuse_adapter tests.test_attack_registry
  • python -X utf8 scripts/check_public_surface.py
  • python -X utf8 scripts/check_markdown_links.py
  • python -X utf8 scripts/run_pr_checks.py

Copilot AI review requested due to automatic review settings May 17, 2026 04:46
@DeliciousBuding DeliciousBuding merged commit c000150 into main May 17, 2026
3 of 4 checks passed
@DeliciousBuding DeliciousBuding deleted the feat/rediffuse-sd-artifact-probe branch May 17, 2026 04:47
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements a new artifact probe for auditing collaborator-provided Stable Diffusion ReDiffuse results, adding the probe-rediffuse-sd-artifacts CLI command and associated logic in rediffuse_sd.py. The changes also include comprehensive updates to the research roadmap, workspace documentation, and unit tests. Review feedback highlights the need for improved error handling in the probe, specifically suggesting the inclusion of OSError in exception blocks and defensive checks for null values in the metrics JSON to prevent potential runtime crashes.

metrics_payload = _read_json(root / "metrics.json")
rows, labels, scores, predictions, correct = _read_result_csv(root / "result.csv")
fpr, tpr = _read_curve_csv(root / "roc_curve.csv")
except (ValueError, TypeError, KeyError, json.JSONDecodeError) as exc:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The try...except block should also catch OSError to handle cases where a required path exists but is inaccessible (e.g., due to permission issues) or is a directory instead of a file. Currently, path.read_text() or path.open() would raise an exception that crashes the CLI in these scenarios instead of returning a blocked status payload.

Suggested change
except (ValueError, TypeError, KeyError, json.JSONDecodeError) as exc:
except (ValueError, TypeError, KeyError, json.JSONDecodeError, OSError) as exc:

Comment on lines +147 to +151
reported_auc = float(metrics_payload.get("auc", float("nan")))
reported_asr = float(metrics_payload.get("asr", float("nan")))
reported_tpr_1pct = float(metrics_payload.get("tpr_at_fpr_1pct", float("nan")))
reported_member_count = int(metrics_payload.get("num_member", -1))
reported_nonmember_count = int(metrics_payload.get("num_nonmember", -1))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The extraction of reported metrics from metrics_payload is not defensive against null values in the JSON file. If a key like "auc" is present but its value is null, metrics_payload.get("auc") will return None, causing float(None) to raise a TypeError and crash the CLI. Since this block is outside of a try...except handler, it should handle None values explicitly.

Suggested change
reported_auc = float(metrics_payload.get("auc", float("nan")))
reported_asr = float(metrics_payload.get("asr", float("nan")))
reported_tpr_1pct = float(metrics_payload.get("tpr_at_fpr_1pct", float("nan")))
reported_member_count = int(metrics_payload.get("num_member", -1))
reported_nonmember_count = int(metrics_payload.get("num_nonmember", -1))
reported_auc = float(metrics_payload.get("auc") if metrics_payload.get("auc") is not None else "nan")
reported_asr = float(metrics_payload.get("asr") if metrics_payload.get("asr") is not None else "nan")
reported_tpr_1pct = float(metrics_payload.get("tpr_at_fpr_1pct") if metrics_payload.get("tpr_at_fpr_1pct") is not None else "nan")
reported_member_count = int(metrics_payload.get("num_member") if metrics_payload.get("num_member") is not None else -1)
reported_nonmember_count = int(metrics_payload.get("num_nonmember") if metrics_payload.get("num_nonmember") is not None else -1)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants