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_posts and bridge.get_ranked_posts_v2;
  • bridge.get_account_posts and bridge.get_account_posts_v2;
  • bridge.get_account_posts_by_tag.
  1. 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 _v2 variants):
    • add "truncate_body": "number" to validate_json_arguments;
    • parse and validate it like condenser does (valid_number(…, 0, NULL, NULL, 'truncate_body'));
    • pass it through to the existing _truncate_body argument of the shared utilities.
  2. Change no default: without the parameter, output is byte-identical.
  3. The observer_vote part of the original ask (stats.voted) is already covered by #348 (closed)'s *_v2 calls (observer_vote). No change for it here.

Acceptance

  • Tavern patterns under bridge_api_patterns/:
    • one truncate_body: 100 request per changed method, on a request that already has a pattern without it. The expected output is that pattern with each body cut to 100 characters, derivable without a data run;
    • a negative pattern for truncate_body: -1.
  • 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.

Edited by Dan Notestein