Quality Assurance #618
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Quality Assurance | |
| on: | |
| schedule: | |
| - cron: "0 */6 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| quality-assurance: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| pull-requests: write | |
| issues: write | |
| actions: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: ".nvmrc" | |
| cache: "npm" | |
| - name: Install all workspace dependencies | |
| run: npm ci | |
| env: | |
| ELECTRON_SKIP_BINARY_DOWNLOAD: "1" | |
| - name: Install mobile dependencies | |
| run: cd mobile && npm ci | |
| - name: Run quality checks | |
| id: quality-check | |
| continue-on-error: true | |
| run: | | |
| echo "## Quality Check Results" >> $GITHUB_STEP_SUMMARY | |
| FAILED=0 | |
| npm run lint:fix 2>&1 || true | |
| if npm run typecheck 2>&1 | tee typecheck.log; then | |
| echo "- typecheck: PASS" >> $GITHUB_STEP_SUMMARY | |
| else | |
| FAILED=1 | |
| echo "- typecheck: FAIL" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if npm run lint 2>&1 | tee lint.log; then | |
| echo "- lint: PASS" >> $GITHUB_STEP_SUMMARY | |
| else | |
| FAILED=1 | |
| echo "- lint: FAIL" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if npm run test 2>&1 | tee test.log; then | |
| echo "- test: PASS" >> $GITHUB_STEP_SUMMARY | |
| else | |
| FAILED=1 | |
| echo "- test: FAIL" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "QUALITY_FAILED=$FAILED" >> $GITHUB_ENV | |
| - name: Run Claude Code | |
| if: env.QUALITY_FAILED == '1' | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| additional_permissions: | | |
| actions: read | |
| claude_args: | | |
| --model claude-opus-4-6 | |
| --allowedTools "Bash,Edit,Read,Replace,CreatePullRequest" | |
| --append-system-prompt "Before finalizing any code change or PR, invoke the unslop skill (.claude/skills/unslop/SKILL.md) and apply its checklist to your diff. Strip speculative abstractions, narrating comments, defensive try/catch on trusted paths, useEffect-for-derived-data, raw MUI imports outside ui_primitives/, whole-store Zustand subscriptions, useEffect+fetch instead of useQuery, and prose throat-clearing." | |
| prompt: | | |
| # Fix Broken Quality Checks | |
| The quality checks for this repo are failing. Your job is to fix them. | |
| Read the error logs to understand what's broken, then fix it: | |
| - `typecheck.log` — TypeScript compilation errors | |
| - `lint.log` — ESLint violations (run `npm run lint:fix` first, then fix the rest manually) | |
| - `test.log` — failing test cases | |
| ## Rules | |
| - Only fix actual errors. Do not refactor, improve, or "clean up" anything. | |
| - Do not touch code unrelated to the failing checks. | |
| - Do not add features, comments, or documentation. | |
| - Keep changes minimal — the smallest diff that makes checks pass. | |
| - If a test is failing because the code is wrong, fix the code. If a test is wrong, fix the test. Use git blame and recent commits to determine which. | |
| ## Before starting | |
| - Run `gh pr list --state open --limit 20` — if an open PR already fixes these errors, stop. | |
| - Run `git branch -a | grep fix` — avoid duplicate branches. | |
| ## Verification | |
| After fixing, run all three and confirm exit code 0: | |
| ```bash | |
| npm run typecheck | |
| npm run lint | |
| npm run test | |
| ``` | |
| ## Submit | |
| If you made changes, create a PR with a title like "fix: resolve typecheck/lint/test failures" describing what broke and how you fixed it. | |
| If everything was already passing (logs show no errors), do nothing. | |
| - name: Post-change verification | |
| if: always() && env.QUALITY_FAILED == '1' | |
| run: | | |
| echo "## Post-Fix Verification" >> $GITHUB_STEP_SUMMARY | |
| if npm run typecheck && npm run lint && npm run test; then | |
| echo "All checks passing." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "Checks still failing after fix attempt." >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi |