Spec GET /topics ordering by most recent post

By specifier.
This commit is contained in:
Chris Troutner
2026-09-04 06:39:31 -07:00
parent 2a3e742532
commit bc07eda916
+11 -3
View File
@@ -2,7 +2,7 @@
# {"version":1,"tested_at":"2026-08-28T15:47:38.414053749Z","feature_name":"Topic Read","feature_path":"/home/trout/work/psf-memo/.worktrees/architect/psf-memo-db/specs/topic-read.feature","background_hash":"922fd45b8606f723073833f0aaca0e6d92b03a263a6b54c60490843e0ac41cc0","implementation_hash":"unknown","scenarios":[{"index":0,"name":"Topic Read - 1 GET /topics lists distinct topics with their post counts","scenario_hash":"a425a0cbf18c7e7fcb7d01c3571556d4c184b013ad7990e724d95d8d100eebb9","mutation_count":8,"result":{"Total":8,"Killed":8,"Survived":0,"Errors":0},"tested_at":"2026-08-28T15:39:33.364455310Z"},{"index":1,"name":"Topic Read - 2 GET /topics/:room/posts returns the posts for a topic sorted by block height descending","scenario_hash":"cffb702052b0df29aa87510e0c45dd01b83c4607e7ce915bc0e660d601f79cce","mutation_count":4,"result":{"Total":4,"Killed":4,"Survived":0,"Errors":0},"tested_at":"2026-08-28T15:39:33.364455310Z"}]}
# acceptance-mutation-manifest-end
# Scenarios: Topic Read - 1, Topic Read - 2, Topic Read - 3, Topic Read - 4
# Scenarios: Topic Read - 1, Topic Read - 2, Topic Read - 3, Topic Read - 4, Topic Read - 5
#
# The indexer stores topic activity in the rooms store. Topic messages are
# keyed `${room}:${txid}` with type 'post'; topic follows are keyed
@@ -15,13 +15,13 @@
# bitcoin:post-200 { room: bitcoin, txid: post-200, type: post, blockHeight: 200 }
# bitcoin:addr-f { room: bitcoin, addr: addr-f, type: follow, unfollow: false }
# cash:post-250 { room: cash, txid: post-250, type: post, blockHeight: 250 }
# dev:post-100 { room: dev, txid: post-100, type: post, blockHeight: 100 }
# dev:post-400 { room: dev, txid: post-400, type: post, blockHeight: 400 }
# lone:addr-f { room: lone, addr: addr-f, type: follow, unfollow: false }
# posts store:
# post-300 { txid: post-300, addr: addr-a, text: hello bitcoin, blockHeight: 300 }
# post-200 { txid: post-200, addr: addr-b, text: bitcoin again, blockHeight: 200 }
# post-250 { txid: post-250, addr: addr-a, text: cash rules, blockHeight: 250 }
# post-100 { txid: post-100, addr: addr-c, text: dev stuff, blockHeight: 100 }
# post-400 { txid: post-400, addr: addr-c, text: dev stuff, blockHeight: 400 }
Feature: Topic Read
Background:
@@ -63,3 +63,11 @@ Feature: Topic Read
Scenario: Topic Read - 4 GET /topics/:room/posts returns no posts for a topic with no posts
When the client requests /topics/lone/posts
Then the response contains no posts
Scenario Outline: Topic Read - 5 GET /topics orders topics by most recent post
When the client requests /topics
Then the response lists topics in order <expected_order>
Examples:
| expected_order |
| dev,bitcoin,cash,lone |