You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Policies: specificity-aware default position on the server (#1395)
* fix(policies): specificity-aware default position on the server
The UI computed a specificity-aware position for new rules client-side,
but the server defaulted a positionless create to the TOP of the owner's
list. When the client's policy list was stale (e.g. the optimistic atom
hadn't refreshed between two quick writes), the UI sent no usable
position and the top-of-list default let a broad category rule shadow a
narrower leaf rule written moments earlier — surfaced by the policies-ui
scenario failing against the production selfhost image.
Move the specificity placement into the sdk (positionForNewPattern) and
make it the server-side default for create; the React hook now reuses
the same helper so the optimistic order matches what the server commits.
* fix(policies): badge Clear works while the policies list is mid-refresh
The detail badge's Clear resolved the rule to remove by pattern-matching
the local policies list. Right after the badge authors a rule, the
post-commit refetch may not have landed, so the lookup missed and the
clear silently no-oped — the second race the policies-ui scenario hit on
the production image. Thread the resolved EffectivePolicy's policyId
through as a fallback for exactly that window.
Policy create now defaults a new rule's position below any more-specific existing rule on the server, so a broad rule written without an explicit position (stale UI, API, agent tool) cannot shadow an existing narrower rule.
0 commit comments