mirror of
https://github.com/Permissionless-Software-Foundation/psf-memo.git
synced 2026-09-21 16:52:01 -07:00
4.6 KiB
4.6 KiB
Review: page-size-50
By architect.
Task and commits reviewed
- Task:
page-size-50— reduce the client page size from 100 to 50 across all paginated pages (recent feed, following feed, topic feed, notifications, search, profile, recent profiles) to cut payload size and reduce page load times, plus add pagination controls and full acceptance coverage. - Inbound handoff: refactorer
a9488d9ae2(fast-forward merge ontoswarmforge-architect). - Reviewed commits:
81cedab(spec),59cce442/merge38f7a42(implementation by coder),a9488d9(refactorer — PaginatedPage base + property coverage), and0dba837(briefing/ backlog update after the youtube-embed merge). - Scope note: the fast-forward also carried the prior
0dba837specifier/backlog update; it is informational only, no code.
Architectural findings and fixes applied
- Good UI/Core separation: page services remain pure, testable controllers with the MemoDb
client injected. The coder's change was a one-line default (
limit = 100→limit = 50) in eachload/submitplus newcanLoadMore()methods on the four pages that lacked them. - Refactorer DRY extraction: extracted a shared
PaginatedPagebase (newsrc/services/paginated-page.js) and subclassedRecentFeedPageandRecentProfilesPageonto it, removing the duplicated load/canLoadMore pattern. Dependency direction is correct: the concrete pages depend on the pure base; the base has no IO. Each subclass keeps a thin custom item-finder (getPost/getProfile). Clean, cohesive, well-hidden. No structural changes required. - Hardening (this review): killed the surviving
canLoadMoremutation in the base and the three pages that addedcanLoadMorewithout tests (profile, search, topic-feed), plusnotifications-page, all of which had the same uncovered?? falsedefault-on-null edge:- Added new
test/unit/paginated-page.test.js(6 tests) covering load storage, the missing-client guard, the 50/0 defaults, andcanLoadMoreunder null / missing-hasMorepagination. - Added
canLoadMorenull-pagination tests tonotifications,profile,search, andtopic-feedunit test files.
- Added new
- Documented equivalent (not chased): the
notifications-page.jsconstructorthis.empty = false → truemutation survives becauseload()always overwritesemptybefore it is read (component and acceptance both read it afterload). Genuine equivalent. - Noted, not refactored: the pagination Previous/Next UI is duplicated across the profile,
recent-profiles, and search components. Extracting a shared pagination component is a broad
cross-module UI refactor beyond this handoff; the controller-side dedup via
PaginatedPageis the appropriate scope here.
Verification results
- Language mutation (
mutate4javascript <file> --max-workers 8 --mutate-all, sequential):paginated-page.jsKilled 5 / 0 survived / 0 uncoveredrecent-feed-page.jsKilled 1 / 0 / 0recent-profiles-page.jsKilled 1 / 0 / 0following-feed-page.jsKilled 12 / 0 / 0notifications-page.jsKilled 11 / 1 survived / 0 uncovered (the constructoremptyequivalent documented above)profile-page.jsKilled 22 / 0 / 0search-page.jsKilled 9 / 0 / 0topic-feed-page.jsKilled 15 / 0 / 0memo-db.jsis excluded from mutation testing (ESM +../configdirectory import, standing precedent).
- DRY (
dry4javascript) on all touched services: no duplicate candidates. - Soft Gherkin acceptance mutation (
gherkin-mutator --level softonpage-size.feature): 0 killed, 24 survived. All 24 are single-character case/value mutations of setup example values — counts that stay above 50 and addresses/topics/queries/txids used consistently on both sides of their scenario. Intrinsic equivalents for a read-only feature; not chased. - Unit tests (
npm test): 280 passing (267 prior + 13 hardening), 0 fail. - Property tests (
npm run test:property): 40 passing (37 prior + 3 newpaginated-pageproperties), 0 fail. - Acceptance (
npm run test:acceptance): all 22 generated suites PASS, including the newpage-sizescenarios. - Lint: clean. Build: OK.
Suite status
- psf-memo-client: 280 unit, 40 property, acceptance PASS, lint clean, build OK.
Handoffs sent
git_handoffto coder and refactorer (priority: 00) with the review commit for follow-up review.- No functional commit for the specifier (the task produced a functional client change, but
the specifier-authored spec
81cedabis already merged and there is no new feature to specify; the handoff chain ends at architect + coder/refactorer review).