Refactor architecture into eight components and consolidate reliability work
Build and publish container images / images (push) Successful in 9m34s
Release container images / release (push) Successful in 36s

Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts.

Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation.

Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
This commit is contained in:
Anya Tokugawa committed 2026-11-01 15:23:31 +09:00
1 parent 9dd425f765
commit d5d21b7841
302 files changed
+20037 -3492

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
package server
import (
"context"
"net/http"
"net/http/httptest"
"os"
"os/exec"
"strings"
"testing"
"time"
)
func TestThemePreferenceDoesNotChangeDomain(t *testing.T) {
s, token, domain, _ := editorFixture(t)
for _, tc := range []struct{ value, css string }{
{"light", "/static/css/theme/light.css"},
{"index-white", "/static/css/theme/index-white.css"},
{"https://evil.test/theme.css", "/static/css/theme/dark.css"},
{"unknown", "/static/css/theme/dark.css"},
} {
r := httptest.NewRequest("GET", "http://localhost/e/-/editor-fixture", nil)
r.Header.Set("Authorization", "Bearer "+token)
r.AddCookie(&http.Cookie{Name: "pageswiki_theme", Value: tc.value})
w := httptest.NewRecorder()
s.withAuthorization(s.mux).ServeHTTP(w, r)
if w.Code != 200 || !strings.Contains(w.Body.String(), `href="`+tc.css+`"`) {
t.Fatalf("%s: %d %s", tc.value, w.Code, w.Body.String())
}
if s.getTheme(domain) != "dark" {
t.Fatal("browser preference overwrote Domain theme")
}
if !strings.Contains(strings.Join(w.Header().Values("Vary"), ","), "Cookie") {
t.Fatal("missing cache variation")
}
}
}
func TestEditorThemeChromium(t *testing.T) {
if os.Getenv("PAGESWIKI_BROWSER_TEST") != "1" {
t.Skip("opt-in Chromium")
}
s, token, domain, _ := editorFixture(t)
if err := s.store.SetConfigInDomain(domain, "editor_keymap", "vim"); err != nil {
t.Fatal(err)
}
script, err := os.ReadFile("internal/server/testdata/editor-theme.js")
if err != nil {
t.Fatal(err)
}
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.Host = "localhost"
r.Header.Set("Authorization", "Bearer "+token)
if r.URL.Path == "/fixture" {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
_, _ = w.Write([]byte("<!doctype html><body style='margin:0'><script>" + string(script) + "</script></body>"))
return
}
s.withAuthorization(s.mux).ServeHTTP(w, r)
}))
defer server.Close()
ctx, cancel := context.WithTimeout(context.Background(), 55*time.Second)
defer cancel()
args := []string{"internal/server/testdata/vim-browser-smoke.mjs", server.URL + "/fixture", t.TempDir()}
if shot := os.Getenv("EDITOR_THEME_SCREENSHOT"); shot != "" {
args = append(args, shot)
}
if out, err := exec.CommandContext(ctx, "node", args...).CombinedOutput(); err != nil {
t.Fatalf("theme: %v\n%s", err, out)
}
}