Harden conversation replies and prioritize newest candidates
This commit is contained in:
1 parent
f98c5c732d
commit
b8e4a1bb88
23 files changed
+598
-113
No files matched your search
@@ -121,13 +121,26 @@ describe('account-bound domain repositories', () => {
|
||||
expect(claims.getClaim('room', 'event')).toEqual({
|
||||
conversationId: 'room', incomingKey: 'event', status: 'pending',
|
||||
replyText: 'durable reply', incomingAt: 50, claimedAt: 60,
|
||||
lastAttemptAt: 70, attemptCount: 1, sentAt: null,
|
||||
lastAttemptAt: 70, attemptCount: 1, sentAt: null, supersededAt: null,
|
||||
});
|
||||
expect(claims.listPending()).toEqual([expect.objectContaining({ incomingKey: 'event' })]);
|
||||
expect(claims.releasePending('room', 'event')).toBe(true);
|
||||
expect(claims.listPending()).toEqual([]);
|
||||
});
|
||||
|
||||
it('keeps superseded reply claims as an auditable terminal record', () => {
|
||||
const claims = new ConversationAutomationClaimRepository(db, ACCOUNT_A);
|
||||
expect(claims.tryClaim('room', 'stale-event', 'stale reply', 50, 60)).toBe(true);
|
||||
|
||||
expect(claims.markSuperseded('room', 'stale-event', 80)).toBe(true);
|
||||
expect(claims.getClaim('room', 'stale-event')).toMatchObject({
|
||||
status: 'superseded',
|
||||
supersededAt: 80,
|
||||
sentAt: null,
|
||||
});
|
||||
expect(claims.listPending()).toEqual([]);
|
||||
});
|
||||
|
||||
it('claims recipients globally and blocks usernames with existing chat history', () => {
|
||||
db.prepare(`
|
||||
INSERT INTO reddit_conversations (
|
||||
|
||||
Reference in new issue
Block a user