aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-26 08:35:54 -0700
committerAdam Soltys <[email protected]>2026-10-26 08:35:54 -0700
commitef1739e2de914f0a02990979f13057cef77c9a44 (patch)
tree3aa55a4bf96a13ebf208b549996d549043e4eb9c /tools
parent85399e5f2a303155a9b437712aed08d62fbc8776 (diff)
downloadcoinosv3-ef1739e2de914f0a02990979f13057cef77c9a44.tar.gz
coinosv3-ef1739e2de914f0a02990979f13057cef77c9a44.zip
A released placeholder address on your profile page shows as the claimed one on the Lightning line too, and Save in the profile editor repoints it in the kind 0 (a same-domain name that no longer answers); the background heal steps aside for an interactive signer (Amber) instead of waiting forever in the kind-0 queue
Jarryd's page still showed [email protected] over ⚡ [email protected]: the header only substituted the NIP-05 line, and his kind 0 was never republished — the heal of ce96364 needs a background signature, which an Amber sign-in can't give, and Save left a lud16 that wasn't the old address alone. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'tools')
-rw-r--r--tools/profile-publish-race-test.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/profile-publish-race-test.js b/tools/profile-publish-race-test.js
index 390c01b..becf375 100644
--- a/tools/profile-publish-race-test.js
+++ b/tools/profile-publish-race-test.js
@@ -67,9 +67,10 @@ const wallet = {
loadFeatureState: () => null, saveFeatureState: () => {},
_cacheKey: () => 'race-test', saveCache: () => {}, registerCacheExtension: () => {}, registerLoadHook: () => {},
};
+let namesAddr = null; // what the registrar says our address is
const feature = messagesFeature({
h: (tag, attrs, ...kids) => ({ tag, attrs, kids }), ui: {}, render: () => {}, wallet, toast: () => {}, brandHeader: () => null,
- hook: (name) => (name === 'nostrLoginIdentity' ? { pubkey: pk, signer } : null),
+ hook: (name) => (name === 'nostrLoginIdentity' ? { pubkey: pk, signer } : name === 'namesAddress' ? namesAddr : null),
});
console.log('[the migration: rename and avatar import fired together]');
@@ -91,5 +92,20 @@ await Promise.all([feature.addressRenamed('[email protected]', '[email protected]'),
const last = JSON.parse(store.filter((e) => e.kind === 0 && e.pubkey === pk).sort((a, b) => b.created_at - a.created_at)[0].content);
check('both changes survive', last.lud16 === '[email protected]' && last.about === 'hi' && /face/.test(last.picture), JSON.stringify(last));
+console.log('[Save in the editor repoints a dead same-domain address]');
+// The heal never ran (an Amber user: no background signatures), so the kind 0
+// still names the released placeholder. The domain says jar is dead, other
+// is alive.
+store.push(finalizeEvent({ kind: 0, created_at: now + 1000, tags: [], content: JSON.stringify({ name: 'Jarryd', lud16: '[email protected]', nip05: '[email protected]' }) }, sk));
+namesAddr = '[email protected]';
+globalThis.fetch = async (url) => /lnurlp\/jar$/.test(url)
+ ? { ok: false, status: 500, json: async () => null }
+ : { ok: true, status: 200, json: async () => ({ tag: 'payRequest', callback: 'https://x/cb' }) };
+published.length = 0;
+await feature.saveProfileDraft({ uname: 'jarryd', name: 'Jarryd' });
+const saved = JSON.parse(published.filter((e) => e.kind === 0).pop().content);
+check('the dead placeholder moves to the claimed address', saved.lud16 === '[email protected]', JSON.stringify(saved));
+check('a same-domain address that still answers is left alone', saved.nip05 === '[email protected]', saved.nip05);
+
console.log(fails ? `\n❌ ${fails} failing` : '\n✅ kind-0 publishes take turns');
process.exit(fails ? 1 : 0);