fix(appview): add $type to reply ref so indexer resolves rootPostId/parentPostId (#61)
* fix(appview): add $type to reply ref so indexer resolves rootPostId/parentPostId
Post.isReplyRef() uses AT Protocol's is$typed() runtime guard which requires
$type: "space.atbb.post#replyRef" to be present. Without it the guard returned
false, leaving rootPostId/parentPostId null in the database and breaking reply
threading. Also adds an assertion to the happy-path test that verifies the
record written to the PDS includes the correct $type on the reply ref.
* fix(appview): address PR review feedback on reply ref $type fix
- Use Post.isReplyRef() in route tests instead of $type string literal,
so the actual indexer contract is tested (a typo in the string would
still break isReplyRef() but pass a literal comparison)
- Add isReplyRef() assertion to nested-reply test (creates reply to reply)
- Add regex URI assertions for stronger AT-URI shape validation
- Add indexer happy-path test: correctly-typed reply ref resolves
rootPostId/parentPostId to non-null values
- Upgrade logger.warn → logger.error for missing $type (data corruption,
not a warning — post is silently unreachable in thread navigation)
- Add errorId field to missing $type log entry for operator filtering
- Split outer try block in POST /api/posts: DB lookup and PDS write now
have separate catch blocks with accurate error messages (per CLAUDE.md
Try Block Granularity pattern)