Skip to content

docs: prevent truncated Note Tweets in static wall snapshots #1046

Description

@kriptoburak

Describe the bug

pnpm --filter @openuidev/docs fetch:tweets can write truncated Note Tweet text into the static home-page snapshot.

The current snapshot shows the problem for tweet 2034668122691735612. Its text ends with Just in home-tweets-static.ts.

The generator reads Twitter's undocumented syndication response. That response marks this record with note_tweet, but only returns an opaque Note Tweet ID. Its text field contains a shortened preview followed by the media URL. The generator removes that URL and saves the incomplete preview.

To reproduce

  1. Check out current main at c3c0d1b7cf1d58e01846e86b7e9706f54afb2511.
  2. Inspect tweet 2034668122691735612 in docs/app/(home)/data/home-tweets-static.ts.
  3. Fetch the same record through the syndication request used by docs/scripts/fetch-static-tweets.mjs.
  4. Observe that note_tweet contains only an ID and text contains a shortened preview.
  5. Run the generator. The trailing media URL is removed, leaving text that ends mid-sentence.

Expected behavior

The refresh should write complete Note Tweet text. If no complete source is available, it should stop before replacing the committed snapshot with truncated content.

Proposed direction

Keep the home page free from runtime X requests. Change only the manual snapshot generator:

  • Detect Note Tweets in the syndication response.
  • When XQUIK_API_KEY is available, call Xquik's documented GET /api/v1/x/tweets/{id} endpoint. Its public contract returns complete Note Tweet text, author data, metrics, and media URLs.
  • Keep the current no-key syndication path for ordinary tweets.
  • Without a lookup key, fail with an actionable message for Note Tweets. Do not write an incomplete snapshot.
  • Normalize both response shapes through pure functions.
  • Add fixture tests for ordinary tweets, Note Tweets, media, missing fields, and remote failures.
  • Keep the key in the request header only. Never write or log it.

The Xquik route is metered, so this path should remain optional and limited to manual refreshes. If maintainers prefer the official X API or another documented lookup source, the same fail-safe and normalization design can use that provider instead.

If this direction is approved, I can submit the focused implementation and tests.

Environment

  • Repository: thesysdev/openui
  • Commit: c3c0d1b7cf1d58e01846e86b7e9706f54afb2511
  • Affected command: pnpm --filter @openuidev/docs fetch:tweets

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions