Add 'truncate_body' into bridge feed calls
Problem
The bridge feed calls return every post's full body. A 20-post get_ranked_posts response is 0.5–0.6 MB, and front ends (ecency, denser) render a title and an excerpt. The legacy condenser calls accept truncate_body (condenser_api_get_discussion_by.sql ≈l.25-28). The bridge calls don't, although their builders already take a truncate length: create_bridge_post_object(_observer_id, row, _truncate_body, …) in utilities/get_ranked_posts.sql and get_account_posts.sql. The bridge endpoints just never pass one.
Fix
Add an optional truncate_body parameter: an integer ≥ 0, default 0, where 0 means the full body and N means the first N characters (left(body, N), as condenser does). It goes on:
bridge.get_ranked_postsandbridge.get_ranked_posts_v2;bridge.get_account_postsandbridge.get_account_posts_v2;bridge.get_account_posts_by_tag.
- In each endpoint (
postgrest/bridge_api/bridge_api_get_ranked_posts.sql,bridge_api_get_account_posts.sql,bridge_api_get_account_posts_by_tag.sql, and the_v2variants):- add
"truncate_body": "number"tovalidate_json_arguments; - parse and validate it like condenser does (
valid_number(…, 0, NULL, NULL, 'truncate_body')); - pass it through to the existing
_truncate_bodyargument of the shared utilities.
- add
- Change no default: without the parameter, output is byte-identical.
- The
observer_votepart of the original ask (stats.voted) is already covered by #348 (closed)'s*_v2calls (observer_vote). No change for it here.
Acceptance
- Tavern patterns under
bridge_api_patterns/:- one
truncate_body: 100request per changed method, on a request that already has a pattern without it. The expected output is that pattern with eachbodycut to 100 characters, derivable without a data run; - a negative pattern for
truncate_body: -1.
- one
- Existing patterns are unchanged.
- AIDEV's install step and smoke pass.
Original description (rewritten 2026-10-09 into an implementation spec for an AIDEV workflow)
We used to have truncate_body field in legacy API which would return portion of body when requesting post lists, could we add it back? There are good use cases which would lighten up feed loading in some apps.