Spec Search feature (P6.4)

Add psf-memo-client/specs/search.feature specifying the /search read
endpoint (posts by text, profiles by name/bio) and the client Search page.
Update the backlog: mark Search in pipeline, note Send money (P5.1) skipped.

By specifier.
This commit is contained in:
Chris Troutner
2026-08-29 07:10:38 -07:00
parent 35cb1725a3
commit d11365c057
2 changed files with 74 additions and 13 deletions
+59
View File
@@ -0,0 +1,59 @@
# Scenarios: Search - 1, Search - 2, Search - 3, Search - 4, Search - 5
#
# Search is a public read-only feature; it does not require a wallet and does
# not broadcast any Memo action. The psf-memo-db /search endpoint matches
# case-insensitively (substring) against top-level post text and against the
# profile name and bio. Empty queries and queries with no matches both return
# no results rather than an error.
Feature: Search
Background:
Given the psf-memo-db API has a post with the text "hello world from psf memo"
Given the psf-memo-db API has a post with the text "bitcoin cash meets lightning"
Given the psf-memo-db API has a profile named "Alice Trout" with the bio "bitcoin cash enthusiast"
Given the psf-memo-db API has a profile named "Bob Builder" with the bio "building on BCH"
Scenario Outline: Search - 1 searching by text returns matching posts
When I open the Search page
And I submit a search for <query>
Then the search results include a post with the text <post_text>
Examples:
| query | post_text |
| hello | hello world from psf memo |
| PSF | hello world from psf memo |
| memo | hello world from psf memo |
| lightning | bitcoin cash meets lightning |
Scenario Outline: Search - 2 searching a profile name returns that profile
When I open the Search page
And I submit a search for <query>
Then the search results include a profile named <name>
Examples:
| query | name |
| Alice | Alice Trout |
| trout | Alice Trout |
| bob | Bob Builder |
Scenario Outline: Search - 3 searching a profile bio returns that profile
When I open the Search page
And I submit a search for <query>
Then the search results include a profile named <name>
Examples:
| query | name |
| enthusiast | Alice Trout |
| building | Bob Builder |
Scenario: Search - 4 a query with no matches returns empty results
When I open the Search page
And I submit a search for "zzzqqq"
Then the search results include no posts
And the search results include no profiles
Scenario: Search - 5 an empty query returns no results
When I open the Search page
And I submit a search for ""
Then the search results include no posts
And the search results include no profiles
+15 -13
View File
@@ -205,7 +205,7 @@ Polls require a new data model and rendering. The indexer has no handler yet.
| 6.1 | Repost a memo | C, I, D | `0x6d0b` is marked *planned* in the protocol | | 6.1 | Repost a memo | C, I, D | `0x6d0b` is marked *planned* in the protocol |
| 6.2 | Ranked feed | C, D | memo.cash "ranked" post ordering | | 6.2 | Ranked feed | C, D | memo.cash "ranked" post ordering |
| 6.3 | Notifications | C, D | replies / likes / follows to my posts | | 6.3 | Notifications | C, D | replies / likes / follows to my posts |
| 6.4 | Search | C, D | posts / profiles / topics | | 6.4 | Search | C, D | posts / profiles / topics — spec drafted (task `search`), in pipeline |
| 6.5 | Tags / hashtags | C, D | link + filter by tag | | 6.5 | Tags / hashtags | C, D | link + filter by tag |
| 6.6 | Following feed | C, D | feed filtered to followed users | | 6.6 | Following feed | C, D | feed filtered to followed users |
@@ -213,20 +213,22 @@ Polls require a new data model and rendering. The indexer has no handler yet.
## Suggested next spec ## Suggested next spec
**Send money with memo (P5.1)**`0x6d24`: **Search (P6.4)** — spec drafted (task `search`), in pipeline:
- `psf-memo-client`: a "Send money" composer that broadcasts `0x6d24` with a - `psf-memo-db`: new `GET /search?q=&limit=&offset=` returning
recipient address (20-byte hash160) plus an optional message (≤ 194 bytes). `{ posts, profiles, pagination }`. A `SearchQuery` adapter scans `postsDb`
- `psf-memo-db`: expose the send-money read side (sent/received money memos). (top-level posts only, replies excluded via `postParentsDb`), `namesDb`
- `psf-memo-indexer`: a handler that parses and stores `0x6d24` transactions (profile name), and `profilesDb` (profile bio) with case-insensitive
(no send-money handler exists yet). substring matching; a `SearchAll` use case; a `/search` router + controller.
- `psf-memo-client`: a `/search` page with a search box; `MemoDb.search(q)`;
a `SearchPage` service; render matching posts like the feed and matching
profiles like recent-profiles.
- Empty queries and no-match queries both return an empty result set (no error).
- Spec: `psf-memo-client/specs/search.feature`.
### Send-money payload ### Deferred / skipped
- `0x6d24` send money: `address` (20 bytes, P2PKH hash160) + `message` - **Send money with memo (P5.1)** — `0x6d24` — skipped by user decision
(≤ 194 bytes). (no clear use case yet).
Like follow/unfollow user, the recipient is the 20-byte hash160; convert with
bch-js `Address.toHash160()` (client) and `hash160ToCash()` (DB read side).
--- ---