Skip to content

[stable32] feat: file level signature flow#6171

Merged
vitormattos merged 18 commits intostable32from
backport/6169/stable32
Dec 13, 2025
Merged

[stable32] feat: file level signature flow#6171
vitormattos merged 18 commits intostable32from
backport/6169/stable32

Conversation

@backportbot-libresign
Copy link
Copy Markdown

Backport of PR #6169

Add toNumeric() and fromNumeric() methods to enable conversion between
SignatureFlow enum values and their integer database representations.

- PARALLEL = 1
- ORDERED_NUMERIC = 2

This allows storing signature flow as integers in the database while
maintaining type-safe enum usage in the code.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add signature_flow column to store signature flow mode at file level.

- Column type: SMALLINT NOT NULL DEFAULT 1
- 1 = parallel (default)
- 2 = ordered_numeric

This enables per-file configuration of signature flow, overriding the
global application setting when specified.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add signatureFlow property and enum conversion helper methods to File entity.

- New protected property: signatureFlow (SMALLINT, default 1)
- getSignatureFlowEnum(): Returns SignatureFlow enum from integer
- setSignatureFlowEnum(): Sets integer from SignatureFlow enum

These methods provide type-safe access to signature flow configuration
stored in the database.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace global config dependency with file-level signature flow.

- Add setFile() method to inject File entity
- Replace getSignatureFlow() to read from file instead of IAppConfig
- Remove IAppConfig dependency (no longer needed)
- Add validation: throws LogicException if getSignatureFlow() called without file

This enables per-file signature flow configuration while maintaining
backward compatibility through database default values.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add optional signatureFlow parameter to POST /request-signature API.

- Accepts 'parallel' or 'ordered_numeric' values
- Falls back to global configuration if not provided
- Documented in PHPDoc and OpenAPI annotations

This enables clients to specify signature flow mode per document
when creating signature requests.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add signature flow parameter processing and file configuration logic.

- Parse signatureFlow from request data and convert to enum
- Fall back to global config if parameter invalid or missing
- Set file entity signature flow via setSignatureFlowEnum()
- Initialize SequentialSigningService with file entity context
- Add IAppConfig dependency for global fallback

This completes the backend logic for per-file signature flow
configuration with graceful fallback to system defaults.

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

Update releaseNextOrder call to provide file entity context.

- Call setFile() before releaseNextOrder()
- Enables SequentialSigningService to read file-level signature flow

This ensures signature flow logic uses the correct per-file
configuration during document signing workflow.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Expose signature flow configuration in file list and detail endpoints.

FileService changes:
- Add signatureFlow to fileData object in formatFile()

SignRequestMapper changes:
- Include f.signature_flow in SELECT query
- Convert numeric value to enum string in formatListRow()
- Remove signature_flow from response (cleanup after conversion)

This enables frontend to display and use per-file signature flow
configuration.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update API documentation for request-signature endpoint.

- Add signatureFlow parameter to request body schema
- Type: string, nullable
- Description documents accepted values and fallback behavior

This ensures API consumers have accurate documentation for the
signature flow parameter.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Move database value constants from File entity to SignatureFlow enum
where they belong as the single source of truth.

- Add SignatureFlow::NUMERIC_PARALLEL and NUMERIC_ORDERED_NUMERIC
- Remove circular dependency between File and SignatureFlow
- Update all references to use enum constants
- Use descriptive names instead of abbreviations

This follows single responsibility principle: the enum owns its
database representation.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update generated TypeScript types to include signatureFlow parameter.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add signatureFlow field to ValidateFile schema in OpenAPI specs and
ResponseDefinitions.

- Update openapi.json and openapi-full.json schemas
- Add signatureFlow to LibresignValidateFile psalm type
- Mark as required field with integer type

This fixes OpenAPI validation errors in API tests.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace global config usage with file-level signature flow from store.

- RequestSignatureTab.vue: Compute signatureFlow from file data
- Signer.vue: Read signatureFlow from file instead of loadState
- Signers.vue: Check file.signatureFlow for ordered flow mode
- files.js: Use file.signatureFlow for signer order management

This enables per-file signature flow configuration in the UI.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add comprehensive unit tests for the signature flow implementation.

- SequentialSigningServiceTest: Test flow detection and order assignment
- FileTest: Test enum conversion methods in File entity
- RequestSignatureServiceTest: Fix constructor to include IAppConfig mock

Tests validate the core logic without focusing on coverage metrics.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Complete the OpenAPI schema update by adding signatureFlow field to
the ValidateFile schema definition.

This was manually corrected after the initial automated update.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
When user provides a specific signing order, the next auto-assigned
order should be the provided value + 1.

Changed condition from > to >= and set currentOrder to userProvidedOrder + 1
instead of just userProvidedOrder.

This ensures proper order sequencing when mixing user-provided and
auto-assigned orders.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@github-project-automation github-project-automation Bot moved this to 0. Needs triage in Roadmap Dec 12, 2025
@backportbot-libresign backportbot-libresign Bot added this to the Next Patch (32) milestone Dec 12, 2025
@vitormattos vitormattos merged commit a2b577f into stable32 Dec 13, 2025
62 checks passed
@vitormattos vitormattos deleted the backport/6169/stable32 branch December 13, 2025 12:31
@github-project-automation github-project-automation Bot moved this from 0. Needs triage to 4. to release in Roadmap Dec 13, 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