Implement soft delete for Fuzzer, Job, FuzzerJob, and FuzzTarget and discard unprocessable messages - #5410
Open
javanlacerda wants to merge 1 commit into
Open
Implement soft delete for Fuzzer, Job, FuzzerJob, and FuzzTarget and discard unprocessable messages#5410javanlacerda wants to merge 1 commit into
javanlacerda wants to merge 1 commit into
Conversation
javanlacerda
force-pushed
the
javan.discard-poisoned-messages
branch
from
August 2, 2026 21:01
aefb471 to
5562848
Compare
…ocessable messages - Add deleted property to Fuzzer, Job, and FuzzerJob models. - Filter out soft-deleted fuzzers and jobs in web handlers, UI views, and pagination. - Filter out soft-deleted jobs in get_all_job_type_names and fuzzer_selection. - Exclude deleted FuzzerJob records from batch_fuzzer_jobs and cleanup tasks. - Discard poisoned Pub/Sub messages referencing missing or deleted entities. - Pass fuzz_target to corpus pruning preprocess to avoid redundant Datastore query. - Use logs.warning instead of logs.error for stale/deleted entities in schedule_fuzz. - Add comprehensive unit test coverage across cleanup, handlers, commands, and datastore. Signed-off-by: Javan Lacerda <javanlacerda@google.com>
javanlacerda
force-pushed
the
javan.discard-poisoned-messages
branch
from
August 2, 2026 23:27
5562848 to
0b68d0b
Compare
javanlacerda
marked this pull request as ready for review
August 3, 2026 17:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Job,Fuzzer,FuzzerJob, orFuzzTargetentities, worker exceptions or unhandled missing lookups prevent clean task completion. Without message acknowledgment (ack), Pub/Sub redelivers the message upon deadline expiration indefinitely, wedging task queues.schedule_fuzz.py), batching (batch_fuzzer_jobs.py), and UI rendering.Solution
1. Soft Deletion Models & Web Handlers
data_types.py:deleted = ndb.BooleanProperty(default=False)toFuzzer,Job,FuzzerJob, andFuzzTarget.fuzzers.py:fuzzer.deleted = True)./fuzzersUI rendering and API endpoints.DeleteHandlerandLogHandler.jobs.py:job.deleted = True).UpdateJob.post(job.deleted = False) when recreating/updating jobs.get_results),_job_to_dict, andHandler.get.DeleteJobHandlerandGetEnvironmentHandlerto handle soft-deleted jobs cleanly.2. Worker Task Validation & Discard Logic
commands.py:process_command_implto check thatJob,Fuzzer, andFuzzerJobmappings exist and are not markeddeleted.Noneallows the worker's task lease loop to cleanly acknowledge and discard poisoned messages rather than crashing and triggering Pub/Sub redelivery.setup.py:Fuzzerexists and is not deleted inpreprocess_update_fuzzer_and_data_bundles.corpus_pruning_task.py:FuzzTargetinutask_preprocessand passed the resolved entity directly to_utask_preprocessto eliminate redundant Datastore queries.Nonewhen encountering missing or deleted fuzz targets.3. Cron Schedulers & Datastore Helpers
cleanup.py:cleanup_invalid_fuzzer_jobs()to purge orphaned or deletedFuzzerJobmapping entities from Datastore.FuzzTargetentities (fuzz_target.deleted = True) incleanup_unused_fuzz_targets_and_jobs().schedule_fuzz.py:Job,Fuzzer, andFuzzerJobentities during candidate generation.errortowarningwhen skipping deleted or missing entities during periodic scheduling.batch_fuzzer_jobs.py:FuzzerJobrecords before batching.data_handler.py:get_all_job_type_names()and soft-deleted fuzz targets inget_fuzz_target().fuzzer_selection.py:update_mappings_for_fuzzer()and ignored soft-deleted targets inget_fuzz_target_weights().Testing
src/clusterfuzz/_internal/tests/appengine/handlers/cron/cleanup_test.py(CleanupInvalidFuzzerJobsTest)src/clusterfuzz/_internal/tests/appengine/handlers/cron/schedule_fuzz_test.py(deleted entities in OSSFuzz and Chrome schedulers)src/clusterfuzz/_internal/tests/appengine/handlers/fuzzers_test.py(DeleteHandlerTest)src/clusterfuzz/_internal/tests/appengine/handlers/jobs_test.py(DeleteJobHandlerTest)src/clusterfuzz/_internal/tests/core/bot/tasks/commands_test.py(ProcessCommandImplPoisonedTest)src/clusterfuzz/_internal/tests/core/bot/tasks/utasks/corpus_pruning_task_test.py(CorpusPruningPreprocessPoisonedTest)src/clusterfuzz/_internal/tests/core/datastore/data_handler_test.py(GetFuzzTargetAndJobsTest)src/clusterfuzz/_internal/tests/core/fuzzing/fuzzer_selection_test.py(test_soft_deleted_job)