Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
4421f36
docs(specs): record spec 035 T001 re-check and open OD-9
claude Nov 19, 2026
d7c560f
test(api): add FTB and CurseForge modpack registry fixtures
claude Nov 19, 2026
fcaae6e
feat(operator): add modpack CRD fields for spec 035
claude Nov 19, 2026
dd99f13
feat(api): record modpacks in spec.modpack and add GET /servers/{name…
claude Nov 19, 2026
b0fa3b5
feat(operator): render and apply GameServer modpacks
claude Nov 19, 2026
4d549d4
feat(api): list CurseForge modpack files filtered by version and loader
claude Nov 19, 2026
c627a4e
feat(api): add keyless FTB modpack registry engine
claude Nov 19, 2026
73007e7
feat(api): read small agent files through /files/read
claude Nov 19, 2026
0017a7d
feat(api): add modpack and key-sharing message ids
claude Nov 19, 2026
ecef161
feat(api): record modpacks in spec.modpack and add remove and adoption
claude Nov 19, 2026
6f0f6a3
feat(api): add admin toggle to share the CurseForge key with servers
claude Nov 19, 2026
97c61e9
test(api): cover modpack routes, missing files, adoption and key sharing
claude Nov 19, 2026
fd4a6c8
feat(operator): modpack backup, adoption hold and removal wipe
claude Nov 19, 2026
1901943
test(operator): envtest coverage for modpack backup, adoption and rem…
claude Nov 19, 2026
58a9abf
style(api): keep modpack message ids in alphabetical order
claude Nov 19, 2026
778d113
docs(specs): mark spec 035 API tasks T015 T019 T020 T022 T030 T034 T0…
claude Nov 19, 2026
7d8b2d0
fix(api): forward modpack type to versions and clear adoption pin on …
claude Nov 19, 2026
f841d68
fix(agent): allow /files/read of pack manifest dotfiles
claude Nov 19, 2026
641367e
docs(api): correct destination label comment
claude Nov 19, 2026
0f24e3c
test(api): cover install clearing the adoption pin
claude Nov 19, 2026
e8e74fa
docs(specs): point spec 035 operator envtest tasks at their files
claude Nov 19, 2026
aa9c24f
docs: document spec 035 modpacks in specs, module authoring and security
claude Nov 19, 2026
6601db5
test(e2e): add spec 035 modpack drills
claude Nov 19, 2026
0fecc65
test: assert spec.modpack writes in modpack install tests
claude Nov 19, 2026
7cad4d4
docs(specs): fix spec 035 operator env rendering rule 1 wording
claude Nov 19, 2026
bf0529c
docs(specs): record OD-9 ruling and env-based key sharing for spec 035
claude Nov 19, 2026
2366ebe
feat(operator): share the CurseForge key with modpack servers via sec…
claude Nov 19, 2026
248cb45
test(operator): envtest for CurseForge key sharing
claude Nov 19, 2026
24bc56d
fix(operator): read the shared CurseForge key through a resourceNames…
claude Nov 19, 2026
24cda1e
test(operator): kick reconciles in key-sharing envtest instead of rel…
claude Nov 19, 2026
256efd5
docs: align spec 035 docs with built key sharing and API-only scope
claude Nov 19, 2026
9f08fbf
fix(operator): log forbidden CurseForge key reads at info level
claude Nov 19, 2026
763cc4f
docs: describe built CurseForge key sharing in operator specs
claude Nov 19, 2026
b1850bf
docs(specs): tick T059
claude Nov 19, 2026
931b427
feat(operator): apply CurseForge key-share toggles at 0 players (OD-10)
claude Nov 19, 2026
e5ee61c
docs(specs): record OD-10 for key sharing restarts
claude Nov 19, 2026
8b9edc3
fix(operator): only let a rolling pack apply release a held key-share…
claude Nov 19, 2026
9d7cb77
feat(design): spec 035 Modpacks tab in design.fig (CurseForge, FTB, p…
claude Nov 22, 2026
7ea4ed2
fix(design): spec 035 icon colours, mobile row truncation and clipped…
claude Nov 22, 2026
6774c4b
fix(design): keep spec 035 design pass from changing other screens
claude Nov 22, 2026
9c53aa4
docs(specs): record spec 035 design approval (T013)
claude Nov 22, 2026
7006dcf
feat(web): modpack client, registry filters and CurseForge key share …
claude Nov 22, 2026
4f3a187
feat(web): modpack version picker and confirm dialog
claude Nov 22, 2026
1f0e10f
feat(web): modpack active card and missing files notice
claude Nov 22, 2026
edbf18a
feat(web): modpack install, change and remove flow in the Modpacks tab
claude Nov 22, 2026
b99992b
feat(api): expose modpack version release type, publish date and key …
claude Nov 22, 2026
8b958d4
feat(web): show version badges, key source and wire Open Files
claude Nov 22, 2026
660057a
fix(web): place startup-flag badge per design and keep the role error…
claude Nov 22, 2026
56d9d8c
fix(web): show the startup-flag pill in place of Configured
claude Nov 22, 2026
550d804
test(web): move modpack tab tests to the confirm-dialog install flow
claude Nov 22, 2026
6ebfe70
chore: regenerate i18n extraction and gofmt after rebase
claude Nov 22, 2026
f32c101
chore: name the spec 035 changelog entry after PR 1055
claude Nov 22, 2026
5dc947d
fix(web): use allowed <b> tag in modpack i18n message; close e2e resp…
claude Nov 22, 2026
d5ef4bc
fix(operator): rename CurseForge key constants to avoid gosec G101 (l…
claude Nov 22, 2026
f5e9533
fix(api): ctx in putShare, NewRequestWithContext, unused param and he…
claude Nov 22, 2026
ccfc841
fix(web): derive modpack dialog state without setState in effect (lint)
claude Nov 22, 2026
27a4cff
fix(operator): init nil annotations in mutateManagedCFKey test helper
claude Nov 22, 2026
0cfedb6
fix(web): show the shared-key hint when CurseForge is the only blocke…
claude Nov 22, 2026
e19cedb
test(e2e): print the game container logs when a modpack boot fails
claude Nov 22, 2026
db892de
test(e2e): use a server-safe CurseForge pack in the modpack drills
claude Nov 22, 2026
5f97efe
test(e2e): retry mods-folder deletes on 429 in the modpack switch drill
claude Nov 22, 2026
9057288
test(api): expect 202 Pending and the share routes for spec 035 modpacks
claude Nov 22, 2026
93ffefc
fix(operator): retry modpack installs by request id and decide supers…
claude Nov 22, 2026
c80318a
fix(api): stamp a request id on modpack installs and treat remote clu…
claude Nov 22, 2026
fc204ba
fix(web): refresh the CurseForge share switch after a key save or delete
claude Nov 22, 2026
591e459
test(e2e): return false instead of Fatalf inside the pin drill's Even…
claude Nov 22, 2026
5623e9b
docs: fix changelog, spec task file names and operator modpack notes
claude Nov 22, 2026
9d4313e
fix: carry the modpack install request id in spec.modpack, not an ann…
claude Nov 22, 2026
d8dc6a3
style(operator): gofmt the GameServer modpack spec
claude Nov 22, 2026
36d273f
fix(operator): keep pre-change modpack backups when the server is del…
claude Nov 22, 2026
fb1d14b
docs(specs): record backup ownership decision and document modpack AP…
claude Nov 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 19 additions & 1 deletion agent/internal/files/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ func hasDotComponent(rel string) bool {
return strings.HasPrefix(rel, ".") || strings.Contains(rel, "/.")
}

// readableDotfiles are the only dotfiles /files/read serves: the pack
// manifests the itzg image writes at the data root, which the API reads to
// adopt a legacy modpack (spec 035, research R6). Exact root-level names; no
// other operation, directory or dotfile is affected.
var readableDotfiles = map[string]struct{}{
".modrinth-modpack-manifest.json": {},
".curseforge-manifest.json": {},
}

// readComponents is components() for /files/read: it additionally admits the
// readableDotfiles names, matched exactly after the leading slash is trimmed.
func (h *handler) readComponents(rel string) ([]string, error) {
if _, ok := readableDotfiles[strings.TrimPrefix(rel, "/")]; ok {
return []string{strings.TrimPrefix(rel, "/")}, nil
}
return h.components(rel)
}

type handler struct {
archiveLock sync.Mutex
root string
Expand Down Expand Up @@ -161,7 +179,7 @@ func (h *handler) list(w http.ResponseWriter, req *http.Request) {
}

func (h *handler) read(w http.ResponseWriter, req *http.Request) {
comps, err := h.components(req.URL.Query().Get("path"))
comps, err := h.readComponents(req.URL.Query().Get("path"))
if err != nil {
h.fail(w, err)
return
Expand Down
89 changes: 89 additions & 0 deletions agent/internal/files/readable_dotfiles_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package files

import (
"io"
"net/http"
"net/url"
"os"
"path/filepath"
"testing"
)

func TestReadAllowsPackManifestDotfiles(t *testing.T) {
srvURL, root := newServer(t)
for _, name := range []string{".modrinth-modpack-manifest.json", ".curseforge-manifest.json"} {
if err := os.WriteFile(filepath.Join(root, name), []byte(`{"versionId":"v1"}`), 0o600); err != nil {
t.Fatalf("write %s: %v", name, err)
}
for _, p := range []string{name, "/" + name} {
resp := get(t, srvURL, "/files/read", url.Values{"path": {p}})
body, _ := io.ReadAll(resp.Body)
_ = resp.Body.Close()
if resp.StatusCode != http.StatusOK || string(body) != `{"versionId":"v1"}` {
t.Fatalf("read %q = %d %q", p, resp.StatusCode, body)
}
}
}
}

func TestReadStillRejectsOtherDotfiles(t *testing.T) {
srvURL, root := newServer(t)
for _, name := range []string{".mods-manifest.json", ".env"} {
if err := os.WriteFile(filepath.Join(root, name), []byte("x"), 0o600); err != nil {
t.Fatalf("write: %v", err)
}
}
if err := os.Mkdir(filepath.Join(root, "sub"), 0o700); err != nil {
t.Fatalf("mkdir: %v", err)
}
if err := os.WriteFile(filepath.Join(root, "sub", ".curseforge-manifest.json"), []byte("x"), 0o600); err != nil {
t.Fatalf("write nested: %v", err)
}
for _, p := range []string{".mods-manifest.json", ".env", "sub/.curseforge-manifest.json", "/.curseforge-manifest.json/../.env"} {
resp := get(t, srvURL, "/files/read", url.Values{"path": {p}})
_ = resp.Body.Close()
if resp.StatusCode != http.StatusBadRequest {
t.Fatalf("read %q = %d, want 400", p, resp.StatusCode)
}
}
}

func TestReadManifestDotfileSymlinkNotFollowed(t *testing.T) {
srvURL, root := newServer(t)
outside := filepath.Join(t.TempDir(), "outside.json")
if err := os.WriteFile(outside, []byte("secret"), 0o600); err != nil {
t.Fatalf("write outside: %v", err)
}
if err := os.Symlink(outside, filepath.Join(root, ".curseforge-manifest.json")); err != nil {
t.Fatalf("symlink: %v", err)
}
resp := get(t, srvURL, "/files/read", url.Values{"path": {".curseforge-manifest.json"}})
body, _ := io.ReadAll(resp.Body)
_ = resp.Body.Close()
if resp.StatusCode == http.StatusOK || string(body) == "secret" {
t.Fatalf("symlinked manifest served: %d %q", resp.StatusCode, body)
}
}

func TestManifestDotfilesNotWritableOrDeletable(t *testing.T) {
srvURL, root := newServer(t)
name := ".curseforge-manifest.json"
if err := os.WriteFile(filepath.Join(root, name), []byte("x"), 0o600); err != nil {
t.Fatalf("write: %v", err)
}
req, err := http.NewRequestWithContext(t.Context(), http.MethodDelete, srvURL+"/files/delete?path="+name, nil)
if err != nil {
t.Fatalf("req: %v", err)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
t.Fatalf("delete: %v", err)
}
_ = resp.Body.Close()
if resp.StatusCode != http.StatusBadRequest {
t.Fatalf("delete = %d, want 400", resp.StatusCode)
}
if _, err := os.Stat(filepath.Join(root, name)); err != nil {
t.Fatalf("manifest removed: %v", err)
}
}
17 changes: 13 additions & 4 deletions api/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ func main() {
// rbac.Middleware and handlers.MountPods read it to gate pod and event reads.
scope.SetControlPlaneNamespace(cfg.namespace)

// Internal reads use the same selected cluster and credentials as
// browser-facing agent routes, including remote-only management installs.
agentLister := ws.NewClusterAgentClient(reg, credentialsNS, cfg.agentCABundle, cfg.agentClientCert, cfg.agentClientKey)
// Protected API
r.Group(func(p chi.Router) {
p.Use(sessions.Authenticate)
Expand Down Expand Up @@ -433,6 +436,9 @@ func main() {
handlers.MountSystemLogs(p, k8s, cfg.namespace)
handlers.MountModulesWithRegistry(p, reg, moduleConfigMapNS)
handlers.MountRegistrySecrets(p, k8s, credentialsNS)
handlers.MountRegistryShareWithOptions(p, k8s, credentialsNS, handlers.RegistryShareOptions{
StartupKeySet: cfg.curseforgeAPIKey != "",
})
// Precedence: a runtime, admin-configured key (DB row + labelled
// Secret, resolved lazily per registry.DBKeyFunc) always wins over
// the startup --curseforge-api-key flag, so adding/rotating a key
Expand All @@ -444,10 +450,12 @@ func main() {
registry.DBKeyFunc(store, registry.NewK8sSecretReader(k8s, credentialsNS)),
registry.StaticKeys(map[string]string{"curseforge": cfg.curseforgeAPIKey}),
))
handlers.MountRegistryWithRegistry(p, reg, regSet)
// Internal reads use the same selected cluster and credentials as
// browser-facing agent routes, including remote-only management installs.
agentLister := ws.NewClusterAgentClient(reg, credentialsNS, cfg.agentCABundle, cfg.agentClientCert, cfg.agentClientKey)
handlers.MountRegistryWithOptions(p, reg, regSet, handlers.RegistryOptions{
Audit: auditor,
Home: k8s,
ControlNS: credentialsNS,
Files: agentLister,
})
handlers.MountModUpdatesWithRegistry(p, reg, regSet, agentLister)
// ID-managed mods (ARK CurseForge ids, Project Zomboid MOD_IDS,
// Steam Workshop lists): the API only writes GameServer.spec.mods.ids;
Expand Down Expand Up @@ -488,6 +496,7 @@ func main() {
jobs.Go(func() { sessions.RunGC(leaderCtx, time.Hour) })
jobs.Go(func() { notify.New(store, k8s, credentialsNS).RunWithRegistry(leaderCtx, reg) })
jobs.Go(func() { reporter.Run(leaderCtx) })
jobs.Go(func() { handlers.RunModpackAdoptSweep(leaderCtx, reg, agentLister, logger) })
jobs.Go(func() {
auditor.RunRetention(leaderCtx, time.Duration(cfg.auditRetentionDays)*24*time.Hour, 24*time.Hour, logger)
})
Expand Down
1 change: 1 addition & 0 deletions api/cmd/mounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var homeClientMounts = []string{
"handlers.MountClusters",
"handlers.MountNotifications",
"handlers.MountRegistrySecrets",
"handlers.MountRegistryShareWithOptions",
"handlers.MountSystemLogs",
}

Expand Down
13 changes: 10 additions & 3 deletions api/internal/handlers/cluster_guard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,15 @@ func TestRegistry_ServesHomeClusterOnly(t *testing.T) {
}

for _, q := range []string{"", "?cluster=local"} {
rr := do(t, r, rt.method, rt.path+q, rt.body)
if rr.Code != http.StatusOK {
t.Errorf("query=%q: got %d, want 200: %s", q, rr.Code, rr.Body)
lk := registryHomeClient()
lr := mountRegistryRouter(lk, fakeSet{p: &fakeProvider{}})
rr := do(t, lr, rt.method, rt.path+q, rt.body)
want := http.StatusOK
if rt.path == "/servers/alpha/modpack" && rt.method == http.MethodPost {
want = http.StatusAccepted
}
if rr.Code != want {
t.Errorf("query=%q: got %d, want %d: %s", q, rr.Code, want, rr.Body)
}
}
})
Expand Down Expand Up @@ -275,6 +281,7 @@ func mountHomeClientRoutes(t *testing.T, r chi.Router, home *kube.Client, reg *k
MountClusters(r, reg, home, controlNS)
MountSystemLogs(r, home, controlNS)
MountRegistrySecrets(r, home, controlNS)
MountRegistryShareWithOptions(r, home, controlNS, RegistryShareOptions{})
}

// TestHomeClientMounts_ServeHomeClusterOnly calls every route of the
Expand Down
5 changes: 3 additions & 2 deletions api/internal/handlers/destinations.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ import (
)

// destinationLabel marks a Secret as a Gameplane backup destination. The
// agent and operator never read this label — it's purely a discovery
// hint for the API.
// agent never reads this label. The operator reads it only to decide
// whether any destination exists for a modpack removal or change backup
// (spec 035); otherwise it is a discovery hint for the API.
const destinationLabel = "gameplane.local/backup-destination"

// MountDestinations wires /backup-destinations onto the supplied router.
Expand Down
3 changes: 2 additions & 1 deletion api/internal/handlers/mod_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
// Registry provider credentials are deliberately not part of this target: those
// remain centrally configured by the API administrator.
type modTarget struct {
cluster string
k *kube.Client
namespace string
server *unstructured.Unstructured
Expand Down Expand Up @@ -119,7 +120,7 @@ func loadModTarget(w http.ResponseWriter, req *http.Request, clients *kube.Regis
http.NotFound(w, req)
return nil, false
}
target := &modTarget{k: k, namespace: ns, server: gs}
target := &modTarget{cluster: cluster, k: k, namespace: ns, server: gs}
templateName, _, _ := unstructured.NestedString(gs.Object, "spec", "templateRef", "name")
if templateName != "" {
target.template, err = k.Dynamic.Resource(kube.GVRs["templates"]).Get(req.Context(), templateName, metav1.GetOptions{})
Expand Down
8 changes: 6 additions & 2 deletions api/internal/handlers/mod_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ func TestClusterModWritesRetryOnlyUnchangedTarget(t *testing.T) {
if test.want == http.StatusOK {
wantUpdates = 2
}
if response.Code != test.want || updates != wantUpdates || kubeClientCalls(t, home) != 0 {
t.Fatalf("status=%d want=%d updates=%d want=%d home calls=%d body=%s", response.Code, test.want, updates, wantUpdates, kubeClientCalls(t, home), response.Body)
wantStatus := test.want
if test.want == http.StatusOK && route.method == http.MethodPost && route.path == "/servers/alpha/modpack" {
wantStatus = http.StatusAccepted
}
if response.Code != wantStatus || updates != wantUpdates || kubeClientCalls(t, home) != 0 {
t.Fatalf("status=%d want=%d updates=%d want=%d home calls=%d body=%s", response.Code, wantStatus, updates, wantUpdates, kubeClientCalls(t, home), response.Body)
}
stored, err := client.Tracker().Get(kube.GVRs["servers"], scope.DefaultNamespace, "alpha")
if err != nil {
Expand Down
Loading
Loading