Skip to content

refactor: centralize file status management - #6641

Merged
vitormattos merged 36 commits into
mainfrom
refactor/centralize-file-status-management
Jan 30, 2026
Merged

vitormattos merged 36 commits into
mainfrom
refactor/centralize-file-status-management

Conversation

@vitormattos

Copy link
Copy Markdown
Member

No description provided.

- Remove TTL parameter from setStatus method (use constant DEFAULT_TTL)
- Improve formatting with proper constructor parameter wrapping
- Add safety check for empty UUID before caching

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Inject StatusCacheService for distributed cache management
- Update cache after every file status update
- Rename updateFileStatus to update for consistency
- Ensure cache is updated for parent files and children

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Inject FileStatusService for centralized status management
- Add update method that delegates to FileStatusService
- Provides consistent interface for file updates across codebase

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Replace FileMapper with FileStatusService for status updates
- Remove updateFileStatus method in favor of FileStatusService
- Directly set status and delegate timestamp management to service

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…sService

- Use FileStatusService instead of direct FileMapper calls
- Remove setStatusEnum calls, use setStatus with integer value
- Ensures consistent status change timestamp handling

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Inject FileService for centralized file operations
- Replace direct FileMapper calls with FileService.update
- Remove manual metadata timestamp handling

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Replace direct FileMapper.update with FileStatusService.update
- Remove manual metadata timestamp management
- Remove updateCacheAfterDbSave duplicate method
- Add sequential signing validation before signing

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Replace FileMapper.update calls with FileService.update
- Ensures all file updates go through centralized service
- Maintains consistency across signature flow updates

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Inject FileService for file operations
- Replace direct FileMapper.update with FileService.update
- Maintains centralized file management pattern

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Remove TTL parameter from cacheFileStatus method
- Add logic to allow ordered flow downgrade from ABLE_TO_SIGN to DRAFT
- Split update logic into explicit conditions for clarity

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Update condition to allow updates when status is DRAFT or ABLE_TO_SIGN
- Enables proper status management in ordered signing flows

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add pollForProgressChange method using progress hash comparison
- Implement buildProgressHash for detecting any progress changes
- Add comprehensive logging for debugging poll behavior
- Fix status code priority to check signed status first
- Optimize cache check to return early if status already changed

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add check for single file (totalCount === 1) to stop polling
- Prevents unnecessary polling after single file signature completion
- Improves UX by completing immediately for single file scenarios

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Inject FileStatusService mock in setUp
- Update createFileService to include new dependency
- Ensures tests reflect actual service dependencies

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add StatusCacheService mock in setUp
- Update constructor to include cache service
- Rename test method from updateFileStatus to update
- Ensures tests match refactored service interface

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Replace FileMapper mock with FileStatusService mock
- Update test expectations to match new update method behavior
- Simplify assertions to check status value only
- Remove metadata timestamp assertions (handled by service)

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Replace FileMapper mock with FileStatusService mock
- Add willReturnArgument(0) to update method expectations
- Improve callback formatting with proper indentation
- Ensures tests match refactored service pattern

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add FileService mock to coordinator test
- Replace FileMapper.update with FileService.update expectations
- Add clearSignRequestError expectations for proper cleanup
- Simplify assertions to check status only (no metadata checks)
- Add willReturnArgument(0) to update method mocks

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add mock for shouldUseParallelProcessing to return false
- Replace FileMapper.update with FileStatusService.update expectation
- Add willReturnArgument(0) to update method mock
- Ensures test passes with centralized status management

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add envelopeProgressChangeProvider with test cases
- Test pollForStatusOrErrorChange with progress hash changes
- Add mock for getChildrenFiles to simulate child status changes
- Verify polling stops when envelope child progress changes

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add testUpdateStatusAllowsOrderedFlowDowngrade test case
- Verify ABLE_TO_SIGN to DRAFT downgrade in ordered numeric flow
- Test hasPendingLowerOrderSigners validation logic
- Ensures status can be downgraded when lower order signers pending

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos added this to the Next Major (34) milestone Jan 29, 2026
@vitormattos vitormattos self-assigned this Jan 29, 2026
@github-project-automation github-project-automation Bot moved this to 0. Needs triage in LibreSign Roadmap Jan 29, 2026
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Create ProgressPollDecisionPolicy to encapsulate polling logic
- Centralizes decision making for when to stop polling
- Improves testability and separation of concerns

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Test all polling stop conditions
- Verify error detection stops polling
- Test progress hash change detection
- Test cache status change detection

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Inject ProgressPollDecisionPolicy for cleaner separation
- Simplify pollForProgressChange with policy delegation
- Improve code readability and testability

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Inject ProgressPollDecisionPolicy mock in setUp
- Update test expectations for new dependencies
- Ensures tests reflect refactored service structure

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos

Copy link
Copy Markdown
Member Author

/backport to stable33

@vitormattos

Copy link
Copy Markdown
Member Author

/backport to stable32

@backportbot-libresign backportbot-libresign Bot added the backport-request Request to backport a change to supported stable branches label Jan 30, 2026
@vitormattos
vitormattos merged commit 8b2528a into main Jan 30, 2026
62 checks passed
@vitormattos
vitormattos deleted the refactor/centralize-file-status-management branch January 30, 2026 01:17
@github-project-automation github-project-automation Bot moved this from 0. Needs triage to 4. to release in LibreSign Roadmap Jan 30, 2026
@backportbot-libresign backportbot-libresign Bot removed the backport-request Request to backport a change to supported stable branches label Jan 30, 2026
@vitormattos vitormattos removed this from the Next Major (34) milestone Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant