Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@ jobs:
# this whole workaround once sphere-sdk publishes v0.7.1+ to npm
# with the post-extraction exports.
env:
SPHERE_SDK_SHA: 0e3290a1e3f41e3d30ca9f6a02b304da507106c7
# Bumped to the merge commit of sphere-sdk PR #415 (issue #42) —
# `registerNametag` now publishes the Nostr binding fire-and-
# forget by default, so `Sphere.init({ nametag })` returns in
# mint-only time instead of blocking on a flaky / stalled
# relay. Required by the 180s timeout reduction in
# `cli-wallet-lifecycle.integration.test.ts` (this PR). The
# merge commit also carries the review-driven correctness
# fixes for the detached publish handler (switchToAddress
# context snapshot, destroy-guard).
SPHERE_SDK_SHA: cc14f3cd1356720e056a35a5218a28ca7586831a
run: |
git clone https://github.com/unicity-sphere/sphere-sdk.git ../../sphere-sdk
# The pinned SHA may not be on a branch tip after future merges;
Expand Down
21 changes: 19 additions & 2 deletions test/integration/cli-wallet-lifecycle.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,20 @@ describe.skipIf(integrationSkip)(
afterAll(() => { if (env) destroySphereEnv(env); });

it(`\`sphere init --nametag ${nametag}\` mints the nametag during wallet creation`, () => {
// Budget rationale (issue #42 acceptance criterion 3):
// 240s → 180s. The slack was originally provisioned to absorb a
// stalled Nostr publish during `Sphere.init({ nametag })` — under
// sphere-sdk's pre-#42 in-band publish contract, a flaky
// `nostr-relay.testnet.unicity.network` could swallow 60s+ of
// the budget BEFORE the test could see the identity block.
// sphere-sdk #42's `publishMode: 'background'` default detaches
// that publish (see `Sphere.registerNametag` step 4), so the
// only in-band work left is the aggregator mint round-trip,
// which comfortably finishes inside 180s even under load.
const r = runSphere(
env,
['init', '--network', 'testnet', '--nametag', nametag],
{ timeoutMs: 240_000 },
{ timeoutMs: 180_000 },
);
if (r.status !== 0) {
console.error('init --nametag failed', { stdout: r.stdout, stderr: r.stderr });
Expand All @@ -302,10 +312,17 @@ describe.skipIf(integrationSkip)(
// ` nametag : @<name>`
// (renderIdentity prepends `@` to the nametag value; absent
// nametags show `(none)`).
//
// The `(none)` failure mode that originally motivated this test
// (issue #42) is foreclosed by sphere-sdk #42 — the SDK now
// updates `_identity.nametag` synchronously after the mint
// succeeds, BEFORE returning from `registerNametag`, so the
// CLI's `sphere.identity` read at `legacy-cli.ts:2294` always
// sees the just-claimed name.
expect(r.stdout).toMatch(new RegExp(`nametag\\s*:\\s*@${nametag}`));
// The wallet directory now exists on disk.
expect(existsSync(join(env.home, '.sphere-cli', 'wallet.json'))).toBe(true);
}, 300_000);
}, 200_000);

it('`sphere nametag my` reports the registered nametag after init --nametag', () => {
// Re-verify via a different code path: read the nametag via the
Expand Down
Loading