Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

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

kidlisp(datomic): fetch full corpus when handle filter is present

/api/store-kidlisp?recent=true&handle=@jeffrey was pulling the
sidecar's top 2000 by created-at, then filtering to the handle in JS —
so any @jeffrey pieces older than position 2000 (e.g. 2025-08 \$air,
\$bip, \$faim) were silently dropped before the handle match ran.

When handle is set, request the full corpus from the sidecar (100K
cap) and trim to the client's limit after filtering.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+9 -3
+9 -3
system/netlify/functions/store-kidlisp-datomic.mjs
··· 343 343 344 344 // ── recent ── 345 345 if (recent) { 346 - const limit = Math.min(parseInt(q.limit) || 50, 100000); 346 + const clientLimit = Math.min(parseInt(q.limit) || 50, 100000); 347 347 const sort = q.sort || "recent"; 348 348 const since = q.since; 349 349 const filterHandle = q.handle; 350 350 351 - const res = await sidecar.listCodes({ limit, sort, since }); 351 + // When the caller narrows by handle, pull the full corpus from 352 + // the sidecar before the JS-side filter. Otherwise a 2000-row 353 + // "recent" window drops all of the user's older pieces (e.g. 354 + // @jeffrey has 700+ pieces scattered through ~17K docs by date). 355 + const sidecarLimit = filterHandle ? 100000 : clientLimit; 356 + const res = await sidecar.listCodes({ limit: sidecarLimit, sort, since }); 352 357 const pieces = res.recent || []; 353 358 354 359 const handles = await handlesBySub(database, pieces.map((p) => p.user)); ··· 379 384 return p.handle === want; 380 385 }); 381 386 387 + const trimmed = filterHandle ? shaped.slice(0, clientLimit) : shaped; 382 388 await database.disconnect(); 383 389 return respond( 384 390 200, 385 - { recent: shaped, count: shaped.length, limit }, 391 + { recent: trimmed, count: trimmed.length, limit: clientLimit }, 386 392 NO_CACHE_HEADERS 387 393 ); 388 394 }