@parity/product-deploy 0.10.0-rc.0 → 0.10.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/DEPLOYMENT.md +124 -0
  2. package/README.md +73 -6
  3. package/assets/environments.json +41 -0
  4. package/bin/bulletin-deploy +11 -16
  5. package/dist/allocations-CEPeZr6T.d.ts +111 -0
  6. package/dist/auth/index.d.ts +3 -2
  7. package/dist/auth/index.js +5 -1
  8. package/dist/auth/vendor/index.d.ts +3 -2
  9. package/dist/auth/vendor/index.js +5 -1
  10. package/dist/auth/vendor/ui/index.d.ts +2 -1
  11. package/dist/auth-CA_YKtM2.d.ts +128 -0
  12. package/dist/auth-config.d.ts +13 -8
  13. package/dist/auth-config.js +4 -4
  14. package/dist/bug-report.js +4 -4
  15. package/dist/{chunk-2BTYPNYW.js → chunk-4D6STP5G.js} +10 -2
  16. package/dist/{chunk-DHY2ZXVZ.js → chunk-5OKB3TEB.js} +8 -1
  17. package/dist/{chunk-DY7RVMM5.js → chunk-C74YSAWC.js} +64 -20
  18. package/dist/{chunk-MI5B3UCM.js → chunk-EHQPRWGC.js} +1 -1
  19. package/dist/{chunk-VR3LF62E.js → chunk-I7UEBFP5.js} +38 -12
  20. package/dist/{chunk-HUT626G6.js → chunk-LYWIW6WU.js} +1 -1
  21. package/dist/{chunk-GL3U7K2B.js → chunk-QRKI6MMK.js} +41 -0
  22. package/dist/{chunk-PKQOUCPD.js → chunk-SXWFDMFT.js} +5 -5
  23. package/dist/{chunk-GJTVPP7E.js → chunk-UJJQME5K.js} +1 -1
  24. package/dist/{chunk-G676QAN4.js → chunk-V5VD5CIC.js} +2 -2
  25. package/dist/{chunk-ZJCTG7HF.js → chunk-WM5R4O33.js} +4 -3
  26. package/dist/{chunk-Q3RIJ7PU.js → chunk-XX6LNB74.js} +3 -3
  27. package/dist/chunk-probe.js +3 -3
  28. package/dist/commands/login.d.ts +42 -6
  29. package/dist/commands/login.js +86 -34
  30. package/dist/commands/logout.d.ts +2 -1
  31. package/dist/commands/logout.js +6 -6
  32. package/dist/commands/transfer.js +5 -4
  33. package/dist/commands/whoami.d.ts +2 -1
  34. package/dist/commands/whoami.js +4 -4
  35. package/dist/deploy-actors.d.ts +3 -2
  36. package/dist/deploy-actors.js +6 -5
  37. package/dist/deploy.d.ts +13 -1
  38. package/dist/deploy.js +15 -10
  39. package/dist/dotns.d.ts +10 -4
  40. package/dist/dotns.js +5 -4
  41. package/dist/environments.js +1 -1
  42. package/dist/index.js +12 -11
  43. package/dist/manifest/publish.js +12 -11
  44. package/dist/memory-report.js +2 -2
  45. package/dist/merkle.js +11 -10
  46. package/dist/personhood/bootstrap.js +6 -6
  47. package/dist/personhood/people-client.js +5 -4
  48. package/dist/run-state.js +1 -1
  49. package/dist/{signer-vR6KKC7V.d.ts → signer-Duup0hgQ.d.ts} +1 -1
  50. package/dist/sss-allowance-cache.js +5 -5
  51. package/dist/storage-signer.js +11 -10
  52. package/dist/telemetry.d.ts +17 -1
  53. package/dist/telemetry.js +4 -2
  54. package/dist/version-check.js +3 -3
  55. package/docs/bootstrap.md +1 -1
  56. package/docs/e2e-bootstrap.md +34 -12
  57. package/docs/telemetry.md +10 -11
  58. package/docs/testing.md +2 -0
  59. package/package.json +4 -3
  60. package/dist/auth-C-Pel0AT.d.ts +0 -235
package/docs/telemetry.md CHANGED
@@ -4,8 +4,13 @@ Telemetry is **off by default for external users**. It is enabled automatically
4
4
 
5
5
  ## Opt in / opt out
6
6
 
7
- - `BULLETIN_DEPLOY_TELEMETRY=1`: explicit opt-in
8
- - `BULLETIN_DEPLOY_TELEMETRY=0`: force off
7
+ Telemetry is **off by default** for external users. It is only enabled automatically when running in a known Parity/internal context (see detection signals below), or via explicit opt-in.
8
+
9
+ - `BULLETIN_DEPLOY_TELEMETRY=1`: explicit opt-in — also overrides `DO_NOT_TRACK`
10
+ - `BULLETIN_DEPLOY_TELEMETRY=0` or `BULLETIN_DEPLOY_TELEMETRY=off`: force off
11
+ - `DO_NOT_TRACK=1`: telemetry is disabled (standard EFF Do Not Track convention); overridden only by an explicit `BULLETIN_DEPLOY_TELEMETRY=1`
12
+
13
+ Precedence (highest to lowest): explicit opt-out → explicit opt-in → DO_NOT_TRACK → internal context detection → default off.
9
14
 
10
15
  Internal detection signals are OR'd together:
11
16
 
@@ -32,7 +37,7 @@ BULLETIN_DEPLOY_HOST_APP=<your-app-name>
32
37
  BULLETIN_DEPLOY_HOST_APP_VERSION=<your-app-version>
33
38
  ```
34
39
 
35
- `BULLETIN_DEPLOY_HOST_APP_VERSION` is optional but recommended — it populates `deploy.host_app_version` on every span, enabling version-correlated triage in the dashboard.
40
+ `BULLETIN_DEPLOY_HOST_APP_VERSION` is optional but recommended — it populates `deploy.host_app_version` on every span, enabling version-correlated triage in your Sentry dashboard.
36
41
 
37
42
  That makes `bulletin-deploy` reuse the existing Sentry client instead of calling its own `Sentry.init()`.
38
43
 
@@ -49,14 +54,8 @@ Use `--tag` or `DEPLOY_TAG` to separate test and benchmark traffic from real dep
49
54
  Examples:
50
55
 
51
56
  ```bash
52
- bulletin-deploy --tag e2e-ci-pr ./build my-app.dot
57
+ bulletin-deploy --tag ci-smoke ./build my-app.dot
53
58
  DEPLOY_TAG=load-test bulletin-deploy ./build my-app.dot
54
59
  ```
55
60
 
56
- Common tags in this repo:
57
-
58
- - `e2e-ci-pr`
59
- - `e2e-ci-nightly`
60
- - `e2e-local-smoke`
61
- - `e2e-local-pr`
62
- - `e2e-local-nightly`
61
+ Use any label that distinguishes a class of deploy — for example, separating CI smoke runs, nightly runs, and load tests from real user traffic so they can be filtered apart in telemetry.
package/docs/testing.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Testing
2
2
 
3
+ > Contributor reference. The offline suite runs anywhere; everything past it needs testnet access — see [E2E test setup](./e2e-bootstrap.md) for the one-time chain setup.
4
+
3
5
  The repo has three practical test layers: offline unit tests, live-testnet E2E coverage, and GitHub Actions matrices that exercise the shipped reusable workflow.
4
6
 
5
7
  ## Offline tests
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parity/product-deploy",
3
- "version": "0.10.0-rc.0",
3
+ "version": "0.10.0-rc.2",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,6 +41,7 @@
41
41
  "docs",
42
42
  "assets",
43
43
  "patches",
44
+ "DEPLOYMENT.md",
44
45
  "tools/release-retry-wrapper.mjs"
45
46
  ],
46
47
  "scripts": {
@@ -48,7 +49,7 @@
48
49
  "refresh-environments": "node scripts/refresh-environments.mjs",
49
50
  "postinstall": "patch-package || true",
50
51
  "prepare": "npm run build",
51
- "test": "npm run build && node --test test/test.js test/cli-help.test.js test/helpers/e2e-helpers.test.js test/environments.test.js test/refresh-environments.test.js test/chunk-sharing-report.test.js test/product-manifest.test.js test/cache-savings-totals.test.js test/error-pattern-signature.test.js test/exit-codes.test.js test/probe-env-health.test.js test/e2e-chain-calls.test.js test/auth-config.test.js test/whoami.test.js test/login.test.js test/logout.test.js test/auth-resolve.test.js test/storage-signer.test.js test/spinner.test.js test/sss-allowance.test.js test/sss-allowance-cache.test.js test/dotns-transfer.test.js test/deploy-actors.test.js test/transfer-command.test.js test/dotns-register-fee.test.js && npm run test:vendor",
52
+ "test": "npm run build && node --test test/test.js test/cli-help.test.js test/helpers/e2e-helpers.test.js test/environments.test.js test/refresh-environments.test.js test/chunk-sharing-report.test.js test/product-manifest.test.js test/cache-savings-totals.test.js test/error-pattern-signature.test.js test/exit-codes.test.js test/probe-env-health.test.js test/e2e-chain-calls.test.js test/auth-config.test.js test/whoami.test.js test/login.test.js test/logout.test.js test/auth-resolve.test.js test/storage-signer.test.js test/spinner.test.js test/sss-allowance.test.js test/sss-allowance-cache.test.js test/dotns-transfer.test.js test/deploy-actors.test.js test/transfer-command.test.js test/dotns-register-fee.test.js test/deploy-label-ordering.test.js test/benign-teardown.test.js && npm run test:vendor",
52
53
  "test:e2e": "npm run build && node --test test/e2e.test.js",
53
54
  "test:e2e:smoke": "bash scripts/e2e-pass.sh smoke",
54
55
  "test:e2e:pr": "bash scripts/e2e-pass.sh pr",
@@ -62,7 +63,7 @@
62
63
  "@noble/hashes": "^1.7.2",
63
64
  "@parity/product-sdk-address": "^0.1.1",
64
65
  "@parity/product-sdk-keys": "^0.3.0",
65
- "@parity/product-sdk-terminal": "^0.3.1",
66
+ "@parity/product-sdk-terminal": "^0.4.0",
66
67
  "@parity/product-sdk-tx": "^0.2.4",
67
68
  "@polkadot-api/metadata-builders": "^0.14.2",
68
69
  "@polkadot-api/substrate-bindings": "^0.20.2",
@@ -1,235 +0,0 @@
1
- import { UserSession, TerminalAdapter } from '@parity/product-sdk-terminal';
2
- import { PolkadotSigner } from 'polkadot-api';
3
-
4
- /**
5
- * RFC-0010 resource allocation — thin wrapper over product-sdk-terminal's
6
- * host-runner facet. Lifted from playground-cli `src/utils/allowances/host.ts`
7
- * (issue #411).
8
- *
9
- * `@parity/product-sdk-terminal/host` exports `requestResourceAllocation(session,
10
- * adapter, resources, options?)` which handles:
11
- * - sending the AP request to the paired mobile wallet
12
- * - the `onExisting` policy (default auto-picks "Ignore" unless all requested
13
- * resources are already slot-table cached, then "Increase")
14
- * - caching granted key material to disk as `{appId}_AllowanceKeys.json`
15
- * (the same file our storage-signer reads — verified compat-stable in PR #855)
16
- *
17
- * Wire format (SCALE-derived, mirrors host-papp's
18
- * `dist/sso/sessionManager/scale/resourceAllocation.d.ts`):
19
- * request → { callingProductId, resources: AllocatableResource[], onExisting }
20
- * response → AllocationOutcome[] (one per resource, in order)
21
- *
22
- * The mobile app handles `hostRequestResourceAllocation` in
23
- * `AllowanceHostCalls.kt` and routes the user through an approval UI.
24
- */
25
-
26
- /**
27
- * Structural mirror of host-papp's `ApAllocatableResource` codec type. We
28
- * declare it locally because host-papp's package root doesn't re-export the
29
- * codec types yet — when it does (and product-sdk-terminal threads them
30
- * through) this can be replaced with a direct import.
31
- *
32
- * StatementStoreAllowance — write to the SSS (host_chat, allowance ring).
33
- * BulletInAllowance — write to Bulletin (TransactionStorage.store).
34
- * SmartContractAllowance — PGAS sponsoring for Revive contract calls.
35
- * The `value` is the derivation index of the
36
- * product account (0 for the default account).
37
- * AutoSigning — surrender the product-account signing key to
38
- * the host so it can sign on the user's behalf
39
- * without per-call prompts. Not used today.
40
- *
41
- * NOTE: host-api v0.8 renamed this variant to 'BulletinAllowance', but the
42
- * SSO resource-allocation codec (host-papp, which this path reaches via
43
- * product-sdk-terminal) retains the old 'BulletInAllowance' spelling as of
44
- * host-papp 0.8.5 / terminal 0.3.1. Ours must match the SSO codec — the
45
- * _SDK_COMPAT_PIN below fails the build if the SDK's spelling ever changes.
46
- */
47
- type AllocatableResource = {
48
- tag: "StatementStoreAllowance";
49
- value: undefined;
50
- } | {
51
- tag: "BulletInAllowance";
52
- value: undefined;
53
- } | {
54
- tag: "SmartContractAllowance";
55
- value: number;
56
- } | {
57
- tag: "AutoSigning";
58
- value: undefined;
59
- };
60
- /**
61
- * Outcome of one allocation. We don't read the inner `Allocated` payload
62
- * (allowance slot keys, derivation secrets) — the host stores them and uses
63
- * them transparently on subsequent calls. We just need the tag to know
64
- * whether the allocation succeeded.
65
- */
66
- type AllocationOutcome = {
67
- tag: "Allocated";
68
- value: unknown;
69
- } | {
70
- tag: "Rejected";
71
- value: undefined;
72
- } | {
73
- tag: "NotAvailable";
74
- value: undefined;
75
- };
76
- /** Tag-only view, handy for downstream code that doesn't care about payloads. */
77
- type ResourceTag = AllocatableResource["tag"];
78
- type OnExistingAllowancePolicy = "Ignore" | "Increase";
79
- /**
80
- * Default mobile-granted resource set for a CLI product account: write access
81
- * to the statement store + Bulletin, plus PGAS sponsoring for the default
82
- * (index 0) product account.
83
- */
84
- declare const DEFAULT_RESOURCES: AllocatableResource[];
85
- /**
86
- * Send a `host_request_resource_allocation` request over the user's active
87
- * session. The host (mobile wallet) prompts the user to approve and returns
88
- * one outcome per requested resource in order. Granted key material is cached
89
- * to disk by the terminal facet (`{appId}_AllowanceKeys.json`) so subsequent
90
- * calls (and the storage-signer reader) find it without a second wallet prompt.
91
- *
92
- * Throws on transport-level failures (Statement Store unreachable, encryption
93
- * error, etc.). Per-resource refusals are reported as `Rejected`/`NotAvailable`
94
- * outcomes — callers inspect the array to decide whether to proceed.
95
- *
96
- * `onExisting` is pinned to "Ignore": return existing cached keys if any, else
97
- * allocate a new slot. Auto-pick would give "Increase" when all slot-table
98
- * resources are already cached, which re-prompts the user unnecessarily.
99
- */
100
- declare function requestResourceAllocation(session: UserSession, adapter: TerminalAdapter, resources?: AllocatableResource[], onExisting?: OnExistingAllowancePolicy): Promise<AllocationOutcome[]>;
101
- interface AllocationSummary {
102
- granted: AllocatableResource[];
103
- rejected: AllocatableResource[];
104
- unavailable: AllocatableResource[];
105
- }
106
- /**
107
- * Bucket allocation outcomes by tag. Order-sensitive: `outcomes[i]` maps to
108
- * `resources[i]`. Outcomes without a matching resource are silently dropped.
109
- */
110
- declare function summarizeOutcomes(outcomes: AllocationOutcome[], resources: AllocatableResource[]): AllocationSummary;
111
-
112
- /**
113
- * Per-product configuration injected into `createAuthClient`. Lifting the
114
- * sign-in glue out of playground-cli (issue #411) means the env-specific
115
- * constants playground hard-coded in its `config.ts` (DAPP_ID, product id,
116
- * metadata URL, People-chain endpoints) become consumer-supplied so the same
117
- * package serves `playground` and `dot` (and future products) unchanged.
118
- */
119
- interface AuthConfig {
120
- /** The dApp identity string. Scopes the on-disk session namespace
121
- * (`~/.polkadot-apps/${dappId}_*`) and the SSO pairing — each product
122
- * gets its own, independently-revocable session. */
123
- dappId: string;
124
- /** Product id used to derive the product account (`/product/{productId}/{index}`). */
125
- productId: string;
126
- /** Derivation index of the product account (0 = default). */
127
- derivationIndex: number;
128
- /** Wallet-facing app name shown on the Sign-In screen (sent inline at pairing). */
129
- hostName: string;
130
- /** Host app version sent inline at pairing. */
131
- hostVersion: string;
132
- /** People-parachain RPC endpoints the terminal adapter connects to. */
133
- peopleEndpoints: string[];
134
- }
135
-
136
- /**
137
- * The three addresses we surface from a paired session.
138
- *
139
- * - `rootAddress` — SS58 of `session.rootAccountId`, the `rootUserAccountId`
140
- * the mobile app sent over the SSO handshake (bare-mnemonic sr25519 root on
141
- * current mobile builds). Keyed by `Resources.Consumers` on the People
142
- * parachain, so it's the right input for `lookupUsername`.
143
- * - `productAddress` — SS58 of the product account derived via
144
- * `product/{productId}/{index}` from `rootAccountId`. This is what actually
145
- * signs on-chain transactions from the CLI.
146
- * - `productH160` — the same product pubkey as a 20-byte EVM address (Revive /
147
- * contracts view). Derived from the SAME pubkey as `productAddress`.
148
- */
149
- interface SessionAddresses {
150
- rootAddress: string;
151
- productAddress: string;
152
- productH160: `0x${string}`;
153
- }
154
- type ConnectResult = {
155
- kind: "existing";
156
- address: string;
157
- addresses: SessionAddresses;
158
- } | {
159
- kind: "qr";
160
- qrCode: string;
161
- login: LoginHandle;
162
- };
163
- type LoginStatus = {
164
- step: "waiting";
165
- } | {
166
- step: "paired";
167
- } | {
168
- step: "pending";
169
- stage: string;
170
- } | {
171
- step: "success";
172
- address: string;
173
- addresses: SessionAddresses;
174
- } | {
175
- step: "error";
176
- message: string;
177
- };
178
- interface LoginHandle {
179
- adapter: TerminalAdapter;
180
- /** The authenticate() promise — already running since connect(). */
181
- authPromise: ReturnType<TerminalAdapter["sso"]["authenticate"]>;
182
- }
183
- /**
184
- * A session signer bundle — the signer plus an explicit `destroy()` that tears
185
- * down the long-lived adapter the signer depends on. Callers MUST invoke
186
- * `destroy()` once done — the WebSocket keeps the event loop alive.
187
- *
188
- * `adapter` is exposed so callers that need to send a host request (e.g.
189
- * `requestResourceAllocation`) can pass it without creating a second WebSocket.
190
- */
191
- interface SessionHandle {
192
- address: string;
193
- addresses: SessionAddresses;
194
- signer: PolkadotSigner;
195
- userSession: UserSession;
196
- adapter: TerminalAdapter;
197
- destroy(): void;
198
- }
199
- type LogoutStatus = {
200
- step: "disconnecting";
201
- address: string;
202
- } | {
203
- step: "success";
204
- address: string;
205
- } | {
206
- step: "partial";
207
- address: string;
208
- reason: string;
209
- } | {
210
- step: "error";
211
- message: string;
212
- };
213
- interface LogoutHandle {
214
- adapter: TerminalAdapter;
215
- address: string;
216
- session: UserSession;
217
- }
218
- /** The product-bound auth surface returned by `createAuthClient`. */
219
- interface AuthClient {
220
- connect(): Promise<ConnectResult>;
221
- waitForLogin(handle: LoginHandle, onStatus: (status: LoginStatus) => void): Promise<SessionHandle | null>;
222
- getSessionSigner(): Promise<SessionHandle | null>;
223
- findSession(): Promise<LogoutHandle | null>;
224
- waitForLogout(handle: LogoutHandle, onStatus: (status: LogoutStatus) => void): Promise<void>;
225
- requestAllocation(session: UserSession, adapter: TerminalAdapter, resources?: AllocatableResource[], onExisting?: OnExistingAllowancePolicy): Promise<AllocationOutcome[]>;
226
- clearLocalAppStorage(dir?: string): Promise<void>;
227
- }
228
- /**
229
- * Build an auth client bound to a product's `AuthConfig`. All adapter creation,
230
- * address derivation, and session-storage scoping read from `config`, so the
231
- * same code serves any product.
232
- */
233
- declare function createAuthClient(config: AuthConfig): AuthClient;
234
-
235
- export { type AllocatableResource as A, type ConnectResult as C, DEFAULT_RESOURCES as D, type LoginHandle as L, type OnExistingAllowancePolicy as O, type ResourceTag as R, type SessionAddresses as S, type AllocationOutcome as a, type AllocationSummary as b, type AuthClient as c, type AuthConfig as d, type LoginStatus as e, type LogoutHandle as f, type LogoutStatus as g, type SessionHandle as h, createAuthClient as i, requestResourceAllocation as r, summarizeOutcomes as s };