Skip to content

Social card: first blocks on the Document card #665

Open

Description

@HMarzban

Part of #663 (slice 3). Builds on #664.

Goal

The Document card draws the pad title and its first blocks, not only the title. The kind stays off until both REST replicas run the code.

Scope

  • Worker. The existing preview pass (refreshDocumentGridPreview in apps/hocuspocus.server/src/lib/documentGridPreview.ts) also writes preview.blocks: the first paragraphs and list items after the Title, each line cut to 80 graphemes. No new decode.
  • Grapheme cut. sanitizePlainText cuts by grapheme before its regexes, so a huge line cannot cost 100 ms. Output for normal text stays the same.
  • Fail closed. On an extract or write error, the worker writes blocks: null. The card then draws the title only.
  • Documents list unchanged. parseDocumentGridPreview never returns blocks.
  • Backfill. apps/hocuspocus.server/scripts/backfill-card-data.ts. Dry run by default; --apply writes. One pad at a time, jsonb_set on the new key only, and only while that version is still the head. Run in a one-off container with --memory 768m.
  • Card. The approved r4c "first blocks" layout: title, then up to the room left, paragraphs at 2 lines and list items at 1 line with their marker.
  • Privacy page (R3). One sentence on unfurl caches that we cannot purge.

Owed by the maintainer

  • Set the official demo pads Read-only in production before the kind turns on (R1).
  • Approve the dry-run counts, then run the backfill with --apply.

Acceptance checks

  • An edit moves v; a forced extract failure gives the title-only card.
  • The Documents list response is byte-identical before and after.
  • The rendered card matches the approved r4c PNG.

Activity

  1. added
    enhancement
    on Nov 1, 2026
  2. HMarzban commented on Nov 1, 2026

    @HMarzban
    CollaboratorAuthor

    Built on main and checked locally, not committed yet. Status and the checks owed before switch-on are in #663 (comment of 2026-11-01).

  3. HMarzban commented on Nov 3, 2026

    @HMarzban
    CollaboratorAuthor

    Status, 2026-11-03. First blocks are pushed and deployed on 2026-11-03: the worker extract and the backfill script in 674dfc189, and the privacy sentence in e0acaba4c. The privacy sentence is live. Left:

    • maintainer: set the official demo pads Read-only.
    • maintainer: run scripts/backfill-card-data.ts as a dry run, approve the counts, then run --apply in a one-off container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Featureenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions