Skip to content

feat: add flow import/export - #1

Merged
mikipalet merged 1 commit into
zernio-dev:mainfrom
pablocaeg:feat/flow-import-export
Jun 29, 2026
Merged

mikipalet merged 1 commit into
zernio-dev:mainfrom
pablocaeg:feat/flow-import-export

Conversation

@pablocaeg

@pablocaeg pablocaeg commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

hey! Added flow import/export. You can export any flow as a JSON file from the flows list or from inside the editor, and import one back with the Import button. It uses the existing POST /api/v1/flows endpoint so no backend changes needed.

Screenshot 2026-05-19 at 13 01 20 Screenshot 2026-05-19 at 13 02 17 Screenshot 2026-05-19 at 13 10 35

Export flows as JSON from the flows list or the editor toolbar.
Import flows from JSON files using the existing POST /api/v1/flows endpoint.
@vercel

vercel Bot commented May 19, 2026

Copy link
Copy Markdown

@pablocaeg is attempting to deploy a commit to the Zernio Team on Vercel.

A member of the Team first needs to authorize it.

aleclezio referenced this pull request in aleclezio/zernflow Jun 11, 2026
… routes

Profile scoping (upstreamable set B — brief findings #1-#3):
- 00011: workspaces.zernio_profile_id/_name + partial UNIQUE (profile <->
  workspace 1:1) + global UNIQUE on active channels(late_account_id) — the
  same Zernio account can never fire flows in two workspaces
- lib/zernio-scope.ts: getBoundProfileId (throws ProfileUnboundError),
  412 PROFILE_UNBOUND response helper, accountProfileId normalizer
  (API returns string OR populated Profile object — both handled)
- connect: profiles[0] fallback DELETED; always the bound profile, 412 when
  unbound
- sync: listAccounts filtered by bound profileId + defensive post-filter with
  anomaly log; deactivation pass moved BEFORE inserts (plays nice with the
  new active-account uniqueness)
- test-key binding (never guess): bound -> key must see that profile else
  409 PROFILE_MISMATCH; unbound + 1 profile -> auto-bind; unbound + many ->
  422 PROFILE_CHOICE_REQUIRED with the list (key NOT saved), explicit
  profileId on retry; multi-profile key -> loud isolation warning
- settings UI: profile picker on 422, bound-profile + warning display

TDD: 10 integration tests red first (constraint violations, 412s, binding
matrix, defensive filter incl. populated-Profile variant). Suite: 41 passing.
Test infra: retry on Docker clock-skew ('JWT issued at future') in
createTestUser; per-test unique fixture ids (global uniqueness constraints).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mikipalet

Copy link
Copy Markdown
Member

Really nice feature, @pablocaeg — clean implementation and good instincts.

What stood out on review:

  • isValidFlowData guards the import (name string + nodes/edges arrays), and the preview modal before confirming is a great UX touch.
  • Reusing POST /api/v1/flows with name + " (imported)" means it creates a fresh flow (no overwrite risk) and needs no backend changes.
  • Export sanitizes the filename and uses the shared Json types; error handling is graceful throughout.

Two small notes (non-blocking):

  • Node/edge content isn't deeply validated client-side, but it's POSTed to the same create endpoint the builder uses (workspace-scoped via RLS), so it's within the existing trust boundary — fine.
  • The Vercel check here is failing only because fork PRs can't trigger an authorized preview deploy, not due to the code.

This branch is from a while back and main has moved a fair bit, so it'll likely need a rebase before merge. Otherwise LGTM — recommending merge.

@mikipalet
mikipalet merged commit 78f7929 into zernio-dev:main Jun 29, 2026
1 check failed
khilta added a commit to khilta/zernflow that referenced this pull request Aug 14, 2026
…ers, dm_sent verification

Bug zernio-dev#1 (Phantom DM Lockout):
- comment-processor.ts: Pre-write dm_sent=false (not true) before flow runs
- After executeFlow, query messages table to verify DM actually sent
- Dedup now blocks only on dm_sent=true (not reply_sent=true)
- Failed DMs no longer permanently lock users out

Bug zernio-dev#2 (Wrong API for Returning Users):
- engine.ts: Comment-triggered flows ALWAYS use sendPrivateReplyToComment
  (7-day window) instead of falling back to sendInboxMessage (24h window)
- This was the root cause of Bhashkar's DM failure on Post zernio-dev#5
- sendFirstMessageAsPrivateReply now re-throws on failure

Data fixes:
- Reset Bhashkar dm_sent=false on Post zernio-dev#5 (Follow)
- Reset Trupti dm_sent=false (Crack)
khilta added a commit to khilta/zernflow that referenced this pull request Aug 14, 2026
…rsation_id from overwrite

Bug zernio-dev#1 (engine.ts): executePrivateReply swallowed errors — caught the
exception but never re-threw, so the flow continued as if the DM succeeded.
Now logs message_failed analytics event and re-throws, matching the pattern
already used in sendFirstMessageAsPrivateReply.

Bug zernio-dev#2 (webhook late/route.ts): upsert unconditionally set
late_conversation_id on every incoming message, which could overwrite a
valid conversation ID for existing contacts. Now uses two-step insert-
then-update: INSERT for new contacts (sets conv.id), UPDATE for existing
contacts (leaves late_conversation_id untouched).
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.

2 participants