Skip to content

fix(watch): wire missing CLI flags, validate state-backend, fix auth stderr (#834) - #837

Merged
diberry merged 1 commit into
devfrom
squad/834-watch-p0-p1-fixes
Apr 7, 2026
Merged

diberry merged 1 commit into
devfrom
squad/834-watch-p0-p1-fixes

Conversation

@diberry

@diberry diberry commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor
  • Analyze PR review comments and understand required changes
  • Create scripts/moderate-spam.mjs with GITHUB_REPOSITORY validation, injectable env, fileURLToPath isMain check
  • Create scripts/lock-stale.mjs with parseInt NaN-safe defaults, pluralization, fileURLToPath isMain check
  • Create test/scripts/moderate-spam.test.ts (18 tests) and test/scripts/lock-stale.test.ts (8 tests) — all 26 pass
  • Create .github/workflows/squad-comment-moderation.yml with actions/setup-node@v4 (node-version: 22) and without pull-requests: write
  • Update vitest.config.ts with CRLF-safe shebang stripping plugin (/^#![^\r\n]*\r?\n/)

Copilot AI review requested due to automatic review settings April 4, 2026 23:15
@github-actions

github-actions Bot commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #837

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 4
Files added 1
Files modified 3
Files deleted 0
Modules touched 2

🎯 Risk Factors

  • 4 files changed (≤5 → LOW)
  • 2 modules touched (2-4 → MEDIUM)

📦 Modules Affected

root (1 file)
  • .changeset/watch-p0-p1-fixes.md
squad-cli (3 files)
  • packages/squad-cli/src/cli-entry.ts
  • packages/squad-cli/src/cli/commands/watch/config.ts
  • packages/squad-cli/src/cli/commands/watch/health.ts

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

@github-actions

github-actions Bot commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

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

⚠️ 2 item(s) to address before review

Status Check Details
✅ Single commit 1 commit — clean history
✅ 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 0 active Copilot thread(s) resolved (7 outdated skipped)
❌ CI passing 16 check(s) still running

This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces GitHub automation to moderate spam and auto-lock stale items, plus test coverage for the new scripts (despite the PR metadata describing a docs-only fact-checker template update).

Changes:

  • Add a new GitHub Actions workflow to filter issue comments, moderate newly opened issues for spam, and auto-lock stale closed items on a schedule.
  • Add two Node scripts (moderate-spam.mjs, lock-stale.mjs) with comprehensive Vitest test suites.
  • Update Vitest config with a pre-transform plugin to strip shebangs from .mjs scripts during testing.

Reviewed changes

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

Show a summary per file
File Description
vitest.config.ts Adds a Vite/Vitest plugin to strip shebang lines so .mjs scripts can be imported in tests.
scripts/moderate-spam.mjs Implements spam scoring + moderation actions (label/close/comment) for newly opened issues.
scripts/lock-stale.mjs Implements scheduled search + lock of stale closed issues/PRs.
test/scripts/moderate-spam.test.ts Adds unit tests for spam scoring and moderation API behavior.
test/scripts/lock-stale.test.ts Adds unit tests for stale search, lock behavior, and run summaries.
.github/workflows/squad-comment-moderation.yml Wires the scripts/actions into issue/issue_comment/scheduled automation with permissions.

Comment thread vitest.config.ts Resolved
Comment thread scripts/moderate-spam.mjs Resolved
Comment thread scripts/lock-stale.mjs Resolved
Comment thread scripts/lock-stale.mjs Resolved
…stderr (#834)

P0:
- Wire --notify-level, --overnight-start, --overnight-end, --sentinel-file
  to WatchConfig interface, loadWatchConfig merge, and normalizeFileConfig
- Validate --state-backend upfront against allowed values
  (worktree, git-notes, orphan, external); reject invalid with exit(1)

P1:
- Fix probeCurrentGhUser() to use 'gh api user -q .login' (stdout)
  instead of parsing 'gh auth status' stderr output
- Wire authUser through loadWatchConfig merge (was accepted but dropped)
- Add --dispatch-mode, --log-file, and new flags to knownValueFlags
  so they are not treated as positional args

Also extends SQUAD_TEAM_ROOT env var to all resolveSquad() call sites
so all commands respect it for subprocess compatibility.

Closes #834
Closes #835
Related: PR #763, #734

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@tamirdresher tamirdresher left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved by @tamirdresher — reviewed diff, CI green, changes are clean and well-tested. cc @diberry

@diberry
diberry merged commit 4e389f6 into dev Apr 7, 2026
11 checks passed
tamirdresher pushed a commit that referenced this pull request Apr 21, 2026
…stderr (#834) (#837)

P0:
- Wire --notify-level, --overnight-start, --overnight-end, --sentinel-file
  to WatchConfig interface, loadWatchConfig merge, and normalizeFileConfig
- Validate --state-backend upfront against allowed values
  (worktree, git-notes, orphan, external); reject invalid with exit(1)

P1:
- Fix probeCurrentGhUser() to use 'gh api user -q .login' (stdout)
  instead of parsing 'gh auth status' stderr output
- Wire authUser through loadWatchConfig merge (was accepted but dropped)
- Add --dispatch-mode, --log-file, and new flags to knownValueFlags
  so they are not treated as positional args

Also extends SQUAD_TEAM_ROOT env var to all resolveSquad() call sites
so all commands respect it for subprocess compatibility.

Closes #834
Closes #835
Related: PR #763, #734

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bradygaster
bradygaster deleted the squad/834-watch-p0-p1-fixes branch August 8, 2026 08:42
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.

4 participants