Submissions persistence: publish to nos.lol + admin re-broadcast mirror

Submissions are signed by throwaway ephemeral keys and public relays prune
events from pubkeys with no social graph, so the queue quietly evaporated.

- Forms: also publish to nos.lol (better retention, already in the app's
  query set) alongside snort/damus/primal.
- submissionFacade: on each fetch, re-broadcast the still-pending signed
  events back to our relays (publishEventToRelays) so pruning doesn't drop
  them. Best-effort, fire-and-forget — never blocks or fails the fetch;
  no-ops when no relay pool is available.
- test: fetch still returns the pending queue when a pool is present.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.8 committed 2026-07-07 15:48:48 -04:00
1 parent d091ce8bac
commit 5eb7545a3f
7 files changed
+51 -1

No files matched your search

+13
View File
@@ -94,6 +94,19 @@ test("fetchPendingSubmissions returns pending, excludes resolved, dedupes by app
assert.equal(alice.id, "s2", "newest application for alice wins");
});
test("fetchPendingSubmissions still returns pending when a pool is present (mirror is best-effort)", async () => {
const events = [
submissionEvent({ id: "m1", applicant: "npub-x", created_at: 100 }),
];
const client = mockClient({ events });
// Presence of a pool triggers the re-broadcast mirror path; any publish
// failure is swallowed and must not affect the returned queue.
client.pool = {};
const pending = await fetchPendingSubmissions({ adminHex: ADMIN, client });
assert.equal(pending.length, 1);
assert.equal(pending[0].applicant, "npub-x");
});
test("fetchPendingSubmissions returns [] for a blank admin or no relays", async () => {
assert.deepEqual(await fetchPendingSubmissions({ adminHex: "", client: mockClient({}) }), []);
const noRelays = { ...mockClient({}), relays: [] };