Skip to content

feat(ci): add comment spam protection and auto-lock stale issues (#751) [ON HOLD]#800

Closed
diberry wants to merge 2 commits intodevfrom
squad/751-comment-spam-protection
Closed

feat(ci): add comment spam protection and auto-lock stale issues (#751) [ON HOLD]#800
diberry wants to merge 2 commits intodevfrom
squad/751-comment-spam-protection

Conversation

@diberry
Copy link
Copy Markdown
Collaborator

@diberry diberry commented Apr 3, 2026

  • Explore codebase and understand current state
  • Fix spam score auto-close threshold from >= 7 to >= 5 in scripts/moderate-spam.mjs
  • Update test descriptions/comments referencing >= 7 in test/scripts/moderate-spam.test.ts
  • Add actions/setup-node@v4 (node-version: 22) to moderate-new-content and auto-lock-stale workflow jobs
  • Run tests to validate changes (23/23 moderate-spam, 13/13 lock-stale)
  • Final code review (0 issues found)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit feea21b

PR Scope: 🔧 Infrastructure

⚠️ 3 item(s) to address before review

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.

@diberry diberry force-pushed the squad/751-comment-spam-protection branch 2 times, most recently from e147ab2 to 4e9ed93 Compare April 3, 2026 21:59
@diberry diberry marked this pull request as ready for review April 3, 2026 22:00
Copilot AI review requested due to automatic review settings April 3, 2026 22:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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).

@diberry diberry force-pushed the squad/751-comment-spam-protection branch 3 times, most recently from 865d7bb to 902dcf5 Compare April 4, 2026 00:15
@diberry
Copy link
Copy Markdown
Collaborator Author

diberry commented Apr 4, 2026

Files in this PR:

  • .github/workflows/squad-comment-moderation.yml
  • scripts/lock-stale.mjs
  • scripts/moderate-spam.mjs
  • test/scripts/lock-stale.test.ts
  • test/scripts/moderate-spam.test.ts
  • vitest.config.ts

@diberry diberry force-pushed the squad/751-comment-spam-protection branch from 9b97e64 to 8ea0bec Compare April 4, 2026 13:38
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

🔒 Security Review

🔒 Security review: 4 info.

Severity Category Finding Location
ℹ️ info workflow-permissions Workflow grants write permission — verify this is the minimum required scope. .github/workflows/squad-comment-moderation.yml:17
ℹ️ info workflow-permissions Workflow grants write permission — verify this is the minimum required scope. .github/workflows/squad-comment-moderation.yml:30
ℹ️ info workflow-permissions Workflow grants write permission — verify this is the minimum required scope. .github/workflows/squad-comment-moderation.yml:53
ℹ️ info workflow-permissions Workflow grants write permission — verify this is the minimum required scope. .github/workflows/squad-comment-moderation.yml:54

Automated security review — informational only.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

🏗️ Architectural Review

⚠️ Architectural review: 1 info.

Severity Category Finding Files
ℹ️ info template-sync Template files changed in .github/workflows/ but not in other template locations. If these templates should stay in sync, consider updating the others too. Changed: .github/workflows/, Unchanged: templates/, .squad-templates/, packages/squad-cli/templates/

Automated architectural review — informational only.

@diberry diberry force-pushed the squad/751-comment-spam-protection branch 5 times, most recently from de5067f to 187d2b6 Compare April 4, 2026 17:01
@diberry diberry force-pushed the squad/751-comment-spam-protection branch from 187d2b6 to f77df6e Compare April 4, 2026 23:19
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

🟡 Impact Analysis — PR #800

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 8
Files added 6
Files modified 2
Files deleted 0
Modules touched 4

🎯 Risk Factors

  • 8 files changed (6-20 → MEDIUM)
  • 4 modules touched (2-4 → MEDIUM)

📦 Modules Affected

ci-workflows (1 file)
  • .github/workflows/squad-comment-moderation.yml
root (3 files)
  • .changeset/comment-spam-protection.md
  • CONTRIBUTING.md
  • vitest.config.ts
scripts (2 files)
  • scripts/lock-stale.mjs
  • scripts/moderate-spam.mjs
tests (2 files)
  • test/scripts/lock-stale.test.ts
  • test/scripts/moderate-spam.test.ts

This report is generated automatically for every PR. See #733 for details.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

@diberry diberry force-pushed the squad/751-comment-spam-protection branch from f77df6e to 53ca9db Compare April 4, 2026 23:42
@diberry diberry force-pushed the squad/751-comment-spam-protection branch 2 times, most recently from a428be1 to c8bd598 Compare April 5, 2026 19:00
diberry added a commit that referenced this pull request Apr 6, 2026
…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>
@diberry diberry force-pushed the squad/751-comment-spam-protection branch 2 times, most recently from f3048e5 to 966c03c Compare April 6, 2026 16:08
Copy link
Copy Markdown
Collaborator

@tamirdresher tamirdresher left a comment

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

@tamirdresher tamirdresher left a comment

Choose a reason for hiding this comment

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

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.

@diberry diberry force-pushed the squad/751-comment-spam-protection branch from 966c03c to 7a5b0f0 Compare April 8, 2026 14:28
@diberry
Copy link
Copy Markdown
Collaborator Author

diberry commented Apr 8, 2026

🔍 Squad Review — Kaylee (Engineering)

# Check Status Notes
1 Changelog entry .changeset/comment-spam-protection.md present (no package scope — appropriate for CI/scripts-only change)
2 Squashed to 1 commit 1 commit
3 CI green All checks pass (23 moderate-spam + 13 lock-stale tests pass)
4 Copilot comments resolved 9 threads — all resolved (threshold fixed to >=5, setup-node added, SHA-pin and pagination concerns addressed)
5 No .squad/ files Clean
6 No unrelated files All 8 files related to spam protection — vitest.config.ts change (strip-shebang plugin) required for tests, CONTRIBUTING.md documents moderation
7 Tests for changes Scripts (moderate-spam.mjs, lock-stale.mjs) fully covered by test files (moderate-spam.test.ts, lock-stale.test.ts)
8 Not a duplicate/reversal Unique scope (closes #751)

Verdict: ✅ Ready to merge


Review by Squad AI team (Kaylee — Engineering) · requested by Dina Berry

@diberry diberry changed the title feat(ci): add comment spam protection and auto-lock stale issues (#751) feat(ci): add comment spam protection and auto-lock stale issues (#751) [ON HOLD] Apr 8, 2026
@diberry diberry closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants