Files
scadaproj/components/ui-theme/validation/secrets-ui/SEC02-04.md
T

34 lines
9.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SEC-02–04 review checkpoint
Managed worktree `codex/scada-ui-consistency`, after SEC-01 `f07bd3c` and accepted G1. No release/version changes beyond exact Theme package adoption; no deployment or real-secret activity.
## Implemented contracts
**SEC-02:** central Theme reference `0.2.0` → exact `1.0.0`. Every editor control has a stable per-instance ID and visible associated label. Name and value hints, optional non-credential description guidance, field-local invalid-name error IDs and conditional `aria-invalid`/`aria-describedby` use the Theme API. Password/new-password behavior preserved. Invalid-name focus occurs after the controls have been re-enabled and rendered, verified with real keyboard/browser state. Required-name help documents existing normalization/450-character constraints, without changing validation rules. BusyText and caller-disabled states are separated; idle Cancel remains operable. General errors announce only non-sensitive outcomes.
**SEC-03:** namespaced native `<dialog>` with associated exact-target title/description, initial Cancel focus and an RCL DOM module. The top layer prevents a transformed host ancestor from clipping the dialog and supplies native background inertness without altering pre-existing inert attributes. Actual keydown/cancel events synchronously prevent defaults; forward/reverse Tab wrap, safe Escape closes, busy Escape/Cancel cannot imply rollback. Each instance captures its own trigger and stores cleanup by instance handle so Blazor removal does not require resolving an already-removed element reference. Delete captures target/auth/callback/token and cache/logger before mutation waits; forced target changes cannot drift audit/cache target or invoke an obsolete completion. All existing audit-failure/authorization checks are retained. The list chooses adjacent row, then its stable heading, as focus fallback. Activation/close/disposal are serialized behind a private lifecycle gate; attempted activation is tracked before the JS await, and repeated DisposeAsync calls share the same cleanup task. Strict deferred-open tests verify close before module/reference disposal and prevent old target/Visible continuations closing a newer identity. Native `::backdrop` is the single .45 dimming layer; the retained namespaced child is transparent and non-interactive. Dialog/card explicitly use border-box without depending on a host reset.
A real two-host browser regression caught the child-disposal/parent-render ordering problem: adjacent controls were still disabled when immediate focus restoration ran. The module now restores focus after actual DOM mutation using a bounded observer; it removes native listeners and restores scroll immediately, disconnects the observer after successful focus or a three-second bound, and avoids stealing focus from a newer modal. It excludes hidden/visibility-hidden ancestors, verifies actual focus, then tries the logical fallback if a connected trigger rejects focus; it observes hidden/style/class/disabled/inert changes while waiting for a legitimately disabled adjacent action. Both hosts confirm the corrected behavior. This is supported-modern-browser native dialog behavior, not a promise for IE or engines lacking `showModal`/`:modal`.
**SEC-04:** initial loading, empty metadata inventory and read failure are distinct. Failures retain prior metadata and expose Retry refresh. Committed save/delete plus failed refresh closes the completed editor/dialog and reports “Change saved; list refresh failed”; Retry reads metadata and never replays a mutation. Listing owns linked read cancellation and generation checks; disposed or superseded reads do not update current UI. No values/ciphertext are included in list projections. A new current-generation mutation clears the previous generic success outcome on busy=true; failed Rotate/Delete cannot retain another operation’s “Change saved.” message. Prior metadata/read-error evidence remains intact.
## Evidence and limitations
- SEC-02 red: 3 failures/3 association/unique-ID/invalid-state tests. Initial editor-focused green: 22 passed. Initial full SEC-02: 53 passed; an idle Cancel regression was subsequently added when replacing unmatched component disabled attributes with explicit Razor expressions.
- SEC-03 red: the required associated dialog-name regression failed. Existing strict JS tests now permit only the exact `./_content/ZB.MOM.WW.Secrets.Ui/js/secrets-dialog.js` module and its `open`/`setBusy`/`close` calls; arbitrary confirm/alert remains forbidden. Helper/stub constructors in policy/audit tests are necessary integration changes; no assertions were weakened.
- SEC-04 red: 3 failed/1 passed; original component threw initial/refresh exceptions and lacked explicit loading. Added separate committed-save and committed-delete retry checks, and cancellation of an unmounted delayed read.
- Final whole Release UI suite: **69 passed, 0 failed, 0 skipped** (`SEC02-04-after.trx`, `.log`). All 50 SEC-01 identities/outcomes preserved, 19 additional regressions (`SEC02-04-test-identities.json`). `git diff --check -- ZB.MOM.WW.Secrets` passed.
- Browser Chromium **157.0.8103.78**, 20 checks × 2 hosts = **40 passed**, zero page errors (`SEC02-04-browser-final.json`). Before-fix focus failures are retained separately. First setup attempts are retained as fixture corrections: HTTP synthetic auth registration, label-specific selection, and an explicit OnAfterRender readiness marker to avoid clicks on prerendered nodes.
- Source canary origins: per-page **http://127.0.0.1:53202**, global-interactive Bootstrap **http://127.0.0.1:53233**. They use source UI assembly **0.6.6.0** and published Theme **1.0.0.0**, not a claimed UI1.0.0 package. The per-page fixture links the exact current OtOpcUa `SecretsAdmin.razor` wrapper and intentionally omits Bootstrap as a diagnostic; the other composes the page under a global interactive router with the actual vendored Bootstrap CSS. Source hashes and actual provenance are saved. No RCL assembly routes are registered alongside the wrapper, avoiding the duplicated `/admin/secrets` route.
- Independent review hardening: deferred-open disposal negative probe **1 failed** (`SEC03-lifecycle-red.*`); lifecycle final focused **4 passed** (`SEC03-lifecycle.*`). Recording runtime accepts only the exact import and module methods, rejects disposed-reference invocation, and asserts one close then module disposal. Two repeated disposal callers both await that cleanup. Stale-success negative probe **2 failed** (`SEC04-outcome-red.*`); both final two-operation cases pass.
- Focused JS-module browser probe: **12/12** (hidden trigger/ancestor, disabled trigger, visible nonfocusable trigger, disabled adjacent action becoming enabled, hidden Tab controls) in `SEC03-focus-probe.json`. Focused rebuilt component confirmation (`SEC03-reviewed-component-browser.json`) passed all checks at **http://127.0.0.1:54281** (390px per-page) and **http://127.0.0.1:54288** (1440px Bootstrap), including hidden-origin fallback, three successive deletions ending at heading focus, native overlay cleanup, and no page errors. Computed backdrop rgba(15,18,20,.45), child transparent; card widths358/390 and480/1440 with border-box. Inspected `SEC03-dialog-perpage.png` and `SEC03-dialog-bootstrap.png`; long targets wrap inside the card. These processes supersede the prior source-canary sessions; prior evidence retains its actual origins. No broad screenshot loop.
- These are disposable loopback synthetic hosts, not the complete deployed OtOpcUa/ScadaBridge applications. Fakes contain illustrative strings only, no keys, LDAP, SQL or production network services. Only these own process sessions were restarted; no other worker’s ports were used.
- Keyboard cases include real label activation/error focus, safe focus, Tab/Shift+Tab, attempted background focus, Escape, busy Escape/Cancel/parent switching, failed delete, adjacent focus, scroll unlock, committed refresh recovery, metadata-only retry, manage-only visibility and denied HTTP403 route access. Native dialog suitability is established for this tested browser, including a transformed parent and Bootstrap collision resistance.
- Final desktop/mobile/zoom/contrast/long-name visual checks remain for the completed metadata/filter/reveal surface in SEC-05–07. Packaged two-host acceptance, published Core/replicator compatibility and feed-only restore remain SEC-07. This checkpoint does not claim those gates.
## Remaining work and release constraints
SEC-05 metadata filtering/action context, SEC-06 reveal outcome privacy, then SEC-07 packaging. Parent approves the minimal prospective package set **Ui1.0.0 + Abstractions0.6.6**; global/Core/backend version remains0.6.6 source without an incidental release. Before release, demonstrate published Core0.6.2/0.6.3 and replicator binary compatibility with Abstractions0.6.6 (DIM snapshot API and name length delta), immutable clean-source provenance, exact package dependency contents, isolated restore and immediate version-collision check. No wildcard packing/publication.
Rollback SEC-02–04 source/tests together with Theme package pin when necessary, preserving SEC-01 target isolation. There is no data/schema migration; never replay credential mutations as UI recovery or rollback. Parent accepted the batch after the source review fixes and actual two-host proofs. Commit uses only owned SEC-02–04 paths; SEC-05–06 follow in the next reviewed batch.