Commit b42d3da
authored
feat: Improve OS version filtering for Pub/Sub tasks (#5026)
### Description:
**Summary:**
This PR addresses a flaw in the client-side OS version filtering for
Pub/Sub tasks. Legacy bots, which do not have the `BASE_OS_VERSION`
environment variable set, were not correctly skipping tasks intended for
specific, newer OS versions. This could lead to bots attempting to
execute incompatible tasks, causing errors and wasting resources,
particularly during OS version migrations.
This change makes the task handling more resilient by ensuring that bots
only process tasks compatible with their environment.
**Changes:**
- **Modified `_filter_task_for_os_mismatch`:** The core filtering logic
in `src/clusterfuzz/_internal/base/tasks/__init__.py` has been updated.
It now correctly skips a task if the incoming message has a
`base_os_version` attribute and the bot's own OS version is either
different or not set (`None`).
- **Updated Unit Tests:** The corresponding unit tests in
`src/clusterfuzz/_internal/tests/core/base/tasks/tasks_test.py` have
been updated to validate the corrected logic and ensure there are no
regressions.
- **Improved Documentation:** The docstring for the filtering function
has been refined to be more explicit and conform to the Google Python
Style Guide. Redundant inline comments were removed to improve code
clarity.
**Testing:**
All changes are covered by unit tests. The relevant test suite passes
successfully.1 parent 6e8b7b6 commit b42d3da
File tree
2 files changed
+39
-26
lines changed- src/clusterfuzz/_internal
- base/tasks
- tests/core/base/tasks
2 files changed
+39
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
589 | | - | |
| 589 | + | |
590 | 590 | | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
| 591 | + | |
| 592 | + | |
595 | 593 | | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
601 | 601 | | |
602 | 602 | | |
603 | | - | |
604 | | - | |
| 603 | + | |
| 604 | + | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
| 608 | + | |
608 | 609 | | |
609 | 610 | | |
610 | 611 | | |
611 | 612 | | |
612 | | - | |
613 | | - | |
| 613 | + | |
614 | 614 | | |
615 | 615 | | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
623 | 626 | | |
624 | 627 | | |
625 | 628 | | |
| |||
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
283 | 285 | | |
284 | 286 | | |
285 | 287 | | |
| |||
297 | 299 | | |
298 | 300 | | |
299 | 301 | | |
| 302 | + | |
| 303 | + | |
300 | 304 | | |
301 | 305 | | |
302 | 306 | | |
| |||
336 | 340 | | |
337 | 341 | | |
338 | 342 | | |
339 | | - | |
340 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
341 | 346 | | |
342 | 347 | | |
343 | 348 | | |
344 | 349 | | |
345 | 350 | | |
346 | | - | |
347 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
348 | 358 | | |
349 | 359 | | |
350 | 360 | | |
| |||
0 commit comments