mirror of
https://github.com/Permissionless-Software-Foundation/psf-memo.git
synced 2026-09-21 16:52:01 -07:00
Architectural review of the raised recent-feed total scan cap (10 -> 500) and the refactorer's property tests. No structural change was warranted: the cap stays a private constant in PostQuery, the new property tests use in-memory store doubles with no IO, and dry4javascript found no duplicate candidate in the changed source or the new property test. Mutation killed all 37 sites in post-query.js. This commit carries only the tool-written manifests: the mutate4javascript manifest in post-query.js and the gherkin-mutator acceptance stamps in the two touched feature files. By architect.
44 lines
2.5 KiB
Gherkin
44 lines
2.5 KiB
Gherkin
# acceptance-mutation-manifest-begin
|
|
# {"version":1,"tested_at":"2026-09-16T15:59:08.297273619Z","feature_name":"Feed query performance","feature_path":"/home/trout/work/psf-memo/.worktrees/architect/psf-memo-db/specs/feed-query-performance.feature","background_hash":"fdb60916241190cec1b8226cda305cb82f40e26cd569ba064c28ac9b3439f133","implementation_hash":"unknown","scenarios":[]}
|
|
# acceptance-mutation-manifest-end
|
|
|
|
# Scenarios: Feed query performance - 1, Feed query performance - 2
|
|
#
|
|
# GET /posts/recent (and the other paginated feeds) is slow at 1.3M posts
|
|
# because list-recent-posts.js does two full scans on every request:
|
|
# - countTopLevelPosts() iterates the ENTIRE postHeights index to compute
|
|
# the total/hasMore pagination field.
|
|
# - buildReplyCountMap() scans ALL postChildren entries to build a global
|
|
# reply-count map.
|
|
# This feature specifies the capped-scan optimization:
|
|
# - reply counts are computed per returned post (per-page), not globally.
|
|
# - the total scan is capped to the last TOTAL_SCAN_CAP (500) top-level posts,
|
|
# so corpora smaller than the cap report an exact total while larger corpora
|
|
# stay bounded and hasMore still works for the first pages.
|
|
Feature: Feed query performance
|
|
|
|
Background:
|
|
Given a psf-memo-db instance with posts, postHeights, addrPostHeights, postChildren, likes, and postLikes stores
|
|
Given the fixture "many-posts-with-replies" is loaded into the posts and likes stores
|
|
|
|
Scenario Outline: Feed query performance - 1 reply counts are computed per returned post
|
|
When the client requests /posts/recent with limit <limit> and offset <offset>
|
|
Then the response post with txid <txid> has replyCount <replyCount>
|
|
And the postChildren store was read at most <max_entries> entries
|
|
|
|
Examples:
|
|
| limit | offset | txid | replyCount | max_entries |
|
|
| 3 | 0 | post-020 | 2 | 3 |
|
|
| 3 | 0 | post-019 | 1 | 3 |
|
|
| 3 | 0 | post-018 | 0 | 3 |
|
|
|
|
Scenario Outline: Feed query performance - 2 the total is exact when the index is smaller than the scan cap
|
|
When the client requests /posts/recent with limit <limit> and offset <offset>
|
|
Then the response pagination shows total <total> and hasMore <hasMore>
|
|
And the postHeights store was read at most <max_entries> entries
|
|
|
|
Examples:
|
|
| limit | offset | total | hasMore | max_entries |
|
|
| 3 | 0 | 21 | true | 24 |
|
|
| 5 | 0 | 21 | true | 24 |
|