Skip to content

[stable32] fix: envelope single folder#6276

Merged
vitormattos merged 7 commits intostable32from
backport/6274/stable32
Dec 30, 2025
Merged

[stable32] fix: envelope single folder#6276
vitormattos merged 7 commits intostable32from
backport/6274/stable32

Conversation

@backportbot-libresign
Copy link
Copy Markdown

Backport of PR #6274

Previously, two different UUIDs were being generated: one for the
folder name and another for the envelope entity. This caused
inconsistency and made it difficult to correlate folders with
their corresponding envelope records.

Now a single UUID is generated and used for both the envelope
entity and as part of the folder name (Name_UUID format),
ensuring consistency and traceability.

Signed-off-by: Vitor Mattos <[email protected]>
The logic for determining which folder to use when creating files
was duplicated across FileService, UploadProcessor, and
RequestSignatureService. This created maintenance issues and
increased the risk of inconsistent behavior.

Changes:
- Add getFolderForFile() method to FolderService that centralizes
  folder selection logic
- When envelopeFolderId is provided in settings, use the existing
  envelope folder instead of creating a new one
- Remove duplicated folder creation logic from FileService and
  UploadProcessor
- Update RequestSignatureService to pass envelopeFolderId instead
  of folderName

This ensures only one folder is created per envelope, eliminating
the issue of duplicate folders with different naming patterns.

Signed-off-by: Vitor Mattos <[email protected]>
The API documentation referenced FolderService::getFolderName as
an implementation detail, which should not be exposed to API
consumers. Changed to a generic description of the settings
parameter functionality.

Signed-off-by: Vitor Mattos <[email protected]>
Add unit tests focused on validating business rules:
- Envelope folder name must include user-defined name and UUID
- getFolderForFile() must use existing envelope folder when
  envelopeFolderId is provided
- getFolderForFile() must create new folder when no envelope
  context exists

Tests focus on behavior validation rather than implementation
details, using minimal mocking.

Signed-off-by: Vitor Mattos <[email protected]>
Signed-off-by: Vitor Mattos <[email protected]>
Psalm static analysis reported that getFirstNodeById() can return
null, but getFolderForFile() was not handling this case. Added
explicit null check along with instance check to ensure type
safety and prevent potential null pointer errors.

Signed-off-by: Vitor Mattos <[email protected]>
Signed-off-by: Vitor Mattos <[email protected]>
@github-project-automation github-project-automation Bot moved this to 0. Needs triage in Roadmap Dec 30, 2025
@backportbot-libresign backportbot-libresign Bot added this to the Next Patch (32) milestone Dec 30, 2025
@vitormattos vitormattos merged commit eacca87 into stable32 Dec 30, 2025
62 checks passed
@vitormattos vitormattos deleted the backport/6274/stable32 branch December 30, 2025 22:16
@github-project-automation github-project-automation Bot moved this from 0. Needs triage to 4. to release in Roadmap Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant