feat(ci): add comment spam protection and auto-lock stale issues (#751) [ON HOLD]#800
feat(ci): add comment spam protection and auto-lock stale issues (#751) [ON HOLD]#800
Conversation
🛫 PR Readiness Check
PR Scope: 🔧 Infrastructure
|
| Status | Check | Details |
|---|---|---|
| ❌ | Single commit | 2 commits — consider squashing before review |
| ✅ | Not in draft | Ready for review |
| ✅ | Branch up to date | Up to date with dev |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | Changeset file found |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ✅ | Copilot threads resolved | 3 active Copilot thread(s) resolved (6 outdated skipped) |
| ❌ | CI passing | 16 check(s) still running |
Files Changed (8 files, +1159 −0)
| File | +/− |
|---|---|
.changeset/comment-spam-protection.md |
+8 −0 |
.github/workflows/squad-comment-moderation.yml |
+73 −0 |
CONTRIBUTING.md |
+10 −0 |
scripts/lock-stale.mjs |
+138 −0 |
scripts/moderate-spam.mjs |
+195 −0 |
test/scripts/lock-stale.test.ts |
+347 −0 |
test/scripts/moderate-spam.test.ts |
+377 −0 |
vitest.config.ts |
+11 −0 |
Total: +1159 −0
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
e147ab2 to
4e9ed93
Compare
There was a problem hiding this comment.
Pull request overview
Adds automated GitHub issue/PR comment moderation and stale-thread locking to reduce spam and maintenance overhead.
Changes:
- Adds a GitHub Actions workflow to filter spam comments, score/auto-moderate newly opened issues, and auto-lock stale closed threads.
- Introduces a Node script (
scripts/moderate-spam.mjs) to compute spam scores and apply labels/closure/comments via GitHub’s API. - Adds Vitest coverage for the moderation script and updates Vitest config to handle executable scripts with shebangs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
vitest.config.ts |
Adds a Vite/Vitest transform plugin intended to strip shebangs so .mjs scripts can be imported in tests. |
test/scripts/moderate-spam.test.ts |
Adds unit/integration-style tests for spam scoring and moderation API behavior (mocked fetch). |
scripts/moderate-spam.mjs |
Implements spam signal detection and moderation actions (label/close/comment) for newly opened issues. |
.github/workflows/squad-comment-moderation.yml |
Adds the moderation workflow (3 jobs: third-party comment filter, custom issue moderation, scheduled stale-locking). |
865d7bb to
902dcf5
Compare
|
Files in this PR:
|
9b97e64 to
8ea0bec
Compare
🔒 Security Review🔒 Security review: 4 info.
Automated security review — informational only. |
🏗️ Architectural Review
Automated architectural review — informational only. |
de5067f to
187d2b6
Compare
187d2b6 to
f77df6e
Compare
🟡 Impact Analysis — PR #800Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedci-workflows (1 file)
root (3 files)
scripts (2 files)
tests (2 files)
This report is generated automatically for every PR. See #733 for details. |
f77df6e to
53ca9db
Compare
a428be1 to
c8bd598
Compare
…s expansion, spam protection (PRD #872) Implements PRD #872 — CI/GitHub Actions Performance Optimization. Phase 0+1: Consolidation - Repo Health: 5 jobs → 1 job with sequential steps + GITHUB_STEP_SUMMARY - Policy Gates: 4 jobs → 1 consolidated job (publish-policy kept separate) - PR Readiness: Remove synchronize/reopened from pull_request_target (fix double-trigger) - Concurrency groups added to 10 workflows (true for validation, false for publish) Phase 2: Path Filters - Added code path filter with fail-open semantics to squad-ci.yml - Docs-only PRs skip test, policy-gates, exports-map, samples-build, export-smoke Phase 4: Publish Pipeline - Removed redundant build job from insider-publish (test already builds) PR Readiness Expansion (from #870): - Added checkIssueLinkage() and checkProtectedFiles() checks (9 → 11) - Added PR lifecycle skill (.copilot/skills/pr-lifecycle/SKILL.md) - 13 new tests for readiness checks Comment Spam Protection (from #800): - Added scripts/lock-stale.mjs and scripts/moderate-spam.mjs - Added squad-comment-moderation.yml workflow - Added lock-stale and moderate-spam test suites All safety gates preserved. No product template files modified. Target: ~19 runners per PR push → ~11. Closes #872 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f3048e5 to
966c03c
Compare
tamirdresher
left a comment
There was a problem hiding this comment.
Solid work. Spam scoring logic is reasonable (pattern-based + account age), scripts are testable via DI, 36 tests covering edge cases, third-party action pinned to SHA. Rate limiting delay between lock calls is a nice touch. Ship it.
tamirdresher
left a comment
There was a problem hiding this comment.
Solid work. Spam scoring logic is reasonable, scripts are testable via DI, 36 tests covering edge cases, third-party action pinned to SHA. Rate limiting delay between lock calls is a nice touch.
966c03c to
7a5b0f0
Compare
🔍 Squad Review — Kaylee (Engineering)
Verdict: ✅ Ready to merge Review by Squad AI team (Kaylee — Engineering) · requested by Dina Berry |
>= 7to>= 5inscripts/moderate-spam.mjs>= 7intest/scripts/moderate-spam.test.tsactions/setup-node@v4(node-version: 22) tomoderate-new-contentandauto-lock-staleworkflow jobs