Skip to content

feat: policy signature flow#7518

Draft
vitormattos wants to merge 1162 commits intomainfrom
feat/policy-signature-flow-phase1-groundwork
Draft

feat: policy signature flow#7518
vitormattos wants to merge 1162 commits intomainfrom
feat/policy-signature-flow-phase1-groundwork

Conversation

@vitormattos
Copy link
Copy Markdown
Member

No description provided.

@vitormattos vitormattos added this to the Next Major (34) milestone Apr 14, 2026
@vitormattos vitormattos self-assigned this Apr 14, 2026
@github-project-automation github-project-automation Bot moved this to 0. Needs triage in Roadmap Apr 14, 2026
@vitormattos vitormattos marked this pull request as draft April 14, 2026 17:54
@vitormattos vitormattos force-pushed the feat/policy-signature-flow-phase1-groundwork branch 2 times, most recently from 955dec8 to 2b5c509 Compare April 14, 2026 20:24
@vitormattos vitormattos marked this pull request as ready for review April 14, 2026 20:34
@vitormattos vitormattos force-pushed the feat/policy-signature-flow-phase1-groundwork branch 3 times, most recently from e0949a0 to e843d15 Compare April 23, 2026 14:49
@vitormattos vitormattos marked this pull request as draft April 23, 2026 14:50
@vitormattos vitormattos force-pushed the feat/policy-signature-flow-phase1-groundwork branch 5 times, most recently from a34a632 to 6aa5f3b Compare April 28, 2026 13:46
vitormattos added a commit that referenced this pull request Apr 28, 2026
FIXES:
- Register all 6 signature_text individual policy keys in SignatureTextPolicy
- Each key now has proper normalizers and defaults matching backend
- Fix mock object type errors by converting willReturnMap to willReturnCallback
- Mock callbacks now always return string (never null) to match type hints
- Update mock expectations from once()/exactly(2) to atLeastOnce() for deleteKey()
- Align test expectations with actual migration call counts

DETAILS:
* SignatureTextPolicy: Now exposes 6 individual keys via keys() and get()
* Each key (template, template_font_size, signature_width, etc.) has proper specs
* Render mode key includes allowed values: 'default', 'graphic', 'text'
* Migration tests: Fixed mock return types to prevent TypeError
* All getValueString() calls now guaranteed to return string via callback
* Adjusted deleteKey() and setValueString() expectations to handle migration flow

Test Results Expected:
- 0 Unknown policy key errors (all 6 now registered)
- 0 Mock type errors (callbacks always return string)
- 0 Mock expectation violations (atLeastOnce accounts for cleanup calls)
vitormattos added a commit that referenced this pull request Apr 28, 2026
…olicy

- Fix useSignatureTextPolicy.ts accessing .effectiveValue instead of non-existent .value
- Simplify useSignatureTextPolicy return type annotation using ComputedRef
- Fix model.ts serializeSignatureTextPolicyConfig to return JSON string
- Fix model.ts normalizeSignatureTextPolicyConfig to handle JSON string inputs
- Fix SignatureTextRuleEditor.vue Emits type to use EffectivePolicyValue
- Remove trailing newline from SignatureTextPolicy.php

Fixes: TypeScript type checking and PHP-CS formatting failures in PR #7518
Tests: npm run ts:check passes, php-cs formatting validated
vitormattos added a commit that referenced this pull request Apr 28, 2026
FIXES:
- Register all 6 signature_text individual policy keys in SignatureTextPolicy
- Each key now has proper normalizers and defaults matching backend
- Fix mock object type errors by converting willReturnMap to willReturnCallback
- Mock callbacks now always return string (never null) to match type hints
- Update mock expectations from once()/exactly(2) to atLeastOnce() for deleteKey()
- Align test expectations with actual migration call counts

DETAILS:
* SignatureTextPolicy: Now exposes 6 individual keys via keys() and get()
* Each key (template, template_font_size, signature_width, etc.) has proper specs
* Render mode key includes allowed values: 'default', 'graphic', 'text'
* Migration tests: Fixed mock return types to prevent TypeError
* All getValueString() calls now guaranteed to return string via callback
* Adjusted deleteKey() and setValueString() expectations to handle migration flow

Test Results Expected:
- 0 Unknown policy key errors (all 6 now registered)
- 0 Mock type errors (callbacks always return string)
- 0 Mock expectation violations (atLeastOnce accounts for cleanup calls)

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
vitormattos added a commit that referenced this pull request Apr 28, 2026
…olicy

- Fix useSignatureTextPolicy.ts accessing .effectiveValue instead of non-existent .value
- Simplify useSignatureTextPolicy return type annotation using ComputedRef
- Fix model.ts serializeSignatureTextPolicyConfig to return JSON string
- Fix model.ts normalizeSignatureTextPolicyConfig to handle JSON string inputs
- Fix SignatureTextRuleEditor.vue Emits type to use EffectivePolicyValue
- Remove trailing newline from SignatureTextPolicy.php

Fixes: TypeScript type checking and PHP-CS formatting failures in PR #7518
Tests: npm run ts:check passes, php-cs formatting validated
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos force-pushed the feat/policy-signature-flow-phase1-groundwork branch 3 times, most recently from 1c39cdb to 892fbd0 Compare April 28, 2026 17:08
@vitormattos vitormattos marked this pull request as ready for review April 28, 2026 20:48
@vitormattos vitormattos marked this pull request as draft April 28, 2026 20:52
@vitormattos vitormattos force-pushed the feat/policy-signature-flow-phase1-groundwork branch 3 times, most recently from c6cc732 to 0e665a6 Compare May 4, 2026 14:31
Comment thread playwright/support/nc-provisioning.ts Fixed
Comment thread playwright/support/nc-provisioning.ts Fixed
Comment thread playwright/support/nc-provisioning.ts Fixed
vitormattos added 27 commits May 8, 2026 09:28
… update friendly_name expectation

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

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…ment, test fixes

- Add navigation lock to prevent IntersectionObserver from overriding manually-clicked chip selection during smooth scroll
- Blur chip button on mouse click to remove lingering focus ring
- Blur focused chip when activeCategory changes (scroll-driven updates)
- Guard getBoundingClientRect calls against environments lacking implementation (happy-dom tests)
- Ensure all 10 tests pass without unhandled errors

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

Create new organized structure for PolicyWorkbench refactoring:
- Catalog/ directory with components/, composables/ subdirectories
- Copy Catalog.vue (from RealPolicyWorkbench.vue) as root orchestrator
- Copy PolicyRuleCard.vue and PolicyRuleEditorPanel.vue to components/
- Copy useRealPolicyWorkbench.ts to composables/
- Add README.md documenting refactoring plan and phases

This is Phase 1 (base structure) of planned multi-phase refactoring to:
- Extract usable composables (useNavigation, useCatalogState)
- Break monolithic 4095-line component into modular pieces (~200-400 lines each)
- Improve maintainability and testability

Original files remain in place during transition period.

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

Extract two new composables to separate concerns:

- useCatalogState.ts: Search filter, layout mode (cards/compact), collapse states
  - settingsFilter, catalogLayout, isCatalogCollapsed, categoryCollapsedState
  - toggleCatalogLayout(), toggleCatalogCollapsed(), toggleCategoryCollapsed()
  - Manages persistence via userConfigStore

- useNavigation.ts: Scroll tracking, active category, IntersectionObserver
  - activeCategory, showBackToTop, category chip navigation
  - scrollToCategory(), attachScrollListener(), reconnectSectionObserver()
  - Navigation lock to prevent conflicts during smooth scroll
  - Blur management for focus ring cleanup

These will be consumed by Catalog.vue component orchestrator, reducing monolithic
component from 4095 to ~300 lines.

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

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>
- Fix NcTextField @update:modelValue binding to accept string | number
- Add optional groupCount and userCount to SettingSummary type
- Make hasActiveOverrides and formatOverrideSummary functions accept optional parameters
- Fix import path in PolicyRuleEditorPanel to use @ alias
- Fix getBoundingClientRect type guard in useNavigation

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Fix catalog user-config persistence calls to use update(key, value)
- Make catalog collapse toggle sync section states and persistence
- Expand collapsed category on chip navigation before scrolling
- Relax user config response matcher to any successful PUT
- Update policy settings visibility scenario for current create-rule guard behavior

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Render matching sections expanded while search filter is active
- Keep persisted collapsed state untouched during search-driven expansion
- Avoid chip navigation state writes while filtering
- Add Playwright regression coverage for non-persistent search expansion

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Use crypto randomBytes for test namespace generation to satisfy CodeQL
js/insecure-randomness findings on PR 7518.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update policy workbench back-to-top navigation to scroll to the
catalog toolbar/search input instead of absolute page top, and focus
the search field for faster keyboard follow-up.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Refactor useNavigation scroll helpers to reduce duplication and add
unit tests for back-to-top behavior in window and scroll-container
modes, including focus behavior for the search input.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update category activation to prioritize sections that have at least
one fully visible card inside the effective viewport (accounting for
the sticky chip bar offset). Keep geometry fallback for edge cases and
add unit tests for the new selection heuristic.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Bind catalog toolbar and chip scroller refs as reactive refs instead of
string refs, so navigation receives real DOM elements and back-to-top
can target the search toolbar.

Also add a Playwright regression test validating back-to-top returns to
the search toolbar (not absolute page top).

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Sync active category on each scroll frame (in addition to observer
updates) so chip state does not get stuck while the content scrolls.

Add Playwright coverage asserting active chip follows the section with
visible cards while scrolling.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Normalize catalog state before opening specific setting cards (expanded
sections + card view + search), and reuse this flow across footer and
signing-order e2e scenarios.

Also harden system-default persistence expectations for environments
where user-target rule creation is not exposed in the UI.

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>
@vitormattos vitormattos force-pushed the feat/policy-signature-flow-phase1-groundwork branch from 2caf7c9 to fbf3170 Compare May 8, 2026 12:34
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 0. Needs triage

Development

Successfully merging this pull request may close these issues.

2 participants