Commit Graph
67 Commits
Author SHA1 Message Date
Chris Troutner 2bcc965efb Review feed-query-performance: remove dead full-scan methods, harden mutation coverage
Remove the full-scan methods the capped-scan optimization replaced
(topLevelPostTxids, countTopLevelPosts, countTopLevelPostsByAddr,
buildReplyCountMap) and their tests, keeping the backwards-compat wrappers.
Add hardening tests to kill 4 mutation survivors (raw scan bound, viewerAddr
fallback). Refresh mutation manifests and Gherkin acceptance-mutation stamps.

By architect.
2026-09-04 18:59:27 -07:00
Chris Troutner 2455745d97 Reduce CRAP in capped-scan recent feed query
Extract reply/mute eligibility check into PostQuery.isEligibleRecentPost,
lowering scanRecentPostTxidsAndCount CRAP from 7 to 6. Refresh mutation
manifest.

By refactorer.
2026-09-04 18:16:10 -07:00
Chris Troutner 65e85c9aef Implement capped-scan feed query performance for /posts/recent
- Replace full-postHeights and full-postChildren scans in ListRecentPosts with
  a single capped scan and per-page reply counting.
- Add PostQuery.scanRecentPostTxidsAndCount with TOTAL_SCAN_CAP=10.
- Update acceptance handlers and fixture for the new feed-query-performance
  spec, and add entry-count wrappers for bounded-read assertions.

By coder.
2026-09-04 17:55:35 -07:00
Chris Troutner df39b47eb1 Spec feed query performance: per-page reply counting and capped total scan
By specifier.
2026-09-04 17:36:26 -07:00
Chris Troutner 3992395480 Review mute-feed-filtering: fix mute dependency order and follow-key fallback, add helper coverage
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.
2026-09-04 13:35:02 -07:00
Chris Troutner a2e0b7691b Refactor mute filtering onto shared helper, reduce CRAP, add property coverage
Extract the duplicated _mutedAddrs lookup and _isMutedPost check into a shared
lib helper (loadMutedAddrs / isMutedPost) used by the post, topic, search, and
notifications adapters. Extract follow/like notification predicates in
NotificationsQuery to bring CRAP down to 6. Add a mute-filtering conservation,
exclusion, and pagination property test for topic queries.

By refactorer.
2026-09-04 12:34:35 -07:00
Chris Troutner 448bddc31f Implement mute feed filtering across recent, topic, search, and notifications feeds
By coder.
2026-09-04 12:23:00 -07:00
Chris Troutner 4eea327f60 Reduce CRAP and DRY in psf-memo-db
- Add tests for profile/level handleError to raise coverage
- Extract DbBackup pure helpers into testable db-backup-util module
- Add tests for DbBackup zip/unzip and the pure helpers
- Extract shared handleControllerError helper across 7 REST controllers

By refactorer.
2026-09-04 07:52:19 -07:00
Chris Troutner 5bb2906d92 Review topics-most-recent-order: hide lastHeight ordering key, harden height-0 cases
By architect.
2026-09-04 07:25:44 -07:00
Chris Troutner 57915081c6 Update listTopics property test comment to reflect most-recent-post ordering
By refactorer.
2026-09-04 06:59:50 -07:00
Chris Troutner f45f2f9e2a Order GET /topics by most recent post
By coder.
2026-09-04 06:43:28 -07:00
Chris Troutner bc07eda916 Spec GET /topics ordering by most recent post
By specifier.
2026-09-04 06:39:31 -07:00
Chris Troutner 2704c2059d Add notifications-query property tests for ordering and pagination
Pin the NotificationsQuery aggregation invariants over broad random
inputs: newest-first ordering with seen tie-break, global ordering, and
pagination conservation. Coverage, CRAP (max 6.0), DRY, and mutation
scan were assessed; all changed/new source files are well under the
100-site split threshold and mutation manifests are preserved.

By refactorer.
2026-09-03 16:04:36 -07:00
Chris Troutner 87ca402cae Review notifications refactor: extract shared getPostOrNull, add adapter unit suite
Extract the post-lookup-with-null helper into a shared module used by both
the notifications and post query adapters, removing duplication. Add a
dedicated NotificationsQuery unit suite (26 tests) and hardening tests that
kill the sort-comparator and followee-guard mutations. Refresh mutation
manifests via the approved tool. Document 5 intrinsic mutation equivalents
and 16 soft-Gherkin equivalents in the review summary.

By architect.
2026-09-03 14:10:54 -07:00
Chris Troutner f1841b64a6 Refactor notifications: extract reply predicate, add manifests
Extract the reply-notification predicate from
_collectReplyNotifications into a _replyNotificationChild helper, moving
the txid-presence guard into the loop so both functions drop to CRAP 5.
Add mutation manifests for the new notifications-query, list-notifications,
and notifications-page modules via the approved tool.

By refactorer.
2026-09-02 13:11:29 -07:00
Chris Troutner 9d63733166 Merge commit '5c95e4bf57' into swarmforge-refactorer 2026-09-02 12:55:04 -07:00
Chris Troutner 5c95e4bf57 Serialize notification aggregation to avoid concurrent LevelDB iterators
By coder.
2026-09-02 12:54:13 -07:00
Chris Troutner 1a7d2574ce Merge commit '8ee07fc35f' into swarmforge-refactorer 2026-09-02 12:53:28 -07:00
Chris Troutner 8ee07fc35f Implement Notifications read-only feature
Add psf-memo-db notifications query, use case, route, and tests.
Add psf-memo-client NotificationsPage service, React page, nav link,
route, and tests. Wire acceptance handlers for notifications.

By coder.
2026-09-02 12:53:02 -07:00
Chris Troutner b85878a5d5 Refactor following-feed scan: extract isFolloweePost to cut CRAP
Extract the reply/viewer/membership predicate from
scanFollowingFeedTxidsAndCount into an isFolloweePost helper, reducing
the scan's cyclomatic complexity from 7 to 5 (CRAP 7.0 to 5.0) while
preserving behavior. Refresh the mutation manifest via the approved tool.

By refactorer.
2026-09-02 12:51:53 -07:00
Chris Troutner 4bf99e7db0 Review and harden following feed: kill survivors, DRY parseRequiredString
- Extract parseRequiredString into pagination.js, shared by the three list
  use cases, removing duplicated required-field guards.
- Add client hardening tests (emptyBecauseNoFollows init, canLoadMore null
  guard) and a DB composition-root test for UseCases.start.
- Refresh mutation manifests and Gherkin acceptance-mutation stamp.

By architect.
2026-09-02 12:20:37 -07:00
Chris Troutner d606ee6608 Refactor following feed: reduce CRAP/DRY, add property coverage
- Extract shared runUseCase and listPostsForAddr in the posts controller to
  remove the duplicated try/catch error wrapper (CRAP 14.7 -> 4.0) and DRY
  the addr-scoped handlers.
- Add error-path unit tests for the posts controller covering both branches
  of handleError.
- Consolidate ListFollowingFeed onto the shared ListUseCase constructor to
  remove constructor duplication across list use cases.
- Add property tests for scanFollowingFeedTxidsAndCount (ordering, reply/
  viewer/membership exclusion, pagination conservation) and for the client
  FollowingFeedPage.load state invariants.

By refactorer.
2026-08-29 10:44:28 -07:00
Chris Troutner 6d1bd148e9 Implement Following feed
Add psf-memo-db endpoint GET /posts/following/:addr that returns top-level
posts from followed profiles, excluding replies and the viewer's own posts,
newest first and paginated. Add PostQuery.scanFollowingFeedTxidsAndCount,
ListFollowingFeed use case, and REST controller/router wiring.

Add psf-memo-client Following feed page, route /posts/following, nav link,
MemoDb.getFollowingFeed, and FollowingFeedPage service. Update acceptance
handlers for the new following-feed.feature.

By coder.
2026-08-29 10:30:54 -07:00
Chris Troutner e8bf42a1f3 Review and harden search: kill mutation survivors, refresh manifests
Add hardening tests to kill mutation survivors in SearchQuery guards and
profileMatches defaults, SearchAll pagination/empty-query guards, the search
REST controller 500-error path, and the client SearchPage constructor/getPost/
getProfile. Refresh mutation manifests and the Gherkin acceptance-mutation
stamp.

By architect.
2026-08-29 08:51:42 -07:00
Chris Troutner d3e3b23bbe Refactor search: reduce CRAP, DRY, add property coverage
- Split SearchQuery.searchProfiles/searchPosts into small helpers to bring
  CRAP to 5.0 or below across the search feature.
- Extract shared normalizeQuery/sortByHeightDesc (src/lib/search.js) and
  loadReplyTxids (src/adapters/lib/load-reply-txids.js) to remove duplication
  with search-all, list-recent-profiles, and post-query.
- Add error-path unit tests for the search controller.
- Add property tests for SearchQuery and SearchAll (pagination, ordering,
  case-insensitivity, reply exclusion, substring containment).
- Refresh mutation manifests for post-query and list-recent-profiles.

By refactorer.
2026-08-29 07:35:26 -07:00
Chris Troutner 8508fdaff0 Implement Search feature (P6.4)
- Add psf-memo-db /search endpoint with SearchQuery adapter, SearchAll use case,
  and REST controller/router.
- Add psf-memo-client SearchPage service, Search component, route, and nav link.
- Wire search support into the acceptance handler fake MemoDb.
- Add unit tests for the new adapter, use case, controller, and page service.

By coder.
2026-08-29 07:18:39 -07:00
Chris Troutner ac468072df Review and harden mute-user: kill mutation survivors, refresh manifests
Add hardening tests to kill mutation survivors in MemoMute.validate,
ProfilePage constructor/_loadState/canMute, MuteQuery._nextString,
MuteState validation guards, and the mute REST controller statused-error
path. Refresh mutation manifests and Gherkin acceptance-mutation stamps.

By architect.
2026-08-28 21:08:50 -07:00
Chris Troutner d8ab5bc79c Refactor mute-user: reduce DRY, add property coverage
Extract shared _getState/_getList helpers in the client MemoDb, a shared
_loadState/_setState base in ProfilePage, and a runAction helper for the
profile follow/mute handlers. Add property tests for the MemoMute service,
the DB MuteQuery adapter, and the indexer handleMute action. Preserve
behavior; all unit, acceptance, and property suites pass across client, DB,
and indexer.

By refactorer.
2026-08-28 19:58:39 -07:00
Chris Troutner 4b03210e85 Implement mute/unmute user feature (0x6d16/0x6d17)
- Client: MemoMute service, ProfilePage mute controls, Profile UI Mute/Unmute buttons,
  Profiles mute state, MemoDb mute read APIs, unit/acceptance tests.
- DB: mutes LevelDB store, MuteQuery adapter, /mute REST routes, MuteState and ListMuted use cases, tests.
- Indexer: mute/unmute action codes, handleMute action handler, muteDb adapter, tests.
- Backlog: mark P4.1/P4.2 mute/unmute as shipped.

By coder.
2026-08-28 19:38:42 -07:00
Chris Troutner fa90179869 Spec mute/unmute user (P4.1/P4.2)
Add client, DB, and indexer Gherkin specs for the Memo mute (0x6d16) and
unmute (0x6d17) actions.

By specifier.
2026-08-28 19:07:07 -07:00
Chris Troutner 06e95150e3 Review and harden poll actions: kill mutation survivors, reduce DRY
- Add hardening tests to kill mutation survivors across client, DB, and
  indexer (hex guards, poll byte-limit boundaries, busy-flag defaults,
  parseTxid empty-string, polls controller handleError, memo-codes
  isMemoPrefix, normalizePollCreateDatas, storePollChildRecord returns).
- Reduce duplication: extract shared reflect/isTooLong into MemoTxidAction
  (client), shared _run into the polls controller and configurable execute
  into PollReadUseCase (DB).
- Refresh mutation manifests and Gherkin acceptance-mutation stamps.

By architect.
2026-08-28 17:51:03 -07:00
Chris Troutner 739b13bfb2 Refactor poll actions: reduce CRAP/DRY, add property coverage
Extract shared txid-action and poll-page bases in the client, a shared
poll-read use-case base and a poll-txid iteration helper in the DB, and a
shared poll-child record helper in the indexer. Reduce normalizePollCreateDatas
complexity (CRAP 7.1 -> 5.0). Add property tests for poll services, handlers,
and query filtering. Preserve behavior; all unit, acceptance, and property
suites pass across client, DB, and indexer.

By refactorer.
2026-08-28 15:23:04 -07:00
Chris Troutner cf05de6630 Implement poll actions (create, option, vote) across client, indexer, and DB
- Client: add MemoPollCreate, MemoPollOption, MemoPollVote services and page controllers.
- Indexer: add create-poll, add-poll-option, and poll-vote handlers with new poll DB adapters.
- DB: add polls/pollOptions/pollVotes stores, PollQuery adapter, GET /polls/:txid endpoints, and use cases.
- Add Gherkin acceptance handlers and focused unit tests for all three components.

By coder.
2026-08-28 14:50:05 -07:00
Chris Troutner 5d7ce7601b Spec P3 poll actions: create poll, add option, vote
By specifier.
2026-08-28 14:11:14 -07:00
Chris Troutner 5183359143 Review and harden topic actions: kill mutation survivors
- Add hardening tests for topic-post-page, profiles, topic-feed-page, and
  topic-query to kill mutation survivors.
- Refresh mutation manifests and Gherkin acceptance-mutation stamps.
- Add topic-actions review summary.

By architect.
2026-08-28 13:13:01 -07:00
Chris Troutner d6f56780be Refactor topic actions: reduce CRAP/DRY, add property coverage, complete acceptance
- Add unit coverage for Profiles topic follow state to bring CRAP to 4.
- DRY Profiles set/get follow state via shared nested-map helpers.
- Add TopicQuery topic-follow read-side property tests and MemoTopicPost
  byte-accounting property tests.
- Complete client and DB acceptance step handlers and mocks for the
  topic-follow and topic-post features.

By refactorer.
2026-08-28 11:13:03 -07:00
Chris Troutner 50e287ed0f Implement topic post, follow, and unfollow
- Add MemoTopicPost service and TopicPostPage controller for topic messages.
- Add MemoTopicFollow service for topic follow/unfollow broadcasts.
- Extend TopicFeedPage with follow state and follower list.
- Update TopicFeed view with composer and Follow/Unfollow button.
- Extend MemoDb client with topic follow state and followers endpoints.
- Extend Profiles store with topic follow state.
- Add DB topic follow read side: TopicQuery, use cases, REST routes.
- Add unit tests for all new behavior.

By coder.
2026-08-28 10:55:42 -07:00
Chris Troutner b8a10d3706 Spec topic post, follow, and unfollow actions
Add client specs for the topic post composer and topic follow/unfollow
buttons, plus the DB read side for topic follow state and followers.

By specifier.
2026-08-28 10:43:52 -07:00
Chris Troutner c9bdf326d6 Review and harden topic-feed: kill mutation survivors
- Add topic-query, list-topic-posts, topics controller, and client
  topic-page hardening tests to kill mutation survivors.
- Refresh mutation manifests and Gherkin acceptance-mutation stamps.
- Add topic-feed review summary.

By architect.
2026-08-28 08:55:48 -07:00
Chris Troutner 4c5fb38661 Refactor topic feed: reduce CRAP, DRY, and add property coverage
- Add topics controller error-handling unit tests to bring handleError
  CRAP from 14.7 to 4.0.
- Consolidate duplicate getTopicPosts/getPostsByAddr HTTP page fetches
  into a shared getPage helper in memo-db (DRY).
- Add TopicQuery property tests: listTopics conservation/ordering,
  getTopicPostTxids newest-first pagination, and room/txid key round-trips.
- Add client topic-services property tests for getTopic/getPost lookup
  completeness.

By refactorer.
2026-08-28 06:43:18 -07:00
Chris Troutner 652c70e4ea Implement topic discovery and topic feed
- Add psf-memo-db /topics and /topics/:room/posts read endpoints
- Add TopicQuery adapter, ListTopics and ListTopicPosts use cases
- Add topic read acceptance fixture and step handlers
- Add psf-memo-client topic services, UI routes, nav link
- Add generated topic discovery/feed acceptance handlers

By coder.
2026-08-28 06:31:43 -07:00
Chris Troutner 7a01b9f4e3 Merge specifier topic-feed specs
By coder.
2026-08-28 06:16:49 -07:00
Chris Troutner d3c3a80bbf Spec topic list/discovery and topic feed
By specifier.
2026-08-28 06:15:58 -07:00
Chris Troutner 4679e7a11e Review and harden efficient-post-query: kill mutation survivors
- Add isReply and scanPostsByAddrTxidsAndCount unit tests in post-query to
  kill the true->false and limit-bounding survivors.
- Add normalizeTwoPushMemoDatas, stripLeadingEmptyPushes, and txHashFromPush
  unit tests in indexer helpers to kill 4 survivors.
- Refresh tool-generated mutation manifests and Gherkin acceptance-mutation
  stamps for the batch features (backfill-post-indexes, efficient-post-query,
  addr-and-like-indexing).

By architect.
2026-08-27 22:26:32 -07:00
Chris Troutner 89f0b678c7 Refactor efficient post query: reduce CRAP, DRY, and property coverage
- Extract computeLikeTip and isPaymentTo in the like handler to bring
  CRAP from 13.2 to <=5.0 without changing behavior.
- Add a level-db unit test to raise openDbs coverage and cut its CRAP
  from 10.3 to 3.0.
- Consolidate duplicate txid-extraction helpers in post-query and
  extract txidFromKeyParts (DRY).
- Add coverage for likeTxidFromPostLike and getPostOrNull edge cases.
- Add property tests for the addrPostHeights/postLikes key round-trips
  and by-address pagination conservation.

By refactorer.
2026-08-27 15:07:58 -07:00
Chris Troutner a68151b5f5 Implement efficient post query with addrPostHeights and postLikes indexes
- Add addrPostHeights and postLikes LevelDB stores to psf-memo-db.
- Update PostQuery to use addrPostHeights for /posts/by/:addr and postLikes for per-post counts.
- Add backfill utility for the new indexes.
- Update indexer to write addrPostHeights (posts/replies) and postLikes entries.
- Add acceptance handlers and unit tests for the new behavior.

By coder.
2026-08-27 14:55:09 -07:00
Chris Troutner a5dc01ede5 Spec efficient post queries via addrPostHeights and postLikes indexes
By specifier.
2026-08-27 14:31:20 -07:00
Chris Troutner bb7b5a6cfd Review and harden follow-user: kill mutation survivors
Add unit test pinning FollowQuery._nextString exclusive upper bound and
empty-string/non-string validation-rejection cases for the follow use
cases, killing the remaining mutation survivors. Update mutation manifests
and add the follow-user architectural review report.

By architect.
2026-08-27 11:23:01 -07:00
Chris Troutner d9ba5a2774 Refactor follow use-cases and profile page; add follow property tests
Share the follow list use-case contract through a FollowListUseCase base
and delegate construction validation to the existing ListUseCase, removing
the duplicated follow use-case constructors and execute bodies. Extract
ProfilePage.load helpers and a shared follow/unfollow setter to reduce
CRAP below the threshold and remove duplicated follow logic. Add property
tests covering MemoFollow broadcast conservation and hash160 length, the
FollowQuery address round trip, and isFollowing/listFollowing/listFollowers
consistency over random record sets.

By refactorer.
2026-08-27 10:46:39 -07:00
Chris Troutner 247d4a9fcf Implement follow-user and follow-read behavior
- Add MemoFollow service for follow/unfollow broadcast with hash160 payloads
- Update Profiles store with follow state
- Extend ProfilePage and Profile UI with Follow/Unfollow buttons
- Add psf-memo-db /follow/state, /follow/following, /follow/followers endpoints
- Add FollowQuery adapter, use cases, REST controller, and unit tests
- Update acceptance handlers for both components

By coder.
2026-08-27 10:35:33 -07:00