v6: groups/UserType spells db_env_user as db_end_user, and is an unreferenced duplicate

未关闭
#623 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
java
领域
api, authorization

调研方向

从 io/weaviate/client6/v1/api/rbac/groups/UserType.java 开始,并将其与 rbac/users/UserType 进行比较。使用针对 src/ 的已报告 grep 来验证是否引用了 groups enum,然后确认所选的修正或删除与 public API 及服务器值 db_env_user 一致。重复项和 wire-value 的行为得到一致解决后即表示完成。

由索引模型根据 Issue 内容生成。

描述

Summary

rbac/groups/UserType spells one of its wire values db_end_user. The server's value is db_env_userenv, not end. So DB_ENV_USER can never be produced by a read, and writing it would emit a value the server rejects.

It is also unreferenced, which is almost certainly why the typo survived: nothing in src/main, src/test or src/it uses this enum. That makes it a latent defect rather than a live one, and it may be that the right fix is deletion rather than a correction — see below.

Where it comes from

io/weaviate/client6/v1/api/rbac/groups/UserType.java (6.3.1) — the whole file:

public enum UserType {
  @SerializedName("db_user")
  DB_USER,
  @SerializedName("db_end_user")   // <-- server value is db_env_user
  DB_ENV_USER,
  @SerializedName("oidc")
  OIDC
}

The server's enumeration, entities/models/d_b_user_info.go:142:

if err := json.Unmarshal([]byte(`["db_user","db_env_user"]`), &res); err != nil {

The constant is named DB_ENV_USER, so the intent was clearly db_env_user; only the string is wrong.

It is a duplicate, not the live one

There are two public UserType enums in sibling packages:

used by db_env_user
rbac/users/UserType UserAssignment, GetAssignedRolesRequest, DbUsersClient, NamespacedUsersClient, RbacITest via @SerializedName(value = "db", alternate = "db_env_user")
rbac/groups/UserType nothing db_end_user — wrong

grep -rn "UserType" src/ returns the users copy everywhere and the groups copy nowhere. (GroupType, in the same package, is used — this is not a case of the whole package being dead.)

Suggested fix

Two options, and I do not want to presume which you want:

  1. Delete rbac/groups/UserType. It is an unreferenced duplicate of a type that already exists and already handles this value correctly. The typo is evidence that nothing has ever exercised it. This removes a trap for whoever wires up the groups client next — they would reach for the enum in their own package and get the broken one. It is a public type, so removing it is a breaking change on paper, even though nothing inside the client can be broken by it.

  2. Correct the string to db_env_user. Safe and non-breaking, but leaves two divergent copies of the same concept in the tree, which is how this happened.

The attached PR does (2), as the lower-risk default. Say the word and I will switch it to (1).

Version

  • java-client 6.3.1
  • Weaviate 1.39.0
主要语言
Java
星标
34
派生
30
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

weaviate/java-client 的其他 Issue

查看 weaviate/java-client 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。