Repository navigation
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 6 |
🟢 Coverage 60.00% diff coverage · +0.02% coverage variation
Metric Results Coverage variation ✅ +0.02% coverage variation (-1.00%) Diff coverage ✅ 60.00% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (f3810e8) 94086 27848 29.60% Head commit (f815a94) 94089 (+3) 27866 (+18) 29.62% (+0.02%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#3992) 5 3 60.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
pbleser-oc
left a comment
There was a problem hiding this comment.
Looks good, thanks. The labels now live in one place, and the tests make sure a new role can't be added without one, or with a label that is already taken.
What I checked:
- The web client only reads
iconNamefromcommon.shareRoles(the theme schema inpackages/web-pkg/src/composables/piniaStores/theme.tshas no other field), so the changed label values and the removednamekey don't affect the UI. cliCommands/graphListUnifiedRoles.featureonly checks that the command succeeds, so the newLabelheader doesn't break it, and the CI is green.- The labels are the ones the CLI already printed (e.g.
SpaceManager), so its output only changes in the header. Removing the labels from the built-intheme.jsonmeans it can't override the shared ones any more. The new theme test would catch it if they came back. - Locally, the build,
go vetandgo test -racepass forservices/graph/pkg/unifiedrole,services/graph/pkg/commandandservices/web/....
The four roles without an icon are tracked in #3991, so it's fine that they're not part of this PR.
Description
Keep the short labels of the built-in unified roles in one place, the
unifiedrolepackage, and use them in both the CLI and the theme defaults of the web service:unifiedrole.GetUnifiedRoleLabel(id), which returns the label of a built-in role, or an empty string for an unknown ID. The values are the onesgraph list-unified-rolesalready printed, e.g.Viewer,SpaceManagerandDenied.graph list-unified-rolesuses the shared labels. Its first column is now calledLabelinstead ofName; the values don't change.common.shareRolesentry now has alabelwith the same value as the CLI. Before, the entries used values likeUnifiedRoleViewer,UnifiedRoleSecureVieworUnifiedRoleUploader, and the three viewer roles used anamekey instead oflabel.theme.jsonno longer sets the labels itself, so it can't override them with other values. It only sets the icons.Labelcolumn.Icons don't change, and the web client only reads
iconNamefromcommon.shareRoles, so the UI is unaffected.Related Issue
Motivation and Context
The labels were defined twice, with different values: in the CLI command, and in the theme defaults and the built-in
theme.json. The theme also used two different keys for them. A role could be added without a label, and the two places could drift apart.How Has This Been Tested?
GetUnifiedRoleLabelreturns the expected labels, and an empty string for an empty or unknown ID.labeland have nonamekey.go test -race ./services/graph/... ./services/web/...passes in all packages.go build ./...,go veton the changed packages,gofmtandgit diff --checkare clean.opencloud graph list-unified-roleslocally: theLabelcolumn shows a label for all 21 roles.cliCommands/graphListUnifiedRoles.feature. The strings it expects are still in the output; CI will run it.Screenshots (if appropriate):
Not applicable.
Types of changes
Checklist:
AI assistance: Claude Code (claude-opus-5-5) wrote the first draft of the code and the tests.