Skip to content

Telegram feed contract mismatch between edge relay/UI and intelligence API #2593

@FayezBast

Description

@FayezBast

The Telegram feed path appears to have a contract mismatch between the edge relay endpoint, the browser UI model, and the public intelligence API.

What I found:

Why this matters:

  • The browser code currently does a plain cast after res.json() and does not normalize or validate the payload shape.
  • If the relay returns the documented server-style shape (messages[]), the panel reads response.items || [] and silently shows an empty list / zero count.
  • Even beyond the top-level array name, the item field names differ enough that the panel cannot consume the API model directly.

Related issue:

  • api/telegram-feed.js also checks only parsed.items when deciding whether to apply the “empty feed” short cache TTL, so a non-empty messages[] payload may be cached as if it were empty.

Suggested fix:

  • Pick one canonical raw Telegram payload shape.
  • Add an explicit adapter for the browser panel instead of relying on a TypeScript cast.
  • Make the edge proxy/cache logic understand the canonical shape.
  • Add regression tests for:
    • browser mapping from raw Telegram payload -> UI model
    • server/API handler mapping from relay payload -> ListTelegramFeedResponse

I did not verify the live Railway relay payload, so the main problem here is repo-internal inconsistency: the UI contract and the API contract currently disagree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions