Repository navigation
Add app-frontend integration scripts - #11
Conversation
Per-marketplace command playbook (README) + smallest-real-wiring example for Canva, Figma, Shopify, Notion, WordPress, Framer, Google Workspace, Raycast. Pairs with the integration skills in pooriaarab/skills.
- notion-integration/example.ts: reject Status properties that are neither status nor select instead of silently treating them as select (produces an invalid API filter); write the Post ID/URL idempotency marker before the Status update so a failed status write can't cause the next sync to re-post the same row. - wordpress-plugin/example.php: skip save_post once a remote post id is recorded, so editing an already-published post no longer creates a duplicate resource on every save; wp_unslash the settings API input before sanitizing so keys with quotes/backslashes survive.
- notion-integration/example.ts: loop start_cursor/has_more so >100 "Ready" rows all sync instead of only the first page. - wordpress-plugin/example.php: restrict save_post to the 'post' type (it was firing for every published post type, including Pages) and flag a 2xx response with no id instead of leaving the idempotency guard unset, which let every later save re-POST a duplicate.
council-findings.md and pr.diff were local working files from the review process, not intended for the repo.
- canva-app: replace Adobe Express's addOnUISdk/createRenditions (copy-paste leftover) with Canva's real @canva/design requestExport API. - framer-plugin: fix the npm package name (framer-plugin, not @framer/plugin) in the README and example import. - notion-integration: keep the created post id across a failed write-back so a transient Notion API failure can't cause a duplicate repost, validate the API response has an id before treating the row as synced, and clear stale Error text on a later success. - google-workspace-addon: catch UrlFetchApp connection-level exceptions (muteHttpExceptions only covers HTTP status errors) so a network failure shows a notification instead of a generic Apps Script error.
canva-app, adobe-express-addon, figma-plugin, and framer-plugin all called /posts with mediaIds: [media.id] without checking that /media returned a usable id, so a malformed 2xx response silently produced a broken post. canva-app also skipped the HTTP status check on the exported blob fetch. Notion sync could leave a row stuck in Ready forever if the Post ID write succeeded but the following Status write failed (e.g. transient 429) since the idempotency guard would skip it on every later run; now it retries just the Status write for rows that already have a Post ID. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ion error write - WordPress: drop the current_user_can() gate on the publish sync path — WP-Cron publishing a scheduled post runs with no logged-in user, so the check was always false and silently skipped the API push for every scheduled post. - WordPress: treat a transport-level WP_Error (timeout/DNS/TLS) like the missing-id case (_needs_attention) instead of leaving it retryable, since we can't tell whether the remote already processed the request. - Figma: add an in-flight guard around the "share" handler so two rapid share messages can't run concurrently and create duplicate remote posts. - Notion: isolate the catch-path Post ID write in its own try so a failing Error write can't leave an uncaught rejection that aborts the sync run and drops the idempotency marker, which would duplicate the post on the next run.
There was a problem hiding this comment.
Council review synthesized below. Verified each claim against the surrounding code (not just the hunks) before posting. No fixes pushed this cycle — push access is disabled for this run (3 prior automated fix cycles already landed against this exact area of notion-integration/example.ts), so the two confirmed Major findings below are flagged for a human rather than patched again.
Confirmed (posted inline)
notion-integration/example.ts— uncaught rejection can abortsyncOncemid-loop. In the "Post ID already present, retry Status" branch, thecatchthat writes theErrorproperty is not itself wrapped in try/catch. If that write throws (429, network blip), the rejection propagates out of theforloop and aborts the whole sync run, leaving every laterReadyrow unsynced for that run. This is the exact failure pattern already fixed in the other catch block lower in the same function (commitc9fb344) — just not applied here.notion-integration/example.ts— duplicate remote post when the create call times out or returns 2xx without a usableid. In both casespost?.idis falsy, so the code only writes theErrorfield and never touchesStatusorPost ID. The row staysReady, so the nextsyncOncematches it again via the Ready filter and calls/postsa second time, creating a duplicate remote resource. The WordPress version in this same PR has an explicit_your_product_needs_attentionguard for this identical failure mode; the Notion version has no equivalent anti-retry marker.
Rejected (did not survive verification)
- GPT-5.6,
google-workspace-addon/example.gs:38— claimede.formInput.apiKeyfails because inputs only land undere.commonEventObject.formInputs. Not true for Google Workspace Add-ons (non-Chat surfaces): both the legacye.formInput/e.formInputsande.commonEventObject.formInputsare populated on the action event object; only Chat apps are common-event-object-only.e.formInput.apiKeyis the standard, widely-documented pattern. - GPT-5.6,
adobe-express-addon/example.ts:41— claimed a 204 response makesres.json()throw. The code's own contract requiresmedia.id/post.idfrom the parsed body (if (!media?.id) throw ...), so a 204-with-no-body response would already violate the implied API contract this example assumes; not a concrete failure trigger for this code.
Rolled into summary as Minor (not pushed)
- Gemini 3 Pro (performance),
wordpress-plugin/example.php:73— thesave_posthook makes a synchronous API call, which blocks the editor save request. Real, but this is explicitly the "smallest real wiring" example, and moving towp_schedule_single_eventis a scope expansion beyond a bug fix. - Gemini 3 Pro (performance),
notion-integration/example.ts:55— buffering all paginated Notion rows into one array before processing could get memory-heavy on a database with thousands ofReadyrows. Legitimate at scale; not a defect in normal example usage. - GPT-5.6 (correctness),
wordpress-plugin/example.php:62— two near-simultaneoussave_postinvocations for the same post could both pass the metadata guard before either persists an ID (TOCTOU), double-posting. Plausible but a narrow race requiring genuinely concurrent requests; fixing it properly needs an atomic per-post lock, which is more than this minimal example implements today.
🧑⚖️ Council
| Model | Lens | Result |
|---|---|---|
| GPT-5.6 (Codex) | correctness | 1 confirmed (merged into Notion duplicate-post finding below), 2 rejected |
| Gemini 3 Pro | performance | 2 findings, rolled into summary as Minor |
| Kimi K3 | security | errored (provider quota exceeded) — no findings produced |
| Grok 4.5 | maintainability | 2 confirmed |
| } as never, | ||
| }); | ||
| } catch (err) { | ||
| await notion.pages.update({ |
There was a problem hiding this comment.
Major. This Error write isn't wrapped in its own try/catch, unlike the equivalent write in the create-post catch block further down (fixed in c9fb344). If this pages.update call throws (429, transient network error), the rejection is uncaught here and propagates out of the for loop, aborting syncOnce entirely — every later Ready row in this run goes unsynced with no error surfaced. Wrap it the same way the lower catch block does.
| // A 2xx with no usable id means we can't tell whether a remote resource was | ||
| // created; don't persist "undefined" as the Post ID or the continue guard | ||
| // above would skip this row forever with no real remote link. | ||
| if (!post?.id) throw new Error("API response missing id"); |
There was a problem hiding this comment.
Major. When postToApi throws before post is assigned (timeout/network) or returns 2xx without a usable id, the row falls through to the outer catch with post?.id falsy — so only Error gets written, Status stays Ready, and Post ID is never set. The next syncOnce run's Ready-filter query matches this row again and calls /posts a second time, creating a duplicate remote post. The WordPress example in this PR guards the identical case with _your_product_needs_attention; this Notion path has no equivalent anti-retry marker before the row can be reprocessed.
Per-marketplace command playbook + smallest-real-wiring example for Canva, Figma, Shopify, Notion, WordPress, Framer, Google Workspace, Raycast. Pairs with the integration skills in pooriaarab/skills. Adobe Express to follow.