Skip to content

feat: Add March 2026 API updates and fix carousel ordering#16

Merged
tirthpatell merged 4 commits intomainfrom
feat/march-1-2026-api-updates
Mar 6, 2026
Merged

feat: Add March 2026 API updates and fix carousel ordering#16
tirthpatell merged 4 commits intomainfrom
feat/march-1-2026-api-updates

Conversation

@tirthpatell
Copy link
Copy Markdown
Owner

Summary

  • Add GIFProviderGiphy constant per February 27, 2026 changelog (GIPHY now supported)
  • Mark GIFProviderTenor as deprecated (Tenor API sunset March 31, 2026)
  • Update validation to accept both TENOR and GIPHY providers
  • Fix carousel children ordering bug: SetChildren was using indexed params (children[0], children[1], etc.) which sort lexicographically, causing items 10+ to appear out of order. Now uses comma-separated format as expected by the Graph API.

Test plan

  • Unit tests for GIPHY provider constant and validation
  • Unit tests for SetChildren with 20+ items verifying order preservation
  • Unit test verifying no indexed params (children[N]) are produced
  • Unit test for AddChild accumulation
  • All existing tests pass (go test ./... -short)
  • go build ./... and go vet ./... clean

- Add GIFProviderGiphy constant ("GIPHY")
- Update validation to accept both TENOR and GIPHY providers
- Mark GIFProviderTenor as deprecated (sunset March 31, 2026)
- Update comments and tests
SetChildren was sending children in both repeated params and indexed
params (children[0], children[1], etc). The indexed format sorts
lexicographically, causing items 10+ to appear out of order in
carousel posts. The Graph API expects children as a comma-separated
string. Also fix AddChild to accumulate correctly and remove dead
childIndexKey/toString helper methods.
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 6, 2026

Greptile Summary

This PR adds GIFProviderGiphy per the February 27, 2026 API changelog, deprecates GIFProviderTenor ahead of its March 31, 2026 sunset, updates validation to accept both providers, and fixes a real carousel ordering bug where indexed children[N] params sorted lexicographically causing items 10+ to appear out of order.

  • types.go: Adds GIFProviderGiphy = "GIPHY" constant; GIFProviderTenor gets a Go // Deprecated: godoc tag pointing to the replacement.
  • validation.go: Provider check expanded from single-provider check to an explicit allowlist of both constants; error message updated to list both.
  • container_builder.go: SetChildren now uses strings.Join(childIDs, ",") instead of indexed children[0], children[1], … keys, fixing the ordering bug. AddChild gains an empty-string guard for robustness.
  • client_test.go / tests/integration/integration_test.go: New unit tests verify comma-separated format, 20-item order preservation, no indexed params, and AddChild accumulation. Integration test correctly updated to use "INVALID" instead of "GIPHY" for the rejection case.

All fixes are targeted, well-tested, and safe to merge.

Confidence Score: 5/5

  • The PR is safe to merge. Carousel ordering bug is fixed with comprehensive tests (including 20-item order preservation). GIPHY provider addition is straightforward. All tests pass.
  • The carousel ordering fix is correct and well-tested. The GIPHY provider constant, deprecation tag, and validation updates are all straightforward and verified. There are no blocking issues or edge cases that would prevent merging.
  • No files require special attention

Sequence Diagram

sequenceDiagram
    participant Caller
    participant ContainerBuilder
    participant GraphAPI

    note over Caller,GraphAPI: Carousel creation flow (fixed in this PR)

    Caller->>ContainerBuilder: SetChildren(["id1","id2",...,"id20"])
    note over ContainerBuilder: strings.Join → "id1,id2,...,id20"<br/>(was: children[0]=id1, children[1]=id2, ...<br/>which sorted lexicographically, breaking order at id10+)
    ContainerBuilder-->>Caller: *ContainerBuilder

    Caller->>ContainerBuilder: Build()
    ContainerBuilder-->>Caller: url.Values{"children": ["id1,id2,...,id20"]}

    Caller->>GraphAPI: POST /container?children=id1%2Cid2%2C...%2Cid20
    GraphAPI-->>Caller: container_id

    note over Caller,GraphAPI: GIF provider validation flow (new in this PR)

    Caller->>ContainerBuilder: SetGIFAttachment({GIFID: "xyz", Provider: "GIPHY"})
    ContainerBuilder-->>Caller: *ContainerBuilder

    Caller->>GraphAPI: POST /container?gif_attachment={"gif_id":"xyz","provider":"GIPHY"}
    GraphAPI-->>Caller: container_id
Loading

Last reviewed commit: 0f9abf8

Comment thread container_builder.go
Comment thread container_builder.go
@tirthpatell tirthpatell merged commit 0344dca into main Mar 6, 2026
8 of 9 checks passed
@tirthpatell tirthpatell deleted the feat/march-1-2026-api-updates branch March 6, 2026 00:42
@tirthpatell tirthpatell self-assigned this Mar 13, 2026
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