mirror of
https://github.com/Permissionless-Software-Foundation/psf-memo.git
synced 2026-09-21 16:52:01 -07:00
Fix Adapters.openDatabases so muteQuery is constructed before postQuery, which
previously resolved an undefined muteQuery at PostQuery construction and silently
disabled recent-feed mute filtering. Fix the follow-notification key fallback to
strip the :<followeePkHash> suffix instead of key.split(':')[0] (which yielded
only the "bitcoincash" network prefix). Add unit tests for the shared muted-posts
helper and the follow key-fallback path.
By architect.
4.1 KiB
4.1 KiB
Review Summary: mute-feed-filtering
Reviewed
- Batch handoff from refactorer:
git_handoff a2e0b7691b, taskmute-feed-filtering. - Merged via fast-forward to
swarmforge-architect; the full feature span includes the spec, the coder implementation (448bddc), the coder/refactorer merge (bdf1de9), and the refactorer's shared-helper refactor (a2e0b76).
Architectural findings and fixes applied
- Dependency-order bug (fixed) in
psf-memo-db/src/adapters/index.js:PostQuerywas constructed beforethis.muteQuerywas assigned, somuteQuery: this.muteQueryevaluated toundefinedat construction time. The recent-feed mute filtering (scanRecentPostTxids,countTopLevelPosts) was therefore a silent no-op in the production wiring. Reordered soMuteQueryis built beforePostQuery(a comment documents the construction-time dependency). - Key-fallback bug (fixed) in
psf-memo-db/src/adapters/notifications-query.js_followNotificationAddr: the fallbackrecord.followerAddr || key.split(':')[0]yielded"bitcoincash"instead of the full cash address, because a cash address contains a:and the first segment is just thebitcoincash:network prefix. Now strips the trailing:<followeePkHash>suffix viakey.slice(0, key.lastIndexOf(':')). - New coverage added for the shared
muted-posts.jshelper (test/unit/adapters/lib/muted-posts.unit.js) and for the follow key-fallback path innotifications-query.unit.js. - Module structure: the refactorer's extraction of
loadMutedAddrs/isMutedPostintosrc/adapters/lib/muted-posts.jsis a sound, information-hiding improvement and correctly deduplicates the per-adapter_mutedAddrs/_isMutedPostlookups across post, topic, search, and notifications. No structural changes needed.
Verification results
- Language mutation (differential,
--max-workers 8,--mutate-all):lib/muted-posts.js: 4 killed, 0 survived (new helper fully covered).notifications-query.js: 18 killed, 4 survived — documented equivalents (line 23 envRESTURLdefault never exercised; line 135||&&reply guard neutralized downstream; line 173seen ?? 0sort-tie default preserves ordering).post-query.js: 41 killed, 0 survived.search-query.js: 19 killed, 2 survived (pre-existing?? 0defaults).topic-query.js: 21 killed, 2 survived (pre-existing>and0defaults).adapters/index.js: 2 uncovered (openDatabases/startentry points require real DBs; environmentally unsuitable boundary, covered by DB acceptance).list-recent-posts/list-topic-posts/search-all: survivors are the dual-alias fallbackviewerAddr || viewer || null; callers supply at most one alias, so||and&&select the same value (equivalents).
- Client services:
recent-feed-page(6/0),topic-feed-page(15/0),search-page(11/0) — all mutations killed. (memo-db.jsHTTP adapter remains excluded per standing precedent; read behavior exercised via DB acceptance.) - DRY: 10 score-1.00 candidates, all in the pre-existing follow/mute layered-convention
set (queries
follow-query/mute-query; use-casesfollow-state/mute-state/topic-follow-state). No task-scoped duplication; DRY clean for this handoff. - Soft Gherkin acceptance mutation (
--level soft): 48 mutations, 48 survived, 0 errors. All are genuine equivalents for this read-only feature: single-character case/value mutations to example addresses/text/txids are referenced identically on both the setup and assertion sides of each scenario, so the mutated examples still pass exactly as documented for this feature.
Suite status
- psf-memo-db: 343 unit passing, 40 property passing, 9 acceptance files passed, lint clean.
- psf-memo-client: 284 unit passing, 24 acceptance files passed, lint clean.
Handoffs
git_handoffto coder and refactorer (priority 00) with my review commit.- No
git_handoffto specifier (no functional spec change beyond the existing handoff; only manifest/non-functional review artifacts plus the two robustness fixes on the already-delivered work).
By architect.