|
| 1 | +name: UI Numbers Audit Gate |
| 2 | + |
| 3 | +# FEA-1437 Phase 6 — gate PRs on the UI Numbers Audit. Two jobs: |
| 4 | +# coverage — fast, static: every scanner detection is classified (no |
| 5 | +# needs_review), every harness parser has a contract test. This |
| 6 | +# is the merge gate that fires when a new route / tile / parser |
| 7 | +# lands without manifest coverage. |
| 8 | +# ui-audit — heavier: builds the agent-monitor sidecar and runs the headless |
| 9 | +# Playwright tile audits (rendered DOM == oracle). |
| 10 | +# Real-Electron + visual-regression suites are intentionally NOT here; they run |
| 11 | +# elsewhere as non-blocking (flaky-by-nature) per PLN-760. |
| 12 | +# |
| 13 | +# NO `paths:` filter on purpose. The `coverage` job is intended to be a REQUIRED |
| 14 | +# status check, and "required check + paths filter" is a classic deadlock: a PR |
| 15 | +# that doesn't touch apps/desktop/** never triggers the job, so the required |
| 16 | +# status sits pending forever and the PR can't merge. Triggering on every PR |
| 17 | +# keeps the required check from hanging. The `coverage` job is fast; only mark |
| 18 | +# `coverage` as required (leave `ui-audit` optional — see apps/desktop/ci/README.md). |
| 19 | + |
| 20 | +on: |
| 21 | + pull_request: |
| 22 | + types: [opened, synchronize, reopened] |
| 23 | + push: |
| 24 | + branches: [main] |
| 25 | + |
| 26 | +concurrency: |
| 27 | + group: audit-gate-${{ github.event.pull_request.number || github.ref }} |
| 28 | + cancel-in-progress: true |
| 29 | + |
| 30 | +jobs: |
| 31 | + coverage: |
| 32 | + name: Coverage gate (static) |
| 33 | + runs-on: ubuntu-latest |
| 34 | + timeout-minutes: 10 |
| 35 | + permissions: |
| 36 | + contents: read |
| 37 | + packages: read |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + - uses: pnpm/action-setup@v4 |
| 41 | + - uses: actions/setup-node@v4 |
| 42 | + with: |
| 43 | + node-version: 22 |
| 44 | + cache: pnpm |
| 45 | + - name: Install dependencies |
| 46 | + run: pnpm install --frozen-lockfile |
| 47 | + env: |
| 48 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + - name: Generate build info |
| 50 | + run: pnpm -r prebuild |
| 51 | + - name: Audit coverage gate |
| 52 | + run: pnpm -C apps/desktop audit:coverage |
| 53 | + - name: Coverage summary -> job summary |
| 54 | + if: always() |
| 55 | + # Reporting only — never let a summary glitch fail the gate job. |
| 56 | + continue-on-error: true |
| 57 | + run: | |
| 58 | + COV=apps/desktop/test-e2e/agent-monitor/inventory/coverage.json |
| 59 | + if [ -f "$COV" ]; then |
| 60 | + { |
| 61 | + echo "### UI Numbers Audit — coverage" |
| 62 | + echo "" |
| 63 | + echo "| status | count |" |
| 64 | + echo "|---|---|" |
| 65 | + # Resolve to an absolute path: require() treats a bare relative |
| 66 | + # string as a node_modules specifier and would throw. |
| 67 | + node -e ' |
| 68 | + const c = require(require("path").resolve(process.env.COV)); |
| 69 | + for (const [k, v] of Object.entries(c.by_status)) console.log(`| ${k} | ${v} |`); |
| 70 | + console.log(`| **total** | **${c.total_detections}** |`); |
| 71 | + ' |
| 72 | + } >> "$GITHUB_STEP_SUMMARY" |
| 73 | + fi |
| 74 | + env: |
| 75 | + COV: apps/desktop/test-e2e/agent-monitor/inventory/coverage.json |
| 76 | + |
| 77 | + ui-audit: |
| 78 | + name: UI tile audit (headless Playwright) |
| 79 | + runs-on: ubuntu-latest |
| 80 | + timeout-minutes: 25 |
| 81 | + permissions: |
| 82 | + contents: read |
| 83 | + packages: read |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v4 |
| 86 | + - uses: pnpm/action-setup@v4 |
| 87 | + - uses: actions/setup-node@v4 |
| 88 | + with: |
| 89 | + node-version: 22 |
| 90 | + cache: pnpm |
| 91 | + - name: Install dependencies |
| 92 | + run: pnpm install --frozen-lockfile |
| 93 | + env: |
| 94 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 95 | + - name: Generate build info |
| 96 | + run: pnpm -r prebuild |
| 97 | + - name: Install Playwright Chromium |
| 98 | + run: pnpm -C apps/desktop exec playwright install --with-deps chromium |
| 99 | + - name: Run headless tile audit |
| 100 | + run: pnpm -C apps/desktop test:audit:ui |
| 101 | + - name: Upload Playwright report on failure |
| 102 | + if: failure() |
| 103 | + uses: actions/upload-artifact@v4 |
| 104 | + with: |
| 105 | + name: playwright-audit-report |
| 106 | + path: apps/desktop/test-results/ |
| 107 | + retention-days: 7 |
| 108 | + if-no-files-found: ignore |
0 commit comments