Skip to content

feat: split ClusterFuzzLite into PR, batch, and corpus-pruning jobs - #1306

Merged
bact merged 5 commits into
devfrom
copilot/improve-fuzz-testing-workflow
Mar 6, 2026
Merged

feat: split ClusterFuzzLite into PR, batch, and corpus-pruning jobs#1306
bact merged 5 commits into
devfrom
copilot/improve-fuzz-testing-workflow

Conversation

Copilot AI commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Replaces the single fuzzing job with three purpose-built jobs, each with appropriate trigger, duration, concurrency, and permission settings.

What do these changes do

  • pr-fuzzing — triggered by pull_request/push; code-change mode; 300 s; per-branch concurrency with cancel-in-progress: true to keep the dev loop fast
  • batch-fuzzing — scheduled nightly at 01:30 AM UTC+7 (18:30 UTC); batch mode; 3600 s; does not cancel in-progress
  • corpus-pruning — scheduled nightly at 04:00 AM UTC+7 (21:00 UTC), 2.5 h after batch starts; prune mode; 600 s; does not cancel in-progress
  • Each job writes a Markdown parameter table and a ✅/❌ result line to $GITHUB_STEP_SUMMARY
  • Crash artifact names are job-scoped (-pr-artifacts, -batch-artifacts) to avoid collisions
  • Write permissions moved from workflow level to job level (principle of least privilege): workflow default is contents: read; each job declares only the permissions it needs
  • fuzz/README.md updated to document all three jobs, their schedules, fuzz-seconds values, and the wall-clock overhead note

What was wrong

The single fuzzing job conflated quick PR checks, deep corpus-building sessions, and corpus housekeeping into one undifferentiated run. It had no corpus pruning at all, no job summaries, and used a ternary to pick code-change vs batch mode — with push events incorrectly falling through to batch. Additionally, broad write permissions were granted at the workflow level rather than scoped to the jobs that require them.

How this fixes it

Three separate jobs each have an explicit if: condition on github.event_name and, for scheduled jobs, on github.event.schedule. Concurrency is configured at the job level so batch and prune runs are never cancelled mid-flight, while PR runs still cancel stale in-progress runs per branch. Permissions are declared per-job: pr-fuzzing and batch-fuzzing receive contents: write and issues: write; corpus-pruning receives only contents: write; all other jobs default to contents: read.

Your checklist for this pull request

  • Passed code styles and structures
  • Passed code linting checks and unit test

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown

Hello @Copilot, thank you for submitting a PR! We will respond as soon as possible.

สวัสดี @Copilot ขอบคุณที่ส่ง PR เข้ามา เราจะตอบกลับให้เร็วที่สุดเท่าที่จะทำได้

@bact bact added infrastructure build process, configuration, GitHub Actions github_actions Pull requests that update GitHub Actions code tests Unit test, code coverage, test case labels Mar 6, 2026
…ng jobs

- Add pr-fuzzing job: triggered by pull_request/push, code-change mode, 300 s
- Add batch-fuzzing job: scheduled 18:30 UTC (01:30 AM UTC+7), batch mode, 3600 s
- Add corpus-pruning job: scheduled 21:00 UTC (04:00 AM UTC+7), prune mode, 600 s
- Use job-level concurrency groups (PR cancels in-progress; batch/prune do not)
- Add GITHUB_STEP_SUMMARY reporting to each job for quick status visibility
- Update fuzz/README.md to document all three job types and their schedules

Co-authored-by: bact <128572+bact@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve fuzz testing workflow for efficiency and resource management feat: split ClusterFuzzLite into PR, batch, and corpus-pruning jobs Mar 6, 2026
Copilot finished work on behalf of bact March 6, 2026 08:10
@bact
bact marked this pull request as ready for review March 6, 2026 08:22
@bact

bact commented Mar 6, 2026

Copy link
Copy Markdown
Member

@copilot For security reason, consider moving write permissions from workflow level to job level.

We still got the gh-pages warning, but this is no longer our first run.
See the run log at: https://github.com/PyThaiNLP/pythainlp/actions/runs/22755233451/job/65998184688?pr=1306

[7](https://github.com/PyThaiNLP/pythainlp/actions/runs/22755233451/job/65998184688?pr=1306#step:6:238)
2026-03-06 08:28:21,614 - root - INFO - Downloading corpus for fuzz_tokenize to /github/workspace/cifuzz-corpus/fuzz_tokenize.
fatal: 'origin/gh-pages' is not a commit and a branch 'gh-pages' cannot be created from it
Switched to a new branch 'gh-pages'
2026-03-06 08:28:21,826 - root - INFO - Done downloading corpus. Contains 0 element

The log of the first run is here:
https://github.com/PyThaiNLP/pythainlp/actions/runs/22754514653/job/65995876958

Workflow-level permissions are restricted to contents:read.
Each job that requires write access (corpus push, issue filing)
declares its own permissions block explicitly.

Co-authored-by: bact <128572+bact@users.noreply.github.com>

Copilot AI commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

@copilot For security reason, consider moving write permissions from workflow level to job level.

We still got the gh-pages warning, but this is no longer our first run.
...

Done in 8d4837c. The workflow-level permissions block is now contents: read only. Each job that writes declares its own permissions:

  • pr-fuzzing: contents: write + issues: write
  • batch-fuzzing: contents: write + issues: write
  • corpus-pruning: contents: write

The gh-pages warning on non-first runs is expected — it just means the branch already exists and ClusterFuzzLite is reading from it normally.

@sonarqubecloud

sonarqubecloud Bot commented Mar 6, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4 Security Hotspots

See analysis details on SonarQube Cloud

Copilot finished work on behalf of bact March 6, 2026 08:34
@bact
bact merged commit d1a6a29 into dev Mar 6, 2026
14 of 15 checks passed
@bact
bact deleted the copilot/improve-fuzz-testing-workflow branch March 6, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code infrastructure build process, configuration, GitHub Actions tests Unit test, code coverage, test case

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants