Skip to content

Commit a52e90a

Browse files
DumbrisAlgis Dumbris
andauthored
ci(release): advisory Playwright web-UI sweep on tag builds (QA gate T2) (#1030)
* ci(release): advisory Playwright web-UI sweep on tag builds (QA gate T2) Spec 081 T2. The release QA gate now runs the Playwright Web UI sweep on every tag build (release.yml / prerelease.yml already call the reusable gate), against the Web UI served by the candidate binary with a live mcpfixture stdio upstream. Advisory by design, enforced twice: `continue-on-error: true` on the job (a failing job inside a reusable workflow would otherwise become the workflow_call conclusion the publishers gate on), and a non-blocking manifest entry `advisory/web-ui-sweep` (renamed from `reserved/web-ui-sweep`) whose failures land in `advisory_failures` via a new `release-gate run-suite --advisory` flag. Promotion to blocking is Blocking:true + dropping continue-on-error. The sweep itself is now committed (e2e/web-ui-sweep: servers list, server detail + security tab, tools page + search, activity log, settings; fails on uncaught page exceptions) and scripts/run-web-smoke.sh — previously dead, it ran a spec file that lives only in a gitignored dir — is the single launcher for both the manual run and the CI job. * fix(ci): keep advisory sweep artifacts out of release assets; harden launcher Cross-model review follow-ups on the T2 Playwright sweep. The gate runs as a reusable workflow, so its artifacts land in the publisher's own run — and release.yml/prerelease.yml build release assets by globbing every *.tar.gz/*.zip from ALL run artifacts. A Playwright HTML report keeps its traces as playwright-report/data/ <sha>.zip, retained on failure (and on a flaky-then-green retry), so a red advisory sweep on a tag would have attached unnamed trace zips to the public release. Both publishers now exclude the sweep artifact from that glob, guarded by TestPublishersDoNotShipSweepArtifacts. scripts/run-web-smoke.sh: - generate a throwaway API key instead of honouring MCPPROXY_API_KEY, which the sweep writes into every navigation URL and Playwright then stores in the HTML report and failure traces; pin it into the server's environment too, since the env var outranks the config file and an ambient key otherwise left the server demanding one key while the probe used another (46s of 401s, then a readiness timeout) - fail fast when the candidate exits before becoming ready instead of burning the full timeout, and give the readiness curl connect/max timeouts so a port held by a non-responding process cannot block the loop forever (occupied-port repro: 119s -> 5s) - preserve the server log from the cleanup trap so an early failure is diagnosable from the uploaded artifact, not just the CI console - reject fixture paths containing a quote/backslash/newline rather than silently emitting a malformed config heredoc - npm ci against a committed package-lock.json instead of resolving the mutable ^1.49.0 range during release qualification * fix(ci): enforce the sweep lockfile against stale node_modules Round-2 review follow-up. `npm ci` ran only when the playwright binary was missing, so a tree installed by an older revision of this script (unlocked `npm install`) kept serving an unreviewed version forever — the lockfile was enforced on fresh CI runners but not in existing worktrees. Compare the installed @playwright/test version against the lockfile instead of merely checking for presence: a mismatch reinstalls, a match still skips. That closes the hole without making every hand-run pay a registry round-trip, which running `npm ci` unconditionally would. * fix(ci): stamp the sweep install with the lockfile hash Round-3 review follow-up, closing two low-severity residuals in the install guard. Comparing only @playwright/test's version still missed a lockfile that moved a transitive dependency (playwright-core) without touching the top-level version. Hash the whole lockfile instead and stamp it into node_modules after a successful npm ci; any drift reinstalls. Verified against a transitive-only lockfile bump, which the version check would have skipped. The stamp is written only on success, so a failed npm ci leaves the previous, still-accurate stamp in place. Also pass the path through process.argv rather than interpolating it into the node -e source: a checkout under a path containing a quote produced invalid JavaScript and a silently empty result. * fix(ci): unguessable sweep key; make the tools-search check non-vacuous Cross-model review (opencode/gpt-5.6-sol) findings on the advisory Web UI sweep, both verified against the running sweep before fixing: * The throwaway instance's API key was `web-sweep-<epoch>-<pid>`. It guards the full REST admin API, which can register a stdio upstream — i.e. run an arbitrary command as whoever launched the sweep — and 127.0.0.1 is reachable by every local account, so a clock+PID key is brute-forceable for the minute the instance is up. Now 24 bytes from crypto.randomBytes. * The tools-search assertion (`count <= before` plus first-row-matches) passed vacuously when the search box did nothing: the unfiltered set is trivially <= itself and the fixture's first tool is already `echo`. It now requires every surviving row to match, which is also race-free — a strict `<` would have raced the background indexer, since `before` can be sampled mid-render. Verified non-vacuous by mutation: with the query emptied the check fails, where the old one passed. A third finding (readiness loop could latch onto a foreign server already on the port) was rejected as a false positive: the probe carries this run's unique key, and a foreign mcpproxy answers 401 — measured — while a second instance on a taken port exits 2 and is caught by the loop's liveness check. --------- Co-authored-by: Algis Dumbris <gordon.greatests@gmail.com>
1 parent 3b80912 commit a52e90a

19 files changed

Lines changed: 904 additions & 89 deletions

‎.github/workflows/prerelease.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,8 +888,11 @@ jobs:
888888
# Create a flat structure to avoid duplicates
889889
mkdir -p release-files
890890
891-
# Copy archives (tar.gz and zip files) - only versioned, no latest for prereleases
892-
find dist -name "*.tar.gz" -o -name "*.zip" | while read file; do
891+
# Copy archives (tar.gz and zip files) - only versioned, no latest for prereleases.
892+
# The QA gate runs as a reusable workflow of THIS run, so its artifacts land
893+
# in dist/ too; its Playwright HTML report stores traces as
894+
# playwright-report/data/<sha>.zip and must never become a release asset.
895+
find dist -not -path "*/web-ui-sweep-playwright-report/*" \( -name "*.tar.gz" -o -name "*.zip" \) | while read file; do
893896
filename=$(basename "$file")
894897
cp "$file" "release-files/$filename"
895898
done

‎.github/workflows/release-qa-gate.yml‎

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ name: Release QA Gate
1616
# manually against any ref (workflow_dispatch — a dry run that publishes
1717
# nothing and never counts as qualification for a later tag, FR-001a).
1818
#
19-
# T2/T3/T4 extension slots (reserved manifest entries, recorded as
19+
# T2 landed as an ADVISORY entry — it runs on every tag build and is reported,
20+
# but cannot block publication (`continue-on-error` + a non-blocking manifest
21+
# entry):
22+
# advisory/web-ui-sweep — T2 Playwright sweep against the candidate
23+
#
24+
# T3/T4 extension slots (reserved manifest entries, recorded as
2025
# not-run/"not-implemented-yet" until their stage lands):
21-
# reserved/web-ui-sweep — T2 Playwright sweep against the candidate
2226
# reserved/macos-smoke — T3 macOS tray smoke (advisory, FR-019/020)
2327
# reserved/surface-consistency — T4 REST/CLI/Web-UI/tray state agreement
2428
# See docs/development/release-gate.md.
@@ -374,6 +378,76 @@ jobs:
374378
retention-days: 1
375379
if-no-files-found: warn
376380

381+
# ---------------------------------------------------------------------------
382+
# T2 (US3, FR-016): Playwright Web UI sweep against the Web UI served by the
383+
# CANDIDATE binary (embedded frontend, not a dev server), with a live stdio
384+
# mcpfixture upstream so the servers/tools screens have real data.
385+
#
386+
# ADVISORY, deliberately: `continue-on-error: true` keeps a red sweep out of
387+
# this reusable workflow's conclusion, so a publisher whose job `needs:` the
388+
# gate still publishes. The sweep is nonetheless REPORTED — the driver runs it
389+
# with --advisory, which records `advisory/web-ui-sweep` as `advisory-fail`,
390+
# and the verdict job lists it under advisory_failures. Promote to blocking by
391+
# flipping that manifest entry to Blocking:true and dropping continue-on-error.
392+
#
393+
# Setup is not reinvented here: scripts/run-web-smoke.sh is the same launcher
394+
# used by hand (docs/development/web-ui-verification.md) — it boots a
395+
# throwaway instance, installs Chromium, and runs e2e/web-ui-sweep.
396+
# ---------------------------------------------------------------------------
397+
web-ui-sweep:
398+
name: Web UI sweep (advisory)
399+
needs: build-candidate
400+
runs-on: ubuntu-latest
401+
timeout-minutes: 20
402+
continue-on-error: true # advisory: never blocks the tag (FR-019 pattern)
403+
steps:
404+
- name: Checkout
405+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
406+
with:
407+
ref: ${{ inputs.ref || github.sha }}
408+
409+
- name: Set up Node.js # the sweep installs @playwright/test + Chromium
410+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
411+
with:
412+
node-version: ${{ env.NODE_VERSION }}
413+
414+
- name: Download candidate binaries
415+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
416+
with:
417+
name: gate-candidate
418+
path: dist-bin
419+
420+
- name: Stage binaries
421+
run: chmod +x dist-bin/*
422+
423+
- name: Run Web UI sweep
424+
env:
425+
MCPPROXY_BINARY_PATH: ${{ github.workspace }}/dist-bin/mcpproxy
426+
MCPPROXY_FIXTURE_PATH: ${{ github.workspace }}/dist-bin/mcpfixture
427+
ARTIFACT_DIR: ${{ github.workspace }}/tmp/web-smoke-artifacts
428+
run: |
429+
./dist-bin/release-gate run-suite \
430+
--name advisory/web-ui-sweep --advisory --report-dir "${GATE_REPORT_DIR}" \
431+
-- bash scripts/run-web-smoke.sh
432+
433+
- name: Upload Playwright report
434+
if: always()
435+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
436+
with:
437+
name: web-ui-sweep-playwright-report
438+
path: tmp/web-smoke-artifacts/
439+
retention-days: 14
440+
if-no-files-found: warn
441+
442+
- name: Upload report fragment
443+
if: always()
444+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
445+
with:
446+
name: gate-fragment-web-ui-sweep
447+
path: ${{ env.GATE_REPORT_DIR }}/
448+
retention-days: 1
449+
if-no-files-found: warn
450+
377451
# ---------------------------------------------------------------------------
378452
# Merge every fragment against the hardcoded gatereport manifest → one
379453
# verdict. Runs even if upstream jobs failed (if: always()) so a missing
@@ -383,7 +457,7 @@ jobs:
383457
# ---------------------------------------------------------------------------
384458
verdict:
385459
name: Gate verdict
386-
needs: [build-candidate, suite-api-e2e, suite-race, suite-scan-eval, matrix-invariants]
460+
needs: [build-candidate, suite-api-e2e, suite-race, suite-scan-eval, matrix-invariants, web-ui-sweep]
387461
if: always()
388462
runs-on: ubuntu-latest
389463
timeout-minutes: 10

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,8 +1298,14 @@ jobs:
12981298
# Create a flat structure to avoid duplicates
12991299
mkdir -p release-files
13001300
1301-
# Copy archives (tar.gz and zip files)
1302-
find dist -name "*.tar.gz" -o -name "*.zip" | while read file; do
1301+
# Copy archives (tar.gz and zip files).
1302+
# The QA gate runs as a reusable workflow of THIS run, so its artifacts
1303+
# land in dist/ too. Its Playwright HTML report stores traces as
1304+
# playwright-report/data/<sha>.zip (retained on failure — precisely the
1305+
# case the advisory sweep tolerates), which would otherwise be published
1306+
# as unnamed release assets. Excluded here, not upstream, so the report
1307+
# stays downloadable as a CI artifact for post-mortems.
1308+
find dist -not -path "*/web-ui-sweep-playwright-report/*" \( -name "*.tar.gz" -o -name "*.zip" \) | while read file; do
13031309
filename=$(basename "$file")
13041310
cp "$file" "release-files/$filename"
13051311
done

‎ROADMAP.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,17 @@ graph LR
105105
release_qa_gate_matrix --> release_qa_gate_consistency
106106
107107
classDef done fill:#1f7a1f,stroke:#0d3d0d,color:#ffffff;
108+
classDef in_review fill:#9a6700,stroke:#5c3d00,color:#ffffff;
108109
classDef todo fill:#6e7781,stroke:#3d4248,color:#ffffff;
109110
class release_qa_gate_matrix done;
110-
class release_qa_gate_playwright,release_qa_gate_macos,release_qa_gate_consistency todo;
111+
class release_qa_gate_playwright in_review;
112+
class release_qa_gate_macos,release_qa_gate_consistency todo;
111113
```
112114

113115
| Task | Status | Refs |
114116
| --- | --- | --- |
115117
| T1: tag-blocking release-gate workflow: server-type matrix (stdio/http/sse/docker/oauth) + invariants (activity-log/request-id, token+telemetry counters, quarantine flow, reconnect, upgrade-in-place), publish jobs gated on the verdict, scan-eval unconditional on tags | 🟢 Done | #819 |
116-
| T2: wire the Playwright Web UI sweep into the gate (currently manual-trigger only) | ⚪ Todo | — |
118+
| T2: wire the Playwright Web UI sweep into the gate (currently manual-trigger only) | 🟡 In review | — |
117119
| T3: macOS app smoke on a macos runner, advisory until 3 consecutive passes (today zero CI automation for the tray app) | ⚪ Todo | — |
118120
| T4: surface-state consistency check (tray/Web UI/CLI agree with core on server states) | ⚪ Todo | — |
119121

@@ -801,3 +803,4 @@ Legend: `shipped` ≥95% checked · `in-flight` 1–94% · `drafted` 0% · `—`
801803
| [097-stored-scripts](./specs/097-stored-scripts/) | `in-flight` | 13/14 (93%) |
802804
| [098-tools-preflight](./specs/098-tools-preflight/) | `in-flight` | 26/33 (79%) |
803805
| [099-describe-check-mode](./specs/099-describe-check-mode/) | `in-flight` | 9/10 (90%) |
806+
| [100-prompt-rugpull-baseline](./specs/100-prompt-rugpull-baseline/) | — | — |

‎cmd/release-gate/main.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ usage:
7676
[--work-dir DIR] [--cell-timeout 300s]
7777
release-gate invariants --state-file FILE --report-dir DIR [--prev-binary PATH] [--skip-upgrade] \
7878
[--upgrade-repo owner/repo] [--keep-core]
79-
release-gate run-suite --name suite/api-e2e --report-dir DIR -- CMD [ARGS...]
79+
release-gate run-suite --name suite/api-e2e --report-dir DIR [--advisory] -- CMD [ARGS...]
8080
release-gate report --report-dir DIR [--out gate-report.json] [--summary summary.md]
8181
`)
8282
}
@@ -128,6 +128,7 @@ func cmdRunSuite(ctx context.Context, args []string) (bool, error) {
128128
fs := flag.NewFlagSet("run-suite", flag.ExitOnError)
129129
name := fs.String("name", "", "manifest entry name (e.g. suite/api-e2e)")
130130
reportDir := fs.String("report-dir", "", "directory for report fragments (required)")
131+
advisory := fs.Bool("advisory", false, "non-blocking entry: record failures as advisory-fail")
131132
if err := fs.Parse(args); err != nil {
132133
return false, err
133134
}
@@ -138,7 +139,7 @@ func cmdRunSuite(ctx context.Context, args []string) (bool, error) {
138139
if len(cmdArgs) == 0 {
139140
return false, fmt.Errorf("no command given after flags (use: run-suite --name N --report-dir D -- CMD ARGS)")
140141
}
141-
return runSuite(ctx, *name, *reportDir, cmdArgs)
142+
return runSuite(ctx, *name, *reportDir, *advisory, cmdArgs)
142143
}
143144

144145
func mustAbs(p string) string {

‎cmd/release-gate/suite.go‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ import (
1414
// test-api-e2e.sh, go race tests, scan-eval --gate) and records its outcome
1515
// as a report fragment. The command's output streams through so CI logs stay
1616
// useful.
17-
func runSuite(ctx context.Context, name, reportDir string, cmdArgs []string) (bool, error) {
17+
//
18+
// advisory marks a non-blocking entry (Spec 081 T2 Web UI sweep, T3 macOS
19+
// smoke): its failures are recorded as `advisory-fail` so the merged report
20+
// distinguishes "went red but cannot block the tag" from a real blocking
21+
// failure. The returned ok is false either way — the CI job still goes red
22+
// (under continue-on-error) so a maintainer sees it.
23+
func runSuite(ctx context.Context, name, reportDir string, advisory bool, cmdArgs []string) (bool, error) {
1824
frag := &gatereport.Fragment{Name: name, StartedAt: time.Now().UTC()}
1925
cmd := exec.CommandContext(ctx, cmdArgs[0], cmdArgs[1:]...)
2026
cmd.Stdout = os.Stdout
@@ -26,6 +32,9 @@ func runSuite(ctx context.Context, name, reportDir string, cmdArgs []string) (bo
2632
frag.DurationMS = frag.FinishedAt.Sub(frag.StartedAt).Milliseconds()
2733
if err != nil {
2834
frag.Status = gatereport.StatusFail
35+
if advisory {
36+
frag.Status = gatereport.StatusAdvisoryFail
37+
}
2938
frag.Reason = fmt.Sprintf("suite command failed: %v", err)
3039
frag.Classification = gatereport.ClassificationProduct
3140
} else {

‎cmd/release-gate/suite_test.go‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package main
2+
3+
import (
4+
"context"
5+
"encoding/json"
6+
"os"
7+
"path/filepath"
8+
"testing"
9+
10+
"github.com/smart-mcp-proxy/mcpproxy-go/internal/gatereport"
11+
)
12+
13+
func readFragment(t *testing.T, dir, name string) gatereport.Fragment {
14+
t.Helper()
15+
data, err := os.ReadFile(filepath.Join(dir, gatereport.FragmentFileName(name)))
16+
if err != nil {
17+
t.Fatalf("read fragment %s: %v", name, err)
18+
}
19+
var frag gatereport.Fragment
20+
if err := json.Unmarshal(data, &frag); err != nil {
21+
t.Fatalf("parse fragment %s: %v", name, err)
22+
}
23+
return frag
24+
}
25+
26+
// A failing advisory suite must be recorded as advisory-fail (never plain
27+
// fail), so the merged report reads honestly: the check ran, it went red, and
28+
// it did not block the tag (Spec 081 T2/FR-019).
29+
func TestRunSuite_AdvisoryFailure_RecordsAdvisoryFail(t *testing.T) {
30+
dir := t.TempDir()
31+
ok, err := runSuite(context.Background(), gatereport.EntryAdvisoryWebUISweep, dir, true,
32+
[]string{"sh", "-c", "exit 3"})
33+
if err != nil {
34+
t.Fatalf("runSuite returned an error: %v", err)
35+
}
36+
if ok {
37+
t.Error("a failing suite must report ok=false even when advisory (the job goes red under continue-on-error)")
38+
}
39+
frag := readFragment(t, dir, gatereport.EntryAdvisoryWebUISweep)
40+
if frag.Status != gatereport.StatusAdvisoryFail {
41+
t.Errorf("status=%s want %s", frag.Status, gatereport.StatusAdvisoryFail)
42+
}
43+
if frag.Reason == "" {
44+
t.Error("a non-pass fragment must carry a reason (FR-004)")
45+
}
46+
}
47+
48+
func TestRunSuite_AdvisorySuccess_RecordsPass(t *testing.T) {
49+
dir := t.TempDir()
50+
ok, err := runSuite(context.Background(), gatereport.EntryAdvisoryWebUISweep, dir, true,
51+
[]string{"sh", "-c", "exit 0"})
52+
if err != nil || !ok {
53+
t.Fatalf("runSuite ok=%v err=%v, want true/nil", ok, err)
54+
}
55+
if frag := readFragment(t, dir, gatereport.EntryAdvisoryWebUISweep); frag.Status != gatereport.StatusPass {
56+
t.Errorf("status=%s want %s", frag.Status, gatereport.StatusPass)
57+
}
58+
}
59+
60+
// Blocking suites keep the original behaviour: a failure is a plain fail.
61+
func TestRunSuite_BlockingFailure_RecordsFail(t *testing.T) {
62+
dir := t.TempDir()
63+
if _, err := runSuite(context.Background(), gatereport.EntrySuiteAPIE2E, dir, false,
64+
[]string{"sh", "-c", "exit 1"}); err != nil {
65+
t.Fatalf("runSuite returned an error: %v", err)
66+
}
67+
if frag := readFragment(t, dir, gatereport.EntrySuiteAPIE2E); frag.Status != gatereport.StatusFail {
68+
t.Errorf("status=%s want %s", frag.Status, gatereport.StatusFail)
69+
}
70+
}

0 commit comments

Comments
 (0)