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:
Lemon-miaow committed 2026-09-23 06:51:45 +08:00
1 parent 0a36b3fda9
commit 2f90851c03
9 files changed
+99 -4

No files matched your search

+9
View File
@@ -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
+15
View File
@@ -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