A minimal AT Protocol Personal Data Server written in JavaScript.
atproto pds
41
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: sort MST records by full key for correct byte ordering

Records must be sorted by their full MST key (collection/rkey) in byte
order, not by collection then rkey separately. This matters when
collection names have prefix relationships - e.g. "social.grain.gallery"
vs "social.grain.gallery.item" - because '.' (46) < '/' (47) in ASCII.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+2 -2
+1 -1
packages/cloudflare/index.js
··· 172 172 /** @type {RecordKeyRow[]} */ 173 173 const rows = sql 174 174 .exec( 175 - 'SELECT collection, rkey, cid FROM records ORDER BY collection, rkey', 175 + "SELECT collection, rkey, cid FROM records ORDER BY (collection || '/' || rkey)", 176 176 ) 177 177 .toArray(); 178 178 return rows.map((r) => ({
+1 -1
packages/storage-sqlite/index.js
··· 85 85 'SELECT uri, cid, rkey, value FROM records WHERE collection = ? AND rkey > ? ORDER BY rkey LIMIT ?', 86 86 ), 87 87 listAllRecords: db.prepare( 88 - 'SELECT collection, rkey, cid FROM records ORDER BY collection, rkey', 88 + "SELECT collection, rkey, cid FROM records ORDER BY (collection || '/' || rkey)", 89 89 ), 90 90 putRecord: db.prepare( 91 91 'INSERT OR REPLACE INTO records (uri, cid, collection, rkey, value) VALUES (?, ?, ?, ?, ?)',