feat: Unraid deploy, dealer-flow heatmap, confluence zones, 13F capture
Ship Node production images, Unraid compose, and Gitea CI/CD (test then push registry images; cron script if no runner). Rebuild dealer flow as a heatmap-first map with integrity gates and chart helpers. Add confluence zone rules, session clock, capture evidence, and tighter 13F/queue/options paths, plus the matching UI and tests.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import { test } from 'node:test';
|
||||
import { strict as assert } from 'node:assert';
|
||||
import { DatabaseSync } from 'node:sqlite';
|
||||
import {
|
||||
annotateCaptureEvidence,
|
||||
evidencePostId,
|
||||
isTweetGoneMessage,
|
||||
} from '../captureEvidence.ts';
|
||||
|
||||
test('evidencePostId extracts status id from x.com URL', () => {
|
||||
assert.equal(
|
||||
evidencePostId('https://x.com/mikealfred/status/2082901502113575384'),
|
||||
'2082901502113575384',
|
||||
);
|
||||
assert.equal(evidencePostId('sec|0002096493-26-000003'), null);
|
||||
});
|
||||
|
||||
test('isTweetGoneMessage matches bird / X not-found errors', () => {
|
||||
assert.equal(isTweetGoneMessage('Failed to read tweet: Tweet not found in response'), true);
|
||||
assert.equal(isTweetGoneMessage('HTTP 429 rate limit'), false);
|
||||
});
|
||||
|
||||
test('annotateCaptureEvidence uses cache and only looks up misses', async () => {
|
||||
const db = new DatabaseSync(':memory:');
|
||||
db.exec(`CREATE TABLE kv_cache (key TEXT PRIMARY KEY, value TEXT NOT NULL, observed_at TEXT NOT NULL)`);
|
||||
const now = Date.parse('2026-08-14T20:00:00.000Z');
|
||||
db.prepare('INSERT INTO kv_cache (key,value,observed_at) VALUES (?,?,?)').run(
|
||||
'x:post-status:111', 'ok', new Date(now).toISOString(),
|
||||
);
|
||||
const looked: string[] = [];
|
||||
const rows = [
|
||||
{ evidence_url: 'https://x.com/mikealfred/status/111' },
|
||||
{ evidence_url: 'https://x.com/mikealfred/status/2082901502113575384' },
|
||||
];
|
||||
await annotateCaptureEvidence(db, rows, async (id) => {
|
||||
looked.push(id);
|
||||
return 'deleted';
|
||||
}, now);
|
||||
assert.deepEqual(looked, ['2082901502113575384']);
|
||||
assert.equal(rows[0].evidence_status, 'ok');
|
||||
assert.equal(rows[1].evidence_status, 'deleted');
|
||||
});
|
||||
|
||||
test('annotateCaptureEvidence live:false never calls lookup', async () => {
|
||||
const db = new DatabaseSync(':memory:');
|
||||
db.exec(`CREATE TABLE kv_cache (key TEXT PRIMARY KEY, value TEXT NOT NULL, observed_at TEXT NOT NULL)`);
|
||||
const looked: string[] = [];
|
||||
const rows = [{ evidence_url: 'https://x.com/mikealfred/status/2082901502113575384' }];
|
||||
await annotateCaptureEvidence(db, rows, async (id) => {
|
||||
looked.push(id);
|
||||
return 'ok';
|
||||
}, Date.now(), { live: false });
|
||||
assert.deepEqual(looked, []);
|
||||
assert.equal(rows[0].evidence_status, 'unknown');
|
||||
});
|
||||
Reference in New Issue
Block a user