openvibers/openvibe.community Commits

Relay cursors: drop the numeric cursor and latest_seq (contract after 0007; nothing has written or read them since 2026-10-10) (#99)

OP OpenVibers committed 26 days ago · 8012c68d0d · 2 files, +12 −3

Changes

ddiff --git a/migrations/0010_drop_relay_cursor_numeric.sql b/migrations/0010_drop_relay_cursor_numeric.sql
nnew file mode 100644
iindex 0000000..7093c17
---- /dev/null
++++ b/migrations/0010_drop_relay_cursor_numeric.sql
@@@ -0,0 +1,7 @@
++-- phase: contract
++-- after: 0007
++-- The Discord relay's Events worker keeps its place only as Events' opaque cursor (`position`, 0006). Since 0007
++-- (2026-10-10) nothing writes the numeric `cursor` or `latest_seq` and nothing reads them (Events no longer answers
++-- numeric positions, plan T7), and the release before this one already ran without them. This drops both columns.
++ALTER TABLE relay_cursors DROP COLUMN IF EXISTS cursor;
++ALTER TABLE relay_cursors DROP COLUMN IF EXISTS latest_seq;
ddiff --git a/test/relay-events.test.js b/test/relay-events.test.js
iindex f5ed7b3..fefd596 100644
---- a/test/relay-events.test.js
++++ b/test/relay-events.test.js
@@@ -74,7 +74,9 @@ const postEvent = (p, t, visibility = 'public') => envelope('community.post.crea
assert.ok(st.started_at_head, 'it says it started at the head');
assert.ok(!('cursor' in st) && !('lag' in st) && !('latest_seq' in st), 'no numeric position in the status');
assert.strictEqual((await deliveries()).length, 0);
-- assert.deepStrictEqual(await db.prepare('SELECT name, cursor, position FROM relay_cursors').all(), [{ name: CURSOR, cursor: null, position: events.encode(3) }], 'the head, stored as the opaque latest_cursor and nothing numeric');
++ assert.deepStrictEqual(await db.prepare('SELECT * FROM relay_cursors').all().then((rows) => rows.map(({ name, position }) => ({ name, position }))), [{ name: CURSOR, position: events.encode(3) }], 'the head, stored as the opaque latest_cursor');
++ const cols = (await db.prepare("SELECT column_name FROM information_schema.columns WHERE table_name = 'relay_cursors' ORDER BY column_name").all()).map((r) => r.column_name);
++ assert.deepStrictEqual(cols, ['name', 'position', 'updated_at'], 'no numeric position column is left (migration 0010)');
assert.ok(events.calls.every((c) => !/after_seq/.test(c.path)), 'no numeric position is ever sent');
before = events.calls.length;
});
@@@ -145,8 +147,8 @@ const postEvent = (p, t, visibility = 'public') => envelope('community.post.crea
assert.strictEqual((await worker.status()).last_error, null);
});
-- await check('a row with no position (a numeric one only) starts at the head: a number is never read as a place', async () => {
-- await db.prepare('UPDATE relay_cursors SET cursor = 3, position = NULL WHERE name = ?').run(CURSOR);
++ await check('a row with no position starts at the head', async () => {
++ await db.prepare('UPDATE relay_cursors SET position = NULL WHERE name = ?').run(CURSOR);
const t5 = await newThread('Before the restart at the head');
events.add(threadEvent(t5));
const from = events.calls.length;