fix(broker): topic_create no longer rejects on creator-seal failure
A bad ed25519 pubkey on the creator member (legacy data) made sealTopicKeyForMember throw, which propagated up through createTopic and made the WS topic_create handler never send a topic_created frame. CLI saw a 5s timeout and printed 'topic create failed'. Wraps the seal call in try/catch — topic creation succeeds even if no copy gets sealed for the creator. They'll see GET /v1/topics/:name/key return 404 until they re-seal (or a holder does it for them via the phase-3 background loop). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -593,13 +593,23 @@ export async function createTopic(args: {
|
||||
if (!row) throw new Error("failed to create topic");
|
||||
|
||||
// Seal a copy for the creator immediately. Other members get sealed
|
||||
// copies as they join via joinTopic().
|
||||
// copies as they join (re-seal flow). Wrap in try/catch so a seal
|
||||
// failure (bad pubkey, transient DB error) doesn't roll back topic
|
||||
// creation — the user can re-seal later.
|
||||
if (args.createdByMemberId) {
|
||||
await sealTopicKeyForMember({
|
||||
topicId: row.id,
|
||||
memberId: args.createdByMemberId,
|
||||
bundle: topicKeyBundle,
|
||||
});
|
||||
try {
|
||||
await sealTopicKeyForMember({
|
||||
topicId: row.id,
|
||||
memberId: args.createdByMemberId,
|
||||
bundle: topicKeyBundle,
|
||||
});
|
||||
} catch (err) {
|
||||
// Topic exists but no key sealed for the creator. They'll get
|
||||
// 404 on GET /key until another holder re-seals. Phase-3 flow
|
||||
// handles this for any member, including the creator.
|
||||
// Silent in-band — the topic create itself succeeded.
|
||||
void err;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user