Skip to content

feat: verify and persist external GIF links - #1

Open
devjerry0 wants to merge 4 commits into
refactor/link-preview-fetchingfrom
feat/external-gif-verification
Open

devjerry0 wants to merge 4 commits into
refactor/link-preview-fetchingfrom
feat/external-gif-verification

Conversation

@devjerry0

@devjerry0 devjerry0 commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Verifies public HTTPS GIF URLs from their content type and header before storing the final URL. This is storage/verification support only; the next PR exposes GIF embeds with their renderer.

Stack 2/6, split from closed #891. Depends on refactor/link-preview-fetching. This PR is in the fork to keep the review diff limited to this layer; open it upstream after its dependency lands.

Changes

Diff against this PR's base: 8 files, +362/-12. 57% of changed lines are tests, fixtures, or test support.

  • GifPreviewLink implements the same one-method PreviewLink contract as HTML. The existing action keeps request classification and every per-hop fetch check.
  • Check GIF87a/GIF89a signatures, complete header, nonzero dimensions, content type, and URL length.
  • Allow verified extensionless redirect targets while retaining per-hop HTTPS, DNS, port, and credential checks.
  • Add only the gif_url migration/model/metadata field; keep it out of public JSON. A real cURL fixture covers a host ignoring Range.

Visual explanation

flowchart TD
    U["Public HTTPS .gif URL"] --> F["Request first 32 bytes"]
    F --> R["Recheck each redirect destination"]
    R --> V{"GifPreviewLink: valid type, signature, dimensions and URL length?"}
    V -- Yes --> S["Store final verified URL in gif_url"]
    V -- No --> N["Keep GIF unverified"]
    S --> L["Renderer arrives in the next PR"]
Loading

Stack and merge order

  1. Fetch boundaries and service contract — upstream
  2. External GIF verification
  3. Inline GIF playback
  4. Cached, queued draft API
  5. Composer link previews
  6. Optional mutation checks

Layers 2–6 target their immediate predecessor in the fork. Submit them upstream in order after their dependency lands; each review diff contains only its layer.

Validation

PreviewLink now lives under App\Contracts\Services (namespace-only follow-up, head 40bf1f200b9c15b0b3acb814ea6719495d3022b2). Focused fetching/verification suites and the final stack’s required checks passed after the move; the earlier per-layer results and implementation review below remain the baseline.

Container checks passed on PHP 8.5.12: 4,576 PHP tests / 25,244 assertions, 100% PHP coverage and type coverage, 194 Node tests, and 613 component tests across 47 files. PHPStan, TypeScript, lint, and production build pass (19 lint warnings, no errors).

Commands: composer test:lint, composer test:types, composer test:type-coverage, full parallel Pest CI coverage at exactly 100%, bun run test:unit, and bun run build.

No UI or mobile interaction changes in this layer.

Independent review

Independent code review: PASS, base b2854ff863c6a3fd161fd27ee369ee7da077b6aa, head 9a4b22f473e3d73e6fd1e5180a38e892afa212ed. Visual review is inapplicable to this backend/tooling-only layer.

Limitations

Hosted CI has not been verified for this new PR. Previously cached GIF URLs require refetching; this layer intentionally does not emit GIF embeds.

Codex-Thread: 01a15b08-d4ad-7e72-8725-b3ea1fde71ce

Direct HTTPS GIF signature/type/dimension verification and gif_url storage, without emitting a new embed kind yet.

Codex-Thread: 01a15b08-d4ad-7e72-8725-b3ea1fde71ce
Keep each layer based on the updated predecessor without rewriting history.

Codex-Thread: 01a15b08-d4ad-7e72-8725-b3ea1fde71ce
Keep the layer based on its updated predecessor without rewriting history.

Codex-Thread: 01a15b08-d4ad-7e72-8725-b3ea1fde71ce
Codex-Thread: 01a15b08-d4ad-7e72-8725-b3ea1fde71ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant