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)
Changes
nnew file mode 100644@@@ -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;@@@ -74,7 +74,9 @@ const postEvent = (p, t, visibility = 'public') => envelope('community.post.creaassert.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.creaassert.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;
new file mode 100644
new file mode 100644
@@ -0,0 +1,7 @@
@@ -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;
@@ -74,7 +74,9 @@ const postEvent = (p, t, visibility = 'public') => envelope('community.post.crea
@@ -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(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.ok(!('cursor' in st) && !('lag' in st) && !('latest_seq' in st), 'no numeric position in the status');
assert.strictEqual((await deliveries()).length, 0);
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');
assert.ok(events.calls.every((c) => !/after_seq/.test(c.path)), 'no numeric position is ever sent');
before = events.calls.length;
before = events.calls.length;
});
});
@@ -145,8 +147,8 @@ const postEvent = (p, t, visibility = 'public') => envelope('community.post.crea
@@ -145,8 +147,8 @@ const postEvent = (p, t, visibility = 'public') => envelope('community.post.crea
assert.strictEqual((await worker.status()).last_error, null);
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');
const t5 = await newThread('Before the restart at the head');
events.add(threadEvent(t5));
events.add(threadEvent(t5));
const from = events.calls.length;
const from = events.calls.length;