Skip to content

Raise proper Pulp errors from failing tasks - #8096

Merged
ggainey merged 1 commit into
pulp:mainfrom
dark3rMatt3r:fix-unsafe-task-exceptions
Sep 22, 2026
Merged

ggainey merged 1 commit into
pulp:mainfrom
dark3rMatt3r:fix-unsafe-task-exceptions

Conversation

@dark3rMatt3r

Copy link
Copy Markdown
Contributor

Problem

Raw, non-Pulp exceptions escaping the task runner (_execute_task) log a pulpcore.deprecation "will be sanitized" warning and would lose their messages under REDACT_UNSAFE_EXCEPTIONS in 3.130. Because the deprecations CI job asserts that log is empty, these leaks turn every PR's run red. This is the general form of the (already-closed) #7910.

Offending paths and fixes — each now raises a PulpException subclass:

  • finalize_replication raised a bare Exception; now raises ReplicateError, extended with an optional details arg to keep the failed-subtask summary (backward compatible).
  • The replicate task let raw requests HTTPErrors escape when contacting the upstream (e.g. the 404 schema fetch); these are now wrapped in ExternalServiceError, matching the existing SSL handling.
  • The generic delete tasks (general_delete/general_multi_delete/ageneral_delete) let Django ProtectedError escape; they now raise the new ProtectedResourceError (PLP0029), extending the DoesNotExist handling from Update delete task to skip over already deleted objects #7930.
  • The failing_task/afailing_task test tasks raised RuntimeError; they now raise a PulpException subclass so their messages survive redaction. The task-purge fixture uses that task instead of sleep(-1).

ProtectedResourceError is exported from pulpcore.exceptions and the pulpcore.plugin.exceptions plugin API.

Testing

  • Functional suite passes with 0 server-side "will be sanitized" warnings (the exact gate signal).
  • New unit tests (pulpcore/tests/unit/tasking/test_delete_tasks.py) cover the ProtectedError → ProtectedResourceError conversion for all three delete tasks.

Notes

  • replica.py now imports requests (present transitively via pulp-glue) — happy to add it to pyproject.toml if preferred.

Root-cause writeup: dark3rMatt3r#1

📜 Checklist

  • Commits are cleanly separated with meaningful messages (simple features and bug fixes should be squashed to one commit)
  • A changelog entry or entries has been added for any significant changes
  • Follows the Pulp policy on AI Usage
  • (For new features) - User documentation and test coverage has been added

See: Pull Request Walkthrough

🤖 Generated with Claude Code

@natehansberry

Copy link
Copy Markdown

@ggainey , this failure seems flaky no? maybe a re-run would resolve? also if there is some refactor you would like on this (or if it is obsolete) please let me know.

@ggainey

ggainey commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

@ggainey , this failure seems flaky no? maybe a re-run would resolve? also if there is some refactor you would like on this (or if it is obsolete) please let me know.

Ah - we're tripping over the "minio went away" problem. Rebase on latest-main and resubmit, should resolve the s3 prob (and the conflict, of course)

Raw non-Pulp exceptions escaping the task runner triggered
pulpcore.deprecation warnings and would lose their messages under
REDACT_UNSAFE_EXCEPTIONS in 3.130. Replication, the generic delete
tasks, and the failing test tasks now raise PulpException subclasses
(ReplicateError, ExternalServiceError, the new ProtectedResourceError,
and PulpTestError).

Assisted-by: claude-opus-4.8
@dark3rMatt3r
dark3rMatt3r force-pushed the fix-unsafe-task-exceptions branch from 36e2402 to 8f5941c Compare September 22, 2026 15:26
@natehansberry

Copy link
Copy Markdown

thanks @ggainey! rebase and conflict resolution done & done

@ggainey ggainey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, looks to clear the deprecation-warnings! Thanks for the contribution!

@ggainey
ggainey merged commit f0ab3c1 into pulp:main Sep 22, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants