Skip to content

feat(policy): register signature rejection in the policy workbench - #9336

Merged
vitormattos merged 4 commits into
LibreSign:mainfrom
maia-andre:feat/signature-rejection-workbench-registration-8689
Nov 5, 2026
Merged

vitormattos merged 4 commits into
LibreSign:mainfrom
maia-andre:feat/signature-rejection-workbench-registration-8689

Conversation

@maia-andre

@maia-andre maia-andre commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Resolves: #8689

📝 Summary

Registers Signature Rejection in the Policy Workbench catalog and covers it through the existing Workbench flow.

This PR is stacked on #9335, which adds the module from #8688: only the last two commits are new here. Please review #9335 first. I will rebase this one onto main once it is merged.

  • Registration: rejection_enabled is added once to realDefinitions.ts, in the How signing works category. The four dependent keys are not catalog entries.
  • No engine change. useRealPolicyWorkbench.ts and policyWorkbenchCompoundPolicies.ts are untouched: load, edit, save, reload and removal all go through the generic compound flow from Make the Policy Workbench compound helper use policy definitions #8687.

🧪 How to test

  1. Open Settings → LibreSign → Document signing settings and search for rejection. Signature rejection is listed once under How signing works.
  2. Open it, create the Everyone rule, allow rejection and pick an option in each group. Save.
  3. Reload the page and open the rule again: the five values are restored.
  4. Create a group rule, reload, then remove it: the five keys of that group are cleared.

Automated:

npx vitest run src/tests/views/Settings/PolicyWorkbench/settings/signature-rejection src/tests/views/Settings/PolicyWorkbench/settings/realDefinitions.spec.ts
npx playwright test playwright/e2e/policy-workbench-signature-rejection-rule-management.spec.ts --project=chromium
cd tests/integration && vendor/bin/behat features/policies/signature_rejection_authorization.feature -v

Validation evidence

  • Focused regression/acceptance test:
    • realDefinitions.spec.ts: Signature Rejection is registered once and the four dependent keys are not.

    • signature-rejection/useRealPolicyWorkbench.spec.ts, 5 tests:

      • Signature Rejection appears once in the catalog, without its helpers.
      • A saved system rule restores all five values after reload, including values prepared while rejection is disabled.
      • A group rule is saved, reloaded and removed through the same generic flow, and removing it clears all five keys.
      • A backend validation error is shown, the editor stays open, and nothing is reported as saved.

      The error test mocks the request failure the same way the existing Workbench save-error tests do. All 5 fail without the registration line.

    • Playwright policy-workbench-signature-rejection-rule-management.spec.ts: configures a system rule, checks the compound request carries the five values, reloads, checks the five values in the editor and through the API, then restores the five keys as it found them. It passed in the local devcontainer twice: starting from an existing explicit rule and starting from the built-in defaults.

    • Later review coverage: the fallback through createRealPolicyWorkbenchState() for true and false; Playwright reopening the saved rule through Edit after reload and changing a locked system rule in both directions, 3 of 3 passing; Preferences.spec.ts saving and clearing the five values.

    • Behat policies/signature_rejection_authorization.feature, 18 scenarios and 450 steps passing in the local devcontainer after rebasing on main: who may write each rule with real subadmin and delegation fixtures, refusals that store nothing, delegated limits under a group rule created by an instance admin, and saving and clearing a personal preference. Group admin cases are covered through the API, not in the browser.

  • Relevant lint/type/static-analysis checks: npm run lint (no errors, no warnings in the changed files), npm run stylelint, npm run ts:check.
  • Broader suite required by the changed surface: npx vitest run src/tests/views/Settings/PolicyWorkbench src/tests/views/Preferences src/tests/store/policies.spec.ts, 109 files and 769 tests passing.
  • CI reviewed

🎨 UI / Front-end changes

  • Signature rejection card under How signing works, editing the five rejection settings as one rule.
  • Screenshots before/after added for user-visible changes
Catalog Editor with the defaults
Signature rejection card in the catalog Editor with rejection disabled and the default options
Rule being configured Same rule after a page reload
Editor with rejection allowed and one option chosen in each group Editor reopened after reload with the five values restored
Card after reload Setting after reload
Card summary after reload Setting dialog with the Everyone rule after reload
  • Tested in relevant browsers when applicable: Chromium (Playwright)
  • Component/unit (Vitest) and/or E2E (Playwright) tests added or updated
  • Accessibility verified when applicable: each radio group is a fieldset with a legend; no further audit
  • Design review approved when applicable
  • Documentation updated when applicable: not applicable

✅ Checklist

  • I have read and followed the contribution guide.
  • The diff does not contain unrelated refactors or generated changes.
  • Commits follow Conventional Commits where applicable.
  • All commits include the required DCO sign-off.

🤖 AI (if applicable)

  • The content of this PR was partially or fully generated using AI

@maia-andre
maia-andre requested a review from a team as a code owner November 2, 2026 21:50
@vitormattos
vitormattos self-requested a review November 3, 2026 13:13

@vitormattos vitormattos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Requesting focused verification of instance-admin and delegated group-admin behavior before merge; see the inline test matrix.

Add the policy-local module for the five rejection_* settings: a typed
model, a definition that maps them through the generic compound
contract, and a rule editor. Values that do not apply while rejection
or the comment is disabled are kept, so they can be prepared before
the setting is turned on. Delegation and audience rules stay with the
backend.

The module is registered in the catalog separately.

Refs LibreSign#8688

Signed-off-by: André Maia <andrefnkmm@gmail.com>
…rences

The fallback handed the whole editor value to compound.compose() as the
value of rejection_enabled, so an enabled system value was summarized as
disabled. It now returns the value of the parent key.

The enabled switch applied the actor's own allowed values to every rule,
which locked an instance admin out of a locked system rule and a group
admin out of the locked rule of their own group. The limit now applies
only to user rules and preferences, and the backend decides the rest.

The preferences screen saved the editor object on rejection_enabled,
which the backend normalized to false while answering 200, and ignored
the other four values. A personal preference behavior now reads the five
values, saves them through the compound endpoint and clears all of them.

The composed summary no longer escapes labels that are already translated.

Signed-off-by: André Maia <andrefnkmm@gmail.com>
List rejection_enabled once in the catalog, under how signing works.
The four dependent settings stay out of the catalog and are edited
through the parent, using the generic compound flow without any
engine change.

Cover the flow with focused tests: a system rule restores the five
values after reload, a group rule is saved, reloaded and removed
through the same flow, and a backend validation error stays visible
instead of being reported as a successful save. A Playwright scenario
configures a system rule, reloads and checks the five values.

Refs LibreSign#8689

Signed-off-by: André Maia <andrefnkmm@gmail.com>
…le edits

A Behat feature exercises who may write the rules with real subadmin and
delegation fixtures: instance admin on locked system and group rules,
group admin on the system rule, on a managed group with and without
delegation and on an unmanaged group, and a regular user. Refusals also
assert that nothing was stored. It also covers the delegated limits and
saving and clearing a personal preference of the five values.

The Playwright scenario now reopens the saved rule through its Edit
action after reload, and two new scenarios change a locked system rule
from there. Workbench and preferences tests run the real paths, with a
non-default comment audience so that a dropped key cannot pass.

Signed-off-by: André Maia <andrefnkmm@gmail.com>
@maia-andre
maia-andre force-pushed the feat/signature-rejection-workbench-registration-8689 branch from 1915b55 to 6fa2971 Compare November 5, 2026 00:48
vitormattos
vitormattos previously approved these changes Nov 5, 2026
@maia-andre
maia-andre dismissed vitormattos’s stale review November 5, 2026 13:45

The merge-base changed after approval.

@vitormattos
vitormattos merged commit c9c3421 into LibreSign:main Nov 5, 2026
67 checks passed
@vitormattos vitormattos added this to the Next Major (36) milestone Nov 6, 2026 — with ChatGPT Codex Connector
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.

Register Signature Rejection in Policy Workbench and add flow tests

2 participants