From 40c0405088de315c80641dafe6d60cf2241ad324 Mon Sep 17 00:00:00 2001 From: Rinse Date: Tue, 20 Oct 2026 16:24:47 +0000 Subject: [PATCH] chore(deps): upgrade @pkcprotocol/pkc-js to 0.0.118 --- docs/challenges.md | 3 ++- package-lock.json | 8 ++++---- package.json | 2 +- test/cli/challenge-integration.test.ts | 12 +++++------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/challenges.md b/docs/challenges.md index b23a2fb..680c9b0 100644 --- a/docs/challenges.md +++ b/docs/challenges.md @@ -108,7 +108,7 @@ or pass --force to remove it anyway (those communities reject every publication Otherwise it deletes the directory and reloads the daemon. -The reason: pkc-js can't load a challenge whose name is no longer registered. A running community keeps advertising the old challenge but rejects every publication (`One of the community challenges is misconfigured`), and on its next start (including a daemon restart) `start()` throws and the community stays offline until its settings are changed. +The reason: pkc-js can't load a challenge whose name is no longer registered. A running community keeps advertising the old challenge and stays up, but rejects every publication (`One of the community challenges is misconfigured: challenge "" is not registered on this node`) and emits `ERR_COMMUNITY_CHALLENGES_FAILED_TO_LOAD`. On its next start (including a daemon restart) `start()` fails with `ERR_COMMUNITY_CHALLENGES_FAILED_TO_LOAD` and the community stays offline until its settings are changed or the package is installed again. - **Only `name` entries count.** An entry with a `path` loads that file, so it doesn't use the package. - **A package named after a pkc-js built-in** (`question`, `text-math`, `fail`, `blacklist`, `whitelist`, `publication-match`) is refused the same way. Removing it hands the built-in back, so nothing breaks, but those communities switch to the built-in challenge. The refusal says so. @@ -120,6 +120,7 @@ The reason: pkc-js can't load a challenge whose name is no longer registered. A - **Install fails with "No valid package.json found in the archive":** the spec did not produce an npm package tarball. - **Install fails validation:** the default export is not a challenge factory. A page sort package belongs under `bitsocial page-sort install`. - **Daemon log `Failed to load challenge ""`:** the package is installed but its entry point throws on import. It is left out of the registry until fixed. A previously loaded version keeps serving. +- **A community fails to start with `ERR_COMMUNITY_CHALLENGES_FAILED_TO_LOAD`** (publishers see `challenge "" is not registered on this node`): an entry in its `settings.challenges` names a challenge this daemon doesn't have, usually a package that was removed with `--force` or never installed on this node. The error's `details.failures` lists each entry and `details.availableChallengeNames` lists what is registered. Reinstall the package with `bitsocial challenge install`, or change the entry with `bitsocial community edit`, then start the community again (`bitsocial community start
`). - **`install` printed no `reloaded ...` line:** no daemon answered at `--pkcRpcUrl`. Pass the URL the daemon actually listens on, including the auth key path for a remote daemon, or restart the daemon. ## Writing a challenge package diff --git a/package-lock.json b/package-lock.json index 0de4a19..b907198 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@oclif/plugin-help": "6.2.36", "@oclif/plugin-not-found": "3.2.73", "@oclif/table": "0.5.1", - "@pkcprotocol/pkc-js": "0.0.115", + "@pkcprotocol/pkc-js": "0.0.118", "dataobject-parser": "1.2.22", "decompress": "4.2.1", "env-paths": "2.2.1", @@ -7244,9 +7244,9 @@ } }, "node_modules/@pkcprotocol/pkc-js": { - "version": "0.0.115", - "resolved": "https://registry.npmjs.org/@pkcprotocol/pkc-js/-/pkc-js-0.0.115.tgz", - "integrity": "sha512-Q+sIB6Sf3nM3onfsVNtwJWASpRQhgJp7AT9i1zKrf6toIFmy7ujwB9L0LCvpxtQxRLxEL7bAW8S1W/D0HWTFgQ==", + "version": "0.0.118", + "resolved": "https://registry.npmjs.org/@pkcprotocol/pkc-js/-/pkc-js-0.0.118.tgz", + "integrity": "sha512-mZ5PE9R7BZdP6Be2ehgJAF0VIugvkUJBwutBw1Fh2mQqRZpfSoxOufQznADbe8zc68pYH9dS5XYOGMfV+IsZ6w==", "license": "GPL-3.0-or-later", "dependencies": { "@enhances/with-resolvers": "0.0.5", diff --git a/package.json b/package.json index 63f2567..2c51e34 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "@oclif/plugin-help": "6.2.36", "@oclif/plugin-not-found": "3.2.73", "@oclif/table": "0.5.1", - "@pkcprotocol/pkc-js": "0.0.115", + "@pkcprotocol/pkc-js": "0.0.118", "dataobject-parser": "1.2.22", "decompress": "4.2.1", "env-paths": "2.2.1", diff --git a/test/cli/challenge-integration.test.ts b/test/cli/challenge-integration.test.ts index 4d96177..67137f8 100644 --- a/test/cli/challenge-integration.test.ts +++ b/test/cli/challenge-integration.test.ts @@ -545,8 +545,8 @@ describe("challenge integration tests", { timeout: 600_000 }, () => { const sub = await pkc.createCommunity(); await sub.edit({ settings: { challenges: [{ name }] } }); - // Once the package is gone, pkc-js with pkcprotocol/pkc-js#429 emits ERR_COMMUNITY_CHALLENGES_FAILED_TO_LOAD - // on the running community; an unhandled "error" event would throw + // Once the package is gone, pkc-js emits ERR_COMMUNITY_CHALLENGES_FAILED_TO_LOAD on the running community + // (pkcprotocol/pkc-js#429); an unhandled "error" event would throw sub.on("error", () => {}); await sub.start(); expect(await waitForCondition(() => !!(sub as any).updatedAt, 60000, 500)).toBe(true); @@ -559,16 +559,14 @@ describe("challenge integration tests", { timeout: 600_000 }, () => { expect(sub.challenges).toEqual([{ challenge: "7+7", type: "text/plain" }]); const result = await publishCommentWithChallenge({ pkc, communityAddress: sub.address, challengeAnswer: "14" }); expect(result.challengeSuccess).toBe(false); - expect(result.reason).toContain("One of the community challenges is misconfigured"); + expect(result.reason).toContain(`One of the community challenges is misconfigured: challenge "${name}" is not registered on this node`); // A restart (or a daemon restart) can't load the challenge, so the community goes offline. pkc-js keeps that - // on purpose but names the error (pkcprotocol/pkc-js#429): once a release with it is installed, start() - // rejects with ERR_COMMUNITY_CHALLENGES_FAILED_TO_LOAD and the publish reason above names the challenge, so - // update these assertions in that bump + // on purpose and names the error (pkcprotocol/pkc-js#429) await sub.stop(); const restarted = await pkc.createCommunity({ address: sub.address }); restarted.on("error", () => {}); - await expect(restarted.start()).rejects.toThrow(/expected function, received undefined/); + await expect(restarted.start()).rejects.toMatchObject({ code: "ERR_COMMUNITY_CHALLENGES_FAILED_TO_LOAD" }); expect(await waitForCondition(() => restarted.startedState === "failed", 20000, 200)).toBe(true); }); });