Skip to content

Commit 67a9263

Browse files
authored
Merge pull request #169 from paritytech/pg/diagnosis-report-submit
Submit diagnosis reports as PRs
2 parents 3bb3515 + 427e703 commit 67a9263

49 files changed

Lines changed: 651 additions & 1423 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-playground.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ on:
88
environment:
99
description: bulletin-deploy environment to publish to (blank = CLI default)
1010
type: choice
11-
default: ''
11+
default: ""
1212
options:
13-
- ''
13+
- ""
1414
- paseo-next-v2
1515
- preview
1616
- paseo-next
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Diagnosis report
2+
3+
# A diagnosis run in the playground files a pre-filled issue (labeled
4+
# `diagnosis-report`) carrying the markdown report in its body. This workflow
5+
# turns that issue into a PR that adds/updates the host's report under
6+
# explorer/diagnosis-reports/. The compatibility matrix is a build artifact
7+
# regenerated from those reports, so the PR only touches the report file.
8+
9+
on:
10+
issues:
11+
types: [labeled]
12+
13+
# Serialize so concurrent submissions never race on a branch push.
14+
concurrency:
15+
group: diagnosis-report
16+
cancel-in-progress: false
17+
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
issues: write
22+
23+
jobs:
24+
ingest:
25+
if: github.event.label.name == 'diagnosis-report'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Build the report PR
31+
env:
32+
GH_TOKEN: ${{ github.token }}
33+
BODY: ${{ github.event.issue.body }}
34+
ISSUE: ${{ github.event.issue.number }}
35+
run: |
36+
set -euo pipefail
37+
38+
# Host mode from the report title (`## Truapi <mode> Diagnosis`).
39+
mode=$(printf '%s' "$BODY" \
40+
| grep -ioP '##\s+Truapi\s+\K(Web|Desktop|Android|iOS)(?=\s+Diagnosis)' \
41+
| head -1 || true)
42+
if [ -z "$mode" ]; then
43+
gh issue comment "$ISSUE" --body \
44+
"Could not read a host from this report (expected a \`## Truapi <Web|Desktop|Android|iOS> Diagnosis\` heading). Not filing a PR."
45+
exit 1
46+
fi
47+
host=$(printf '%s' "$mode" | tr '[:upper:]' '[:lower:]')
48+
branch="diagnosis-report/$host"
49+
file="explorer/diagnosis-reports/$host.md"
50+
51+
git fetch origin main
52+
git switch -C "$branch" origin/main
53+
printf '%s\n' "$BODY" > "$file"
54+
55+
git config user.name "github-actions[bot]"
56+
git config user.email "github-actions[bot]@users.noreply.github.com"
57+
if git diff --quiet -- "$file"; then
58+
gh issue comment "$ISSUE" --body \
59+
"This $mode report matches the current \`$file\`; nothing to update."
60+
gh issue close "$ISSUE"
61+
exit 0
62+
fi
63+
git add "$file"
64+
git commit -m "diagnosis: update $host report (from #$ISSUE)"
65+
git push -f origin "$branch"
66+
67+
# One PR per host branch: open it the first time, reuse it after.
68+
url=$(gh pr view "$branch" --json url --jq .url 2>/dev/null || true)
69+
if [ -z "$url" ]; then
70+
url=$(gh pr create --base main --head "$branch" \
71+
--title "diagnosis: $mode host report" \
72+
--body "Updates \`$file\` from the playground Diagnosis. The compatibility matrix is regenerated from the reports at build time.")
73+
fi
74+
75+
gh issue comment "$ISSUE" --body "Filed in $url"
76+
gh issue close "$ISSUE"

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
# Run `make help` for the list of targets.
44

55
.DEFAULT_GOAL := help
6-
.PHONY: help setup build codegen test check playground matrix explorer
6+
.PHONY: help setup build codegen test check playground dev matrix explorer
77

88
TRUAPI_PKG := js/packages/truapi
99
PLAYGROUND := playground
1010
EXPLORER := explorer
11+
DOTLI := hosts/dotli
12+
13+
# `make dev DEBUG=1` runs dotli with VITE_APP_DEBUG=true to log every wire frame.
14+
DOTLI_PREVIEW := preview
15+
ifdef DEBUG
16+
DOTLI_PREVIEW := preview:debug
17+
endif
1118

1219
help: ## Show this help.
1320
@awk 'BEGIN { FS = ":.*##"; printf "Usage: make <target>\n\nTargets:\n" } \
@@ -43,6 +50,12 @@ playground: ## Refresh the playground's @parity/truapi snapshot and rebuild.
4350
cd $(PLAYGROUND) && rm -rf node_modules/@parity && yarn install
4451
cd $(PLAYGROUND) && yarn build
4552

53+
dev: ## Start dotli host (:5173) + playground (:3000) together; open http://localhost:5173/localhost:3000. DEBUG=1 logs wire frames.
54+
@trap 'kill 0' EXIT; \
55+
( cd $(DOTLI) && bun run $(DOTLI_PREVIEW) ) & \
56+
( cd $(PLAYGROUND) && yarn dev ) & \
57+
wait
58+
4659
matrix: ## Regenerate the host compatibility matrix from explorer/diagnosis-reports.
4760
cd $(EXPLORER) && npm run generate-matrix
4861

explorer/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ dist
33
*.tsbuildinfo
44
.vite
55
.DS_Store
6+
7+
# Generated at build/dev time from diagnosis-reports/ (see scripts/aggregate-diagnosis-matrix.mjs).
8+
src/data/compatibility.ts

explorer/README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,15 @@ Docs-only browser for the TrUAPI service surface. All trait and type data is sou
44

55
## Host compatibility matrix
66

7-
The **Compatibility** page (`/v/<version>/compatibility`) renders a host × method matrix aggregated from the playground's per-host Diagnosis reports. The matrix data is committed at [`src/data/compatibility.ts`](src/data/compatibility.ts) a typed module emitted by [`scripts/aggregate-diagnosis-matrix.mjs`](scripts/aggregate-diagnosis-matrix.mjs). It is the **only** runtime-derived data in the explorer; everything else flows from Rust via codegen.
7+
The **Compatibility** page (`/v/<version>/compatibility`) renders a host × method matrix aggregated from the playground's per-host Diagnosis reports. The committed per-host reports under [`diagnosis-reports/`](diagnosis-reports/) are the source of truth; [`src/data/compatibility.ts`](src/data/compatibility.ts) is a generated artifact (git-ignored) that [`scripts/aggregate-diagnosis-matrix.mjs`](scripts/aggregate-diagnosis-matrix.mjs) rebuilds from those reports at `dev` / `build` / `lint` time (via the `predev` / `prebuild` / `prelint` scripts). It is the **only** runtime-derived data in the explorer; everything else flows from Rust via codegen.
88

99
### Updating the matrix
1010

11-
1. **Collect reports.** For each host you want to (re)measure, open the playground in that host, run the Diagnosis, and click **Copy report** (see [`../playground/README.md#diagnosis`](../playground/README.md#diagnosis)). Save each report to a host-named markdown file (e.g. `web.md`, `desktop.md`, `android.md`, `ios.md`).
12-
2. **Drop them in.** Place each host-named `*.md` into [`diagnosis-reports/`](diagnosis-reports/), overwriting that host's previous report.
13-
3. **Regenerate.** From the `explorer/` directory:
11+
Because the matrix is regenerated from `diagnosis-reports/` on every `dev` / `build` / `lint`, you only ever commit reports, never `src/data/compatibility.ts`.
1412

15-
```bash
16-
npm run generate-matrix
17-
```
13+
**From the playground (recommended).** Open the playground in the host you want to (re)measure, run the Diagnosis, and click **Submit report ↗**. That files a pre-filled `diagnosis-report` issue; the [`diagnosis-report`](../.github/workflows/diagnosis-report.yml) workflow writes the report to `diagnosis-reports/<host>.md` and opens (or updates) that host's PR.
1814

19-
That **rebuilds** `src/data/compatibility.ts` from every report in `diagnosis-reports/` — one column per report — leaving the inputs in place. Because the matrix is always built from the reports alone, the committed reports are the source of truth: to refresh a host, overwrite its `*.md` and regenerate. The Compatibility page (and each method's Host support row) picks up the new data on the next build / Vite HMR.
20-
4. **Commit** the updated `src/data/compatibility.ts` together with the reports under `diagnosis-reports/`. Keeping the raw per-host reports in version control makes each run diffable against the last.
15+
**By hand.** Click **Copy report** instead (see [`../playground/README.md#diagnosis`](../playground/README.md#diagnosis)), save the markdown to a host-named file (e.g. `web.md`, `desktop.md`, `android.md`, `ios.md`), drop it into [`diagnosis-reports/`](diagnosis-reports/) overwriting that host's previous report, and commit. Run `npm run generate-matrix` from `explorer/` to preview locally (or just `npm run dev`, which regenerates first). The Compatibility page and each method's Host support row pick up the new data on the next build / Vite HMR.
2116

2217
### Data shape
2318

explorer/diagnosis-reports/android.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
## Truapi Android Diagnosis
22

3-
_Generated: 2026-06-02T13:24:09.016Z_
4-
53
| Method | Status | Details |
64
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------- |
75
| `Account/connection_status_subscribe` | ✅ | |

explorer/diagnosis-reports/desktop.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
## Truapi Desktop Diagnosis
22

3-
_Generated: 2026-06-02T13:11:33.130Z_
4-
53
| Method | Status | Details |
64
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------- |
75
| `Account/connection_status_subscribe` | ✅ | |

explorer/diagnosis-reports/ios.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
## Truapi iOS Diagnosis
22

3-
Generated: 2026-06-02T12:55:35.461Z
4-
53
| Method | Status | Details |
64
| ---------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
75
| Account/connection_status_subscribe | ✅ | |

explorer/diagnosis-reports/web.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
## Truapi Web Diagnosis
22

3-
_Generated: 2026-06-02T12:52:16.980Z_
4-
53
| Method | Status | Details |
64
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------- |
75
| `Account/connection_status_subscribe` | ✅ | |

explorer/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
"version": "0.0.0",
55
"type": "module",
66
"scripts": {
7+
"predev": "npm run generate-matrix",
78
"dev": "vite",
9+
"prebuild": "npm run generate-matrix",
810
"build": "tsc -b && vite build",
11+
"prelint": "npm run generate-matrix",
912
"lint": "tsc -b --noEmit",
1013
"preview": "vite preview",
1114
"generate-matrix": "node scripts/aggregate-diagnosis-matrix.mjs --explorer-out src/data/compatibility.ts diagnosis-reports"

0 commit comments

Comments
 (0)