fix(policies): decode the capability mask when reopening a policy - #20
Merged
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
A saved policy stores only the compiled mask, so the capability and level pickers reopened empty and an operator could not see or amend the requirement they had set. Decode the mask against the catalog instead: each row owns one bit, so the names follow from the bits and nothing is persisted twice.
Caret ranges on 0.x majors do not cross minors, so `^0.5.0` stopped matching once `@constructive-io/data` published 0.7.0 and the registry smoke install failed to resolve it. Track the published minors and derive the contract test's expectation from the constant.
devin-ai-integration
Bot
force-pushed
the
fix/policy-capability-picker-decode-mask
branch
from
August 10, 2026 05:19
b83cbeb to
df773db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
metaschema_public.policy.datastores what the parser compiled, not what was authored:{ "mask": "0000…00010001", "bitlen": 64, "membership_type": 2, … }rls_parserdeletescapabilities/levelsonce they are folded intomask, soCapabilitySelectField— which reads the picker's value straight out of the policy data — reopened empty on every saved policy. The requirement was still enforced, but invisible: an operator couldn't see what a policy demanded, and selecting anything replaced the existing set rather than amending it.The names are recoverable, so nothing needs to be persisted twice. Every catalog row owns one bit, so the mask is the selection:
bitsIntersectwalks from the right, so a mask compiled before its module grew (17 bits) still lines up against a 64-bit catalogbitstr— bit numbering is right-anchored andlpadpreserves it.The decode is a fallback for the untouched state only, and
isTouchedkeeps it from fighting the operator: without it, clearing the picker (which reportsundefined, not[]) would immediately snap back to the mask the form was opened with.Mirrored into
constructive-io/dashboard's vendored copy; unit tests cover the empty mask, thekindsplit, and the narrower-mask case.Link to Devin session: https://app.devin.ai/sessions/8f89acc9280e4cef880921d966e0e8fc
Requested by: @pyramation