Skip to content

fix: Open a container editor only for Open in Editor actions - #2067

Open
honarpour wants to merge 4 commits into
masterfrom
fix/editor-container-envelope-action
Open

honarpour wants to merge 4 commits into
masterfrom
fix/editor-container-envelope-action

Conversation

@honarpour

@honarpour honarpour commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Ticket: https://app.notion.com/p/41d753ac481581b6a372f8f4895907f1

Changes

  • A Generate Documents action now opens its documents in a Document Editor container only when it is set to Open in Editor. editorContainerId ignores a container editor_mode on a Download, Sign or Save action, so those actions run their own outcome again instead of handing the envelope to the container. Before, the button did nothing on click. Forms that already saved such an action are fixed without being edited or republished.
  • A Sign action that kept a container Mode now sends to its configured signers. On master, the container Mode blanked them, so the Sign generated documents and sent nothing.
  • Removed two error branches in integrationClient.generateEnvelopes that blocked container actions. The first only applied to non-editor actions, which no longer target a container. The second also blocked Open in Editor with merge groups or repeat_start. Those requests now reach the backend, which falls back to the PDF overlay, or rejects repeat_start without DocuSign. The client-utils path now receives only plain ids, because any object entry takes the direct call.
  • Open in Editor actions that target a container now submit their file upload sources before generating. The backend falls back to the overlay for upload sources and reads the upload saved on the server, so skipping the submit left it stale or missing.
  • Container test fixtures now set envelope_action: 'open_in_editor', the shape the designer saves.

Why: the designer only offers a container Mode for Open in Editor and clears it when the action changes. Robin, the API, and the designer's older cleanup could still leave a container editor_mode on another action. The backend's resolve_editor_mode already ignores the Mode for anything but open_in_editor. The legacy view_draft_container key stopped routing to a container in August, so no saved form relies on a non-editor action opening a container. That key still blanks signers; removing it is left for a separate change.

Testing: Jest for the Form, document editor, document and integrationClient suites (414 passed), yarn typecheck, and ESLint on the changed files. Unit tests cover editorContainerId for unset, Sign, Download and Save actions, and for overlay and empty Modes on Open in Editor. Integration client tests check that a Download with a stale container Mode is sent as a Download and a Sign is sent to its signers, both without editor_mode. A Form test checks that upload sources are submitted before a container action generates.

Checklist before requesting a review

  • Cleaned up debug prints, comments, and unused code
  • Tested end to end
  • Included screenshots or walkthrough video of change if impacts UX

Related pull requests

This PR doesn't depend on either and can merge in any order.

🤖 Generated with Claude Code

@honarpour
honarpour requested a review from a team as a code owner December 1, 2026 18:30
@honarpour
honarpour requested a review from joondotcode December 1, 2026 18:36
@joondotcode
joondotcode requested a review from ayeshah December 1, 2026 21:33

@ayeshah ayeshah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of PR #2067 (commit 88608f0). The main fix is correct: a container only opens for "Open in Editor" actions, which matches the backend. Several other changes have effects the PR does not describe. Severity: P1 = ships a real bug on a reachable path, P2 = should consider.

P1: stale Sign actions may send real invitations. Removing the isDraftView container check means saved Sign actions with a stale container Mode now forward their signers. Backend defaults a missing outcome to sign, so invites can go out on the first click. Not in the PR description, no test. (integrationClient.ts ~790-810)

P1: stale Download may open a sign review. With signers still attached, hasExclusions && !openInEditor is true, so the payload becomes an Open in Editor request with a forced sign toolbar. Reasoned from code, not yet reproduced.

P1: "can no longer happen" is wrong. The removed merge_groups/repeat_start error on master had no Open in Editor guard, so it did block open-in-editor actions. Those requests now reach the backend (overlay for DocuSign, ValidationError otherwise). Not listed in the description, no test.

P1: file uploads skipped for containers based on an inaccurate comment. The early return in submitDocumentSourceFiles (Form/index.tsx ~645) says "a container rejects upload sources." Nothing enforces that. The backend overlays instead and reads whatever upload is saved on the server.

P2: legacy view_draft_container still drops signers. Nothing routes to a container on that key any more, so the flag only blanks signers. Delete it or explain why it stays.

P2: designer still treats stale container refs as live. Runtime now returns no target, so those containers show "No document yet" permanently. Needs the same predicate in the designer repo, or clearing editor_mode on write.

P2: tests. The Download test only checks status != error and that fetch was called. The plain-ids check was removed with no replacement. Form tests stub editorContainerId to '', so the real gate never runs there. Two editorContainerId tests pass for the wrong reason (no envelope_action).

P2: comments. The 5-line JSDoc breaks the 1-2 line rule, and the "single source of truth" wording is no longer accurate.

Suites that fail (document.spec.ts fflate import, one hub-association test) also fail on master, so they are not from this PR.

Comment thread src/utils/document.ts Resolved
const isDraftView =
!openInEditor &&
(!!editorContainerId(action) || !!action.view_draft_container);
const isDraftView = !openInEditor && !!action.view_draft_container;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Removing the container term here means stale Sign/unset actions with a container Mode now forward envelope_signers. On master those were blanked. Please confirm that invites on saved forms are intended, or keep the suppression for non-open-in-editor actions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended, and I kept it. The backend's resolve_editor_mode already ignores editor_mode for anything but open_in_editor, and the designer only shows a container Mode for Open in Editor. A Sign action with signers is meant to send. On master, the leftover container Mode blanked the signers, so the Sign generated documents and sent nothing, which is the bug this PR fixes. 28b1c78 adds a test that a Sign keeping a container Mode is sent as a Sign to its configured signers, without editor_mode. The PR description now calls out this change for saved forms.

A container falls back to the PDF overlay for upload sources, and the
overlay reads the upload saved on the server, so skipping the submit
left it stale or missing.
@honarpour

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Here's where each point landed (commits e1a711f, 28b1c78, eb8b51d):

  • Stale Sign actions send invites: intended; replied on the inline thread. Covered by a new test, and called out in the description.
  • Stale Download may open a sign review: left as is. reviewBeforeSend applies to any Download whose signers have exclusions, with or without a container Mode, so it isn't introduced here.
  • "Can no longer happen" is wrong: agreed. The description now says Open in Editor with merge groups or repeat_start reaches the backend, which falls back to the PDF overlay or rejects repeat_start without DocuSign.
  • Uploads skipped for containers: fixed in e1a711f. submitDocumentSourceFiles no longer returns early for a container, so the overlay fallback reads the current upload. A Form test checks that the upload is submitted before generating, and it fails with the old early return.
  • Legacy view_draft_container: kept for now. Removing it would start sending invites for any old saved action that still has it, so I'd rather do that as a separate change. The comment above it now says it's the only thing that still blanks signers.
  • Designer treats stale container refs as live: belongs in feathery-org/feathery-frontend#4562.
  • Tests: the Download test now checks the request body (fill, no editor_mode, documents unchanged). The overlay and empty editorContainerId tests now set open_in_editor, so they reach the Mode check. The plain-ids case is still covered by the existing test that routes Quik documents through the direct call.
  • Comments: fixed in eb8b51d.

@honarpour
honarpour requested a review from ayeshah December 3, 2026 14:37
@trebitowski
trebitowski requested review from trebitowski and removed request for ayeshah December 3, 2026 14:58
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