From 104cbb992fd2c32a5f1e5435e5c3ef8b27836fe3 Mon Sep 17 00:00:00 2001 From: Algis Dumbris Date: Sun, 22 Nov 2026 15:30:00 +0200 Subject: [PATCH] Simplify the Skills review card --- ROADMAP.md | 1 + docs/development/web-ui-verification.md | 2 +- docs/features/skills.md | 5 + docs/web-ui/server-detail.md | 15 +- e2e/web-ui-sweep/skills-tab.spec.ts | 41 +++++- .../src/components/skills/SkillDetail.vue | 135 ++++++++++++------ frontend/tests/unit/skill-detail.spec.ts | 98 ++++++++++++- scripts/run-skills-tab-sweep.sh | 6 +- specs/125-skills-over-mcp/spec.md | 2 +- .../checklists/requirements.md | 8 ++ specs/131-skills-card-ux/plan.md | 21 +++ specs/131-skills-card-ux/spec.md | 42 ++++++ specs/131-skills-card-ux/tasks.md | 11 ++ .../verification/report.html | 1 + 14 files changed, 330 insertions(+), 58 deletions(-) create mode 100644 specs/131-skills-card-ux/checklists/requirements.md create mode 100644 specs/131-skills-card-ux/plan.md create mode 100644 specs/131-skills-card-ux/spec.md create mode 100644 specs/131-skills-card-ux/tasks.md create mode 100644 specs/131-skills-card-ux/verification/report.html diff --git a/ROADMAP.md b/ROADMAP.md index 247f83830..0c1f21f46 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1444,3 +1444,4 @@ Legend: `shipped` ≥95% checked · `in-flight` 1–94% · `drafted` 0% · `—` | [128-server-list-outcomes](./specs/128-server-list-outcomes/) | — | — | | [129-per-user-upstream-credentials](./specs/129-per-user-upstream-credentials/) | — | — | | [130-skills-review-ux](./specs/130-skills-review-ux/) | `shipped` | 9/9 (100%) | +| [131-skills-card-ux](./specs/131-skills-card-ux/) | `shipped` | 7/7 (100%) | diff --git a/docs/development/web-ui-verification.md b/docs/development/web-ui-verification.md index 96aead55b..4eb32e138 100644 --- a/docs/development/web-ui-verification.md +++ b/docs/development/web-ui-verification.md @@ -40,7 +40,7 @@ Alongside it, [`e2e/web-ui-sweep/visual-a11y-sweep.spec.ts`](https://github.com/ ./scripts/run-skills-tab-sweep.sh --self-test # no browser: the clean-environment, redaction and DEBUG=1 checks ``` -It builds the frontend and the core from the checkout (or takes `MCPPROXY_BINARY_PATH`, which must embed the frontend) and `cmd/skillsfixture` (or `SKILLS_FIXTURE_BINARY`), starts the fixture and a throwaway core on free loopback ports with a scratch data dir (never `~/.mcpproxy`: the core and the fixture start with a clean environment, `env -i` with only `PATH`, a scratch `HOME` and a scratch `TMPDIR`, so no `MCPPROXY_*` of the operator's reaches them (`MCPPROXY_DATA_DIR` would override the config's `data_dir`, `MCPPROXY_AUDIT_LOG_PATH` would audit into the operator's file), with `--data-dir` naming the scratch dir and a data dir under `$HOME/.mcpproxy` refused; `--self-test` proves decoys for the data dir, audit log, TPA bundle and certs paths are not touched, and that a `DEBUG=1` run, which prints progress lines and never uses xtrace, does not print the API key), `enable_skills: true`, a generated API key and the fixture as a `trust_mode: manual` streamable-http upstream, approves the server, runs the spec, and stops only what it started. The scenarios run in order against fresh state: list, viewer and part-by-part paging, approve, an upstream change to an approved skill while it is open (stale review, re-open, file diff, line diff, approve), an upstream change to a pending skill while it is open (stale review with Approve disabled, re-open), a change refreshed through the REST API that marks the open review stale through the live `skills.changed` event alone, block and unblock, reload with no page error, mixed and skill-only Review queue links filtering out the approved skill, immediate desktop detail beside the list, and compact keyboard opening with Back restoring row focus. The scenarios are one serial group with retries off (a retry would replay against state the first attempt changed). The API key reaches the page through `localStorage`, never a URL, and the spec records no traces. It writes `skills-sweep-results.json` (`checked_commit` = `git rev-parse HEAD` and `working_tree_dirty`, with a dirty tree labelled pre-commit evidence; the fixture command as basename and arguments and its port; each scenario's pass/fail with the first failed attempt's error; and `GET /api/v1/servers//skills` read back after the approve, block and unblock steps: status, blocked, available, current_hash, approved_hash), plus screenshots, and exits non-zero on any failure. Every text file it writes, and every message it prints that can carry a path or a log (including the fixture or core log dumped on a startup failure), has the API key replaced by `***` and local paths by ``, ``, `` or `~` (paths inside the checkout are printed relative to it), the configured binary and browser paths and any other path whose first segment exists on the machine by `/` (text whose root does not exist there, such as a regex literal `/approved/i` or a route `/skills/refresh`, is kept); `--self-test` checks the stdout and stderr of a passing run and of a forced fixture and core startup failure for the key and for absolute paths. The release gate runs it with `--self-test-first` in the advisory `web-ui-sweep` job, recorded as the advisory manifest entry `advisory/skills-tab-sweep`. The committed report is `specs/125-skills-over-mcp/verification/report.html`, written from a clean commit with `--no-screenshots` (no embedded screenshots); the copy with screenshots is for artifacts. +It builds the frontend and the core from the checkout (or takes `MCPPROXY_BINARY_PATH`, which must embed the frontend) and `cmd/skillsfixture` (or `SKILLS_FIXTURE_BINARY`), starts the fixture and a throwaway core on free loopback ports with a scratch data dir (never `~/.mcpproxy`: the core and the fixture start with a clean environment, `env -i` with only `PATH`, a scratch `HOME` and a scratch `TMPDIR`, so no `MCPPROXY_*` of the operator's reaches them (`MCPPROXY_DATA_DIR` would override the config's `data_dir`, `MCPPROXY_AUDIT_LOG_PATH` would audit into the operator's file), with `--data-dir` naming the scratch dir and a data dir under `$HOME/.mcpproxy` refused; `--self-test` proves decoys for the data dir, audit log, TPA bundle and certs paths are not touched, and that a `DEBUG=1` run, which prints progress lines and never uses xtrace, does not print the API key), `enable_skills: true`, a generated API key and the fixture as a `trust_mode: manual` streamable-http upstream, approves the server, runs the spec, and stops only what it started. The scenarios run in order against fresh state: list, one-action SKILL.md viewing and keyboard focus return, full digests in File hashes, part-by-part paging, approve and expand Unchanged files, an upstream change to an approved skill while it is open (stale review, re-open, file diff, line diff, approve), an upstream change to a pending skill while it is open (stale review with Approve disabled, re-open), a change refreshed through the REST API that marks the open review stale through the live `skills.changed` event alone, block and unblock, reload with no page error, mixed and skill-only Review queue links filtering out the approved skill, immediate desktop detail beside the list, and compact keyboard opening with scan evidence before Approve, Read SKILL.md focusing the reader, and Back restoring row focus. The scenarios are one serial group with retries off (a retry would replay against state the first attempt changed). The API key reaches the page through `localStorage`, never a URL, and the spec records no traces. It writes `skills-sweep-results.json` (`checked_commit` = `git rev-parse HEAD` and `working_tree_dirty`, with a dirty tree labelled pre-commit evidence; the fixture command as basename and arguments and its port; each scenario's pass/fail with the first failed attempt's error; and `GET /api/v1/servers//skills` read back after the approve, block and unblock steps: status, blocked, available, current_hash, approved_hash), plus screenshots, and exits non-zero on any failure. Every text file it writes, and every message it prints that can carry a path or a log (including the fixture or core log dumped on a startup failure), has the API key replaced by `***` and local paths by ``, ``, `` or `~` (paths inside the checkout are printed relative to it), the configured binary and browser paths and any other path whose first segment exists on the machine by `/` (text whose root does not exist there, such as a regex literal `/approved/i` or a route `/skills/refresh`, is kept); `--self-test` checks the stdout and stderr of a passing run and of a forced fixture and core startup failure for the key and for absolute paths. The release gate runs it with `--self-test-first` in the advisory `web-ui-sweep` job, recorded as the advisory manifest entry `advisory/skills-tab-sweep`. The committed report is `specs/125-skills-over-mcp/verification/report.html`, written from a clean commit with `--no-screenshots` (no embedded screenshots); the copy with screenshots is for artifacts. Manual fallback (to step through by hand): `go run ./cmd/skillsfixture -addr 127.0.0.1:` (three skills; `POST /_fixture/mutate?skill=&file=` with the new bytes and the header `X-Skills-Fixture: mutate` changes one; a request with an `Origin` header or a `Host` other than the listen address is refused), a core with `"enable_skills": true` and the fixture as a `trust_mode: manual` streamable-http upstream at `http://127.0.0.1:/mcp`, `POST /api/v1/servers//security/approve` with `{"force":true}`, then the spec with `MCPPROXY_BASE_URL`, `MCPPROXY_API_KEY`, `SWEEP_SERVER_NAME` and `SKILLS_FIXTURE_URL` set. diff --git a/docs/features/skills.md b/docs/features/skills.md index e16c5d5db..8ae08abbe 100644 --- a/docs/features/skills.md +++ b/docs/features/skills.md @@ -165,6 +165,11 @@ return. A refresh retains the open card and the approval version check; if an action removes that skill from Needs review, the card stays visible until you go back or choose another skill. +The card shows scan evidence and any coverage warnings above **Approve** and +**Approve changes**. **Read SKILL.md** opens the current text directly. Expand +**File hashes** for full digests or **Unchanged files** for matching paths. +Added, removed, and changed files stay visible in the comparison. + ### Where held skills show up {#held-skills-in-review} A skill that is pending or changed (not blocked, still listed, on an enabled server that is not quarantined and not excluded) is owed a review, and it shows up next to the tool reviews: diff --git a/docs/web-ui/server-detail.md b/docs/web-ui/server-detail.md index 319b0a6fa..accde26fc 100644 --- a/docs/web-ui/server-detail.md +++ b/docs/web-ui/server-detail.md @@ -43,8 +43,14 @@ offered opens the Tools tab instead (and the URL says `?tab=tools`). row. Focus enters the detail when a skill is opened. If an action removes an open skill from Needs review, its card stays visible until Back or another selection. A normal refresh also keeps the card open. -- **Files and viewer.** The files of the selected skill with size and digest. - A text file opens in a viewer that reads it in 64 KiB parts (**Load more**); +- **Scan.** The verdict and findings appear before **Approve** or **Approve + changes**, including incomplete coverage and truncated findings. Each + finding shows its file, position, rule, severity, and excerpt. +- **Files and viewer.** **Read SKILL.md** opens the current instructions in one + action when that file is text. Supporting text files open from the file list. + The viewer receives focus on open and returns it to the original action on + close. File sizes stay in the list and **File hashes** reveals the full + digests. The viewer reads text in 64 KiB parts (**Load more**), and once a skill has an approved copy you can switch the viewer between the current and the approved copy. A binary file is listed but never shown. Every part must be the version the list on screen names (same digest, same @@ -52,13 +58,12 @@ offered opens the Tools tab instead (and the URL says `?tab=tools`). viewer says "This file changed; reload to review the new version", and the list reloads. - **Changes.** For a skill with an approved copy, the files are compared by - path and digest (added, removed, changed, same). **Show line diff** compares + path and digest. Added, removed, and changed paths stay visible. Expand + **Unchanged files** to see the matching paths. **Show line diff** compares one changed text file line by line; a file over 256 KiB on either side is not compared in the browser. A file whose approved copy is text has **View approved**, which opens that copy; this covers a removed file and a text file replaced by a binary file at the same path, which has no line diff. -- **Scan.** The verdict, whether the scan was complete and why not, and each - finding with its file, position, rule, severity and excerpt. - **Approve, Block, Unblock.** Approve names the content hash and the server incarnation of the version you opened. If a reload (Refresh, or a `skills.changed` event) brings a new version of the open skill, or the server diff --git a/e2e/web-ui-sweep/skills-tab.spec.ts b/e2e/web-ui-sweep/skills-tab.spec.ts index 2b5c94f76..40f46c594 100644 --- a/e2e/web-ui-sweep/skills-tab.spec.ts +++ b/e2e/web-ui-sweep/skills-tab.spec.ts @@ -120,14 +120,20 @@ test('the Skills tab lists the fixture skills as awaiting review', async ({ page test('views SKILL.md, pages a large file, and does not offer a binary file', async ({ page }) => { await page.goto(url(`/servers/${SERVER}?tab=skills`)) await row(page, 'plain').click() - await page.locator('[data-test="skill-view-SKILL.md"]').click() + const shortcut = page.getByRole('button', { name: 'Read SKILL.md', exact: true }) + await shortcut.press('Enter') await expect(page.locator('[data-test="skill-viewer-text"]')).toContainText('name: plain') + const heading = page.locator('[data-test="skill-viewer-heading"]') + await expect(heading).toBeFocused() + await expect(heading).toBeInViewport() await shot(page, '02-viewer', '[data-test="skill-viewer"]') + await page.locator('[data-test="skill-viewer-close"]').click() + await expect(shortcut).toBeFocused() await row(page, 'big').click() // The listed digest and size of data/large.txt in the copy being viewed (the - // current copy: View opens it), from the core's own listing; the file row on - // screen must name the same digest (its title holds the full value). + // current copy: View opens it), from the core's own listing. File hashes + // shows the full digest when expanded. const FILE = 'data/large.txt' const listingRes = await fetch(`${BASE}/api/v1/servers/${SERVER}/skills`, { headers: { 'X-API-Key': KEY } }) expect(listingRes.status, 'GET /skills').toBe(200) @@ -135,7 +141,13 @@ test('views SKILL.md, pages a large file, and does not offer a binary file', asy const bigSkill = (listingBody.data ?? listingBody).skills.find((k: { path: string }) => k.path === 'big') const listedFile = (bigSkill?.files ?? []).find((f: { path: string }) => f.path === FILE) expect(listedFile?.digest, `the listing names ${FILE} in the current copy of big`).toBeTruthy() - await expect(page.locator(`[data-test="skill-file-${FILE}"] span.font-mono`)).toHaveAttribute('title', listedFile.digest) + const hashes = page.locator('[data-test="skill-file-hashes"]') + const digest = hashes.locator(`[data-test="skill-hash-${FILE}"]`) + await expect(hashes).toHaveJSProperty('open', false) + await expect(digest).toBeHidden() + await hashes.locator('summary').click() + await expect(digest).toBeVisible() + await expect(digest).toHaveText(listedFile.digest) // Every part is awaited as a response, and its text as a rendered update: the // Load more button is hidden while a part loads, so its absence alone is not // the end of the file. The end is a part with no next_offset. Each part must @@ -194,6 +206,14 @@ test('approve turns the chip to Approved', async ({ page }) => { await expect(chip(page, 'plain')).toHaveText('Approved') await expect(page.locator('[data-test="skills-notice"]')).toContainText(/approved/i) await expect(page.locator('[data-test="skill-approve"]')).toHaveCount(0) + const unchanged = page.locator('[data-test="skill-unchanged-files"]') + const rootFile = unchanged.locator('[data-test="skill-diff-SKILL.md"]') + await expect(unchanged).toHaveJSProperty('open', false) + await expect(rootFile).toBeHidden() + await unchanged.locator('summary').click() + await expect(rootFile).toHaveText('SKILL.md') + await expect(rootFile).toBeVisible() + await unchanged.locator('summary').click() await saveState('approve') await shot(page, '04-approved') }) @@ -366,8 +386,21 @@ test('compact keyboard selection opens detail and Back restores row focus', asyn await expect(heading).toBeInViewport() await expect(back).toBeInViewport() await expect(selected).toBeHidden() + const scan = await page.locator('[data-test="skill-scan"]').boundingBox() + const approve = await page.locator('[data-test="skill-approve"]').boundingBox() + expect(scan && approve && scan.y + scan.height <= approve.y, 'scan evidence precedes Approve').toBe(true) await shot(page, '09-mobile-detail') + const read = page.getByRole('button', { name: 'Read SKILL.md', exact: true }) + await read.press('Enter') + const viewerHeading = page.locator('[data-test="skill-viewer-heading"]') + await expect(viewerHeading).toBeFocused() + await expect(viewerHeading).toBeInViewport() + await expect(page.locator('[data-test="skill-viewer-text"]')).toContainText('name: with-files') + await page.locator('[data-test="skill-viewer-close"]').click() + await expect(read).toBeFocused() + await heading.focus() + await page.keyboard.press('Shift+Tab') await expect(back).toBeFocused() await page.keyboard.press('Enter') diff --git a/frontend/src/components/skills/SkillDetail.vue b/frontend/src/components/skills/SkillDetail.vue index 475a0fd5b..a7b6a1fe1 100644 --- a/frontend/src/components/skills/SkillDetail.vue +++ b/frontend/src/components/skills/SkillDetail.vue @@ -16,7 +16,27 @@

+
+

+ + at {{ formatDateTime(scan.scanned_at) }} +

+

+ Scan incomplete +

+
    +
  • + @ {{ f.offset }} + + +
    
    +        
  • +
+

More findings exist than are listed.

+
+
+ @@ -24,29 +44,16 @@
-
-

Files ({{ skill.files.length }}, {{ formatSkillSize(skill.total_size) }})

-
    -
  • - - {{ formatSkillSize(f.size) }} - - binary, not shown - -
  • -
-
-
- +

{{ viewer.copy === 'approved' ? 'approved copy' : 'current copy' }} - +

       
@@ -54,15 +61,37 @@
+
+

Files ({{ skill.files.length }}, {{ formatSkillSize(skill.total_size) }})

+
    +
  • + + {{ formatSkillSize(f.size) }} + binary, not shown + +
  • +
+
+ File hashes +
+
+
+
+
+
+
+
+

Changes since the approved copy

-
    -
  • +

    No file changes.

    +
      +
    • {{ r.state }} - +
    @@ -71,33 +100,18 @@

    -
- -
-

Scan

- -

- Verdict: - at {{ formatDateTime(scan.scanned_at) }} -

-

- Scan incomplete: -

-
    -
  • - @ {{ f.offset }} - - -
    
    -        
  • -
-

More findings exist than are listed.

+
+ Unchanged files ({{ unchangedFiles.length }}) +
    +
  • +
+