Skip to content

Commit c56df37

Browse files
authored
Merge pull request #162 from paritytech/pg/runnable-api-doc-examples
2 parents e8e9f5f + 5187fb5 commit c56df37

34 files changed

Lines changed: 1277 additions & 1008 deletions

Makefile

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

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

88
TRUAPI_PKG := js/packages/truapi
99
PLAYGROUND := playground
10+
EXPLORER := explorer
1011

1112
help: ## Show this help.
1213
@awk 'BEGIN { FS = ":.*##"; printf "Usage: make <target>\n\nTargets:\n" } \
@@ -41,3 +42,9 @@ playground: ## Refresh the playground's @parity/truapi snapshot and rebuild.
4142
cd $(TRUAPI_PKG) && npm run build
4243
cd $(PLAYGROUND) && rm -rf node_modules/@parity && yarn install
4344
cd $(PLAYGROUND) && yarn build
45+
46+
matrix: ## Regenerate the host compatibility matrix from explorer/diagnosis-reports.
47+
cd $(EXPLORER) && npm run generate-matrix
48+
49+
explorer: ## Run the explorer dev server standalone at http://localhost:5181.
50+
cd $(EXPLORER) && npx vite --base / --port 5181

explorer/.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@ dist
33
*.tsbuildinfo
44
.vite
55
.DS_Store
6-
7-
# Diagnosis reports waiting to be aggregated. The aggregated source-of-truth
8-
# at src/data/compatibility.ts is committed; the per-host inputs are not.
9-
pending-reports/*.md

explorer/README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,30 @@ The **Compatibility** page (`/v/<version>/compatibility`) renders a host × meth
88

99
### Updating the matrix
1010

11-
1. **Collect reports.** For each host you want covered, 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`).
12-
2. **Drop them in.** Place every `*.md` into [`pending-reports/`](pending-reports/).
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.
1313
3. **Regenerate.** From the `explorer/` directory:
1414

1515
```bash
1616
npm run generate-matrix
1717
```
1818

19-
That rewrites `src/data/compatibility.ts` from the reports and deletes the consumed inputs from `pending-reports/`. 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` so the published matrix reflects the new run. The reports themselves are gitignored — only the aggregate is checked in.
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.
2121

2222
### Data shape
2323

24-
[`src/data/compatibility-types.ts`](src/data/compatibility-types.ts) holds the schema. Each method row carries one `pass | fail | null` entry per host column; `null` means the method was absent from that host's report (typically a method added after the report was taken). Columns are labelled by host mode (`Web` / `Desktop`); when two reports share a mode, the filename disambiguates the label.
24+
[`src/data/compatibility-types.ts`](src/data/compatibility-types.ts) holds the schema. Each method row carries one `pass | fail | null` entry per host column; `null` means the method was absent from (or skipped in) that host's report. Methods with no measurement on any host are dropped from the matrix. Columns are labelled by host mode (`Web` / `Desktop` / `Android` / `iOS`); when two reports share a mode, the filename disambiguates the label.
2525

2626
### Standalone CLI
2727

2828
The aggregator can be invoked directly:
2929

3030
```bash
3131
node scripts/aggregate-diagnosis-matrix.mjs web.md desktop.md # markdown preview to stdout
32-
node scripts/aggregate-diagnosis-matrix.mjs --explorer-out src/data/compatibility.ts --consume pending-reports
32+
node scripts/aggregate-diagnosis-matrix.mjs --explorer-out src/data/compatibility.ts diagnosis-reports
3333
```
3434

3535
Flags:
3636

3737
- `--explorer-out <file>` — write the TypeScript matrix module instead of stdout markdown.
38-
- `--consume` — delete the input report files **after** a successful write.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
## Truapi Android Diagnosis
2+
3+
_Generated: 2026-06-02T13:24:09.016Z_
4+
5+
| Method | Status | Details |
6+
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------- |
7+
| `Account/connection_status_subscribe` || |
8+
| `Account/get_account` || |
9+
| `Account/get_account_alias` || |
10+
| `Account/create_account_proof` || { "tag": "Unknown", "value": { "reason": "Not implemented" } } |
11+
| `Account/get_legacy_accounts` || |
12+
| `Account/get_user_id` || { "tag": "Unknown", "value": { "reason": "Not implemented" } } |
13+
| `Account/request_login` || |
14+
| `Chain/follow_head_subscribe` || |
15+
| `Chain/get_head_header` || |
16+
| `Chain/get_head_body` || |
17+
| `Chain/get_head_storage` || |
18+
| `Chain/call_head` || |
19+
| `Chain/unpin_head` || |
20+
| `Chain/continue_head` || |
21+
| `Chain/stop_head_operation` || |
22+
| `Chain/get_spec_genesis_hash` || |
23+
| `Chain/get_spec_chain_name` || |
24+
| `Chain/get_spec_properties` || |
25+
| `Chain/broadcast_transaction` || |
26+
| `Chain/stop_transaction` || |
27+
| `Chat/create_room` || timed out after 10s |
28+
| `Chat/register_bot` || { "tag": "Unknown", "value": { "reason": "Not implemented" } } |
29+
| `Chat/list_subscribe` || subscription delivered no events in 6s |
30+
| `Chat/post_message` || { "tag": "Unknown", "value": { "reason": "Error: Unknown method: chatSendTextMessage" } } |
31+
| `Chat/action_subscribe` || subscription delivered no events in 6s |
32+
| `Chat/custom_message_render_subscribe` || subscription delivered no events in 6s |
33+
| `Entropy/derive` || |
34+
| `Local Storage/read` || |
35+
| `Local Storage/write` || |
36+
| `Local Storage/clear` || |
37+
| `Notifications/send_push_notification` || |
38+
| `Notifications/cancel_push_notification` || |
39+
| `Payment/balance_subscribe` || |
40+
| `Payment/top_up` || |
41+
| `Payment/request` || request failed: { "tag": "InsufficientBalance" } |
42+
| `Payment/status_subscribe` || request failed: { "tag": "InsufficientBalance" } |
43+
| `Permissions/request_device_permission` || |
44+
| `Permissions/request_remote_permission` || |
45+
| `Preimage/lookup_subscribe` || |
46+
| `Preimage/submit` || timed out after 10s |
47+
| `Resource Allocation/request` || |
48+
| `Signing/create_transaction` || { "tag": "Unknown", "value": { "reason": "Error: Internal error: User rejected" } } |
49+
| `Signing/create_transaction_with_legacy_account` || { "tag": "Unknown", "value": { "reason": "Not implemented" } } |
50+
| `Signing/sign_raw_with_legacy_account` || { "tag": "Unknown", "value": { "reason": "Not implemented" } } |
51+
| `Signing/sign_payload_with_legacy_account` || { "tag": "Unknown", "value": { "reason": "Not implemented" } } |
52+
| `Signing/sign_raw` || |
53+
| `Signing/sign_payload` || |
54+
| `Statement Store/subscribe` || subscription delivered no events in 6s |
55+
| `Statement Store/create_proof` || |
56+
| `Statement Store/submit` || submit failed: { "reason": "Error: Internal error: Fatal statement store submission error: Invalid(BadProof)" } |
57+
| `Statement Store/create_proof_authorized` || |
58+
| `System/handshake` || |
59+
| `System/feature_supported` || |
60+
| `System/navigate_to` || |
61+
| `Theme/subscribe` || |

0 commit comments

Comments
 (0)