fix(panel): mark platform system services read-only in the fleet table
login/lobby carry reserved names, so every per-server route rejects them — yet the cockpit offered claim/stop/wake and a console link on their rows, each answering 400 bad_name. The fleet view now marks them (system:true, shared naming.IsSystemServer) and the panel renders a plain label instead of dead actions.
This commit is contained in:
9 files changed
+99
-4
No files matched your search
@@ -46,6 +46,15 @@ const (
|
||||
SystemLobbyServer = "lobby"
|
||||
)
|
||||
|
||||
// IsSystemServer reports whether name is one of the platform-provisioned system
|
||||
// services above. They carry reserved names on purpose, and the API's per-server
|
||||
// routes reject those names outright (ValidateServerName) — so a caller that only
|
||||
// DISPLAYS fleet rows uses this to mark them as not user-manageable instead of
|
||||
// offering actions (claim/wake/stop/console) that would answer 400.
|
||||
func IsSystemServer(name string) bool {
|
||||
return name == SystemLoginServer || name == SystemLobbyServer
|
||||
}
|
||||
|
||||
// ServiceTokenSecretName / ServiceTokenSecretKey name the internal-API bearer
|
||||
// credential Secret (spec §7). They are one source of truth shared across
|
||||
// subsystems: the platform renderer wires this Secret into the felis-api
|
||||
|
||||
@@ -42,6 +42,21 @@ func TestValidateServerName(t *testing.T) {
|
||||
// ValidateSystemServerName keeps the format rule but drops the reservation
|
||||
// check, so the platform can provision the reserved system names (login, lobby)
|
||||
// that ValidateServerName correctly refuses to hand to users.
|
||||
func TestIsSystemServer(t *testing.T) {
|
||||
// Exactly the platform's two system services answer true; a user server that
|
||||
// merely sounds systemic does not.
|
||||
for _, name := range []string{"login", "lobby"} {
|
||||
if !naming.IsSystemServer(name) {
|
||||
t.Errorf("IsSystemServer(%q) = false, want true", name)
|
||||
}
|
||||
}
|
||||
for _, name := range []string{"survival", "admin", "login2", "", "lobby-"} {
|
||||
if naming.IsSystemServer(name) {
|
||||
t.Errorf("IsSystemServer(%q) = true, want false", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateSystemServerName(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
|
||||
Reference in new issue
Block a user