fix(permission): make the response key lossless and migrate its readers - #1887
Conversation
The key field is the replacement for the deprecated namespace/name response fields, but reading it back was lossy: a name with dots failed to split (the parser demanded exactly 3 dot-parts), and a namespace without a slash silently gained a /default suffix on the way in. Split the key into at most 3 parts so everything after the namespace is the name, dots included. Guard the response transform: the key must parse back to the exact stored namespace/name pair, or the request fails instead of returning a key that reads back as a different permission. With the key exact, move the remaining readers of the deprecated fields onto it: the permission reconciler, the permission CLI output, and the e2e assertions (part of #1782). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughPermission handling now uses canonical keys as the source for permission namespace and name. Key parsing preserves dotted names and rejects malformed keys. Serialization and reconciliation validate keys before producing responses or applying changes. Tests cover parsing, round trips, reconciliation, and lookups. ChangesPermission Key Migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change makes permission keys lossless and updates their readers, with reported unit and end-to-end tests passing; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 31998174748Coverage increased (+0.04%) to 48.735%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
Tested live against a local server built from this branch (verified the running binary contains the new code paths).
|
Part of #1782 (the "blocked on a lossless replacement for the deprecated response fields" group).
Problem
The
keyresponse field (service.resource.verb) is the replacement for the deprecatednamespace/namefields, but reading a key back was lossy in two ways:database.instance.soft.delete./defaultsuffix while the key was built, so the key read back as a different namespace than the stored one.Because of that, three readers stayed on the deprecated fields (with
//nolint:staticcheck): the permission reconciler, the permission CLI output, and the e2e assertions. This PR makes the key read back to the exact stored values and moves those readers onto it.One behavior note: a create/update request whose
keyhas more than 3 dot-parts used to be treated as "no key" and fall back to the deprecated request fields. It now parses to a name with dots and is rejected as an invalid name. (The request-side fallbacks themselves are being removed in #1885.)Testing
keyonly, plus a test that an unsplittable key fails the run.go teston the touched packages and the full unit suite pass; the service registration e2e suite passes locally against Docker.🤖 Generated with Claude Code