Calendar: the chrome is the system UI face, and links no webfont
Brings in estilo main 260f98c, which sets --rst-font to the system UI stack and drops Onest: on Paul's ruling (2026-10-24/25) the chrome must never flash, and no loading strategy got Onest into WebKit without a frame of invisible text (estilo AGENTS.md row 9). - Pin estilo at 260f98c. - Re-run scripts/writeestilo: static/theme.css gains the new --rst-font. - The layout no longer links /static/estilo/fonts/v1/fonts.css. - estilo's font handler stays mounted, so a page cached before this still resolves its stylesheet (and credits keep listing Onest while the file is served). - TestNoPageLinksOrPreloadsAChromeWebfont replaces the test that required the link: every template, and the sign-in page as served, may not name estilo's font path, preload a font or link a font file, and v1's two files must still answer. It failed on the old layout before the link went.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 files changed,
+106
−36
go.mod+1 −1go.sum+2 −2internal/calendar/routes.go+3 −1internal/calendar/static/theme.css+5 −3internal/calendar/templates/layout.html+4 −5internal/calendartest/fontlink_test.go+0 −24internal/calendartest/nowebfont_test.go+91 −0
CI passed — run details
diff --git a/go.mod b/go.mod| index 6a6cc8a..24977c7 100644 |
| --- a/go.mod |
| +++ b/go.mod |
| @@ -14,7 +14,7 @@ require ( |
| gorm.io/gorm v1.31.2 |
| ) |
| -require amadan.net/oficina/estilo.git v0.0.0-20261024233714-f14458a4683c |
| +require amadan.net/oficina/estilo.git v0.0.0-20261025200559-260f98c42e2d |
| require ( |
| github.com/BurntSushi/toml v1.6.0 // indirect |
diff --git a/go.sum b/go.sum| index a979ce6..cb6bab9 100644 |
| --- a/go.sum |
| +++ b/go.sum |
| @@ -1,5 +1,5 @@ |
| -amadan.net/oficina/estilo.git v0.0.0-20261024233714-f14458a4683c h1:jPbFJwPi7lHe+UNe+Gbj0ivVsy+pLqMSq2EP2Xff/q0= |
| -amadan.net/oficina/estilo.git v0.0.0-20261024233714-f14458a4683c/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw= |
| +amadan.net/oficina/estilo.git v0.0.0-20261025200559-260f98c42e2d h1:p9+01xRdBD7s1viTINgQ6XoDD5ghOxYubD7FNcjhBTw= |
| +amadan.net/oficina/estilo.git v0.0.0-20261025200559-260f98c42e2d/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw= |
| amadan.net/oficina/home/connect v0.0.0-20261024233715-ff16bf56bc4d h1:9sVZBph2xUuejZt73DYaoCfoyvrvZCnuPHcyMsg562E= |
| amadan.net/oficina/home/connect v0.0.0-20261024233715-ff16bf56bc4d/go.mod h1:ix81eFV87yE9f2SXiRuxYCVM4lAgTRC5YoQMiH3+TDk= |
| amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816 h1:AFDuOio0MxNxN9ZWVc3lul1QHkNjNUCO56kXpe/Fw3I= |
diff --git a/internal/calendar/routes.go b/internal/calendar/routes.go| index c560301..3007079 100644 |
| --- a/internal/calendar/routes.go |
| +++ b/internal/calendar/routes.go |
| @@ -179,7 +179,9 @@ func (a *App) routes(h *handlers, authPlugin *rauth.Auth, list allowlist, origin |
| mux := http.NewServeMux() |
| // The app serves its own static files — the framework never does. |
| mux.Handle("GET /static/", assets.Handler()) |
| - // Onest, Calma's typeface, served by estilo under its versioned prefix. |
| + // estilo's retired v1 Onest files, kept answering so a page cached |
| + // before the chrome moved to the system face (estilo AGENTS.md row 9) |
| + // still resolves its stylesheet. No page links them. |
| mux.Handle("GET "+theme.FontPrefix, theme.FontHandler()) |
| // The sign-in door's sky: a closed set of drawings, sessionless and |
| // reachable signed out. More specific than "GET /static/", so the |
diff --git a/internal/calendar/static/theme.css b/internal/calendar/static/theme.css| index 656dafb..512ea71 100644 |
| --- a/internal/calendar/static/theme.css |
| +++ b/internal/calendar/static/theme.css |
| @@ -36,9 +36,11 @@ |
| :root { |
| color-scheme: light dark; |
| - /* Type: the family only. Sizes and spacing stay in tokens.css. Onest |
| - where it is served (fonts.go), the system face where it is not. */ |
| - --rst-font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; |
| + /* Type: the family only. Sizes and spacing stay in tokens.css. The |
| + system UI face, nothing downloaded: Paul, 2026-10-25 (AGENTS.md row |
| + 9). A webfont cannot render in WebKit without a frame of invisible |
| + text, and the chrome never flashes. TestChromeFontIsSystemUI. */ |
| + --rst-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; |
| /* Shape: soft and exact. */ |
| --rst-radius: 12px; |
diff --git a/internal/calendar/templates/layout.html b/internal/calendar/templates/layout.html| index 883fe49..d97894c 100644 |
| --- a/internal/calendar/templates/layout.html |
| +++ b/internal/calendar/templates/layout.html |
| @@ -7,11 +7,10 @@ |
| <link rel="icon" type="image/png" sizes="32x32" href="{{asset "static/brand/icon-32.png"}}"> |
| <link rel="icon" type="image/svg+xml" href="{{asset "static/brand/icon.svg"}}"> |
| <link rel="apple-touch-icon" sizes="180x180" href="{{asset "static/brand/apple-touch-icon.png"}}"> |
| -{{/* Onest, Calma's typeface, served by estilo (routes.go). Then the |
| - spec's order: tokens, theme, brand, estilo base, menu, chrome, and the |
| - app's own CSS last. busy.css is the 650ms busy rule; sky.css is the |
| - sign-in door's sky. */}} |
| -<link rel="stylesheet" href="/static/estilo/fonts/v1/fonts.css"> |
| +{{/* The spec's order: tokens, theme, brand, estilo base, menu, chrome, |
| + and the app's own CSS last. busy.css is the 650ms busy rule; sky.css |
| + is the sign-in door's sky. No webfont: the chrome is the system UI |
| + face, so it never flashes (estilo AGENTS.md row 9). */}} |
| <link rel="stylesheet" href="{{asset "static/tokens.css"}}"> |
| <link rel="stylesheet" href="{{asset "static/busy.css"}}"> |
| <link rel="stylesheet" href="{{asset "static/theme.css"}}"> |
diff --git a/internal/calendartest/fontlink_test.go b/internal/calendartest/fontlink_test.go| deleted file mode 100644 |
| index 32496b1..0000000 |
| --- a/internal/calendartest/fontlink_test.go |
| +++ /dev/null |
| @@ -1,24 +0,0 @@ |
| -package calendartest |
| - |
| -import ( |
| - "bytes" |
| - "os" |
| - "path/filepath" |
| - "testing" |
| - |
| - "amadan.net/oficina/estilo.git/theme" |
| -) |
| - |
| -// The layout names Onest's stylesheet by a literal path; this keeps that |
| -// literal equal to estilo's versioned prefix, so an estilo font move |
| -// fails here rather than every page quietly falling back to the system |
| -// face. |
| -func TestLayoutLinksEstilosFonts(t *testing.T) { |
| - layout, err := os.ReadFile(filepath.Join("..", "calendar", "templates", "layout.html")) |
| - if err != nil { |
| - t.Fatal(err) |
| - } |
| - if want := `href="` + theme.FontPrefix + `fonts.css"`; !bytes.Contains(layout, []byte(want)) { |
| - t.Errorf("layout.html does not link %s", want) |
| - } |
| -} |
diff --git a/internal/calendartest/nowebfont_test.go b/internal/calendartest/nowebfont_test.go| new file mode 100644 |
| index 0000000..41052d4 |
| --- /dev/null |
| +++ b/internal/calendartest/nowebfont_test.go |
| @@ -0,0 +1,91 @@ |
| +package calendartest |
| + |
| +import ( |
| + "io/fs" |
| + "net/http" |
| + "os" |
| + "path" |
| + "path/filepath" |
| + "regexp" |
| + "strings" |
| + "testing" |
| + |
| + "amadan.net/oficina/estilo.git/theme" |
| +) |
| + |
| +// The chrome is set in the system UI face and downloads no font, so it |
| +// can never flash (Paul, 2026-10-25: "There should never be a flash of |
| +// unstyled text. Ever." estilo AGENTS.md row 9). No page links or |
| +// preloads a webfont: not estilo's retired Onest, and no font file at |
| +// all. estilo's v1 files stay mounted (routes.go) so a page cached before |
| +// this still resolves its stylesheet; nothing may name them. |
| +// |
| +// This replaces TestLayoutLinksEstilosFonts, which required the link. |
| +func TestNoPageLinksOrPreloadsAChromeWebfont(t *testing.T) { |
| + // Every template, as source: whichever route renders a page, it is |
| + // made of these. |
| + pages := 0 |
| + root := filepath.Join("..", "calendar", "templates") |
| + err := filepath.WalkDir(root, func(p string, d fs.DirEntry, err error) error { |
| + if err != nil || d.IsDir() || filepath.Ext(p) != ".html" { |
| + return err |
| + } |
| + b, err := os.ReadFile(p) |
| + if err != nil { |
| + return err |
| + } |
| + pages++ |
| + for _, why := range chromeWebfonts(string(b)) { |
| + t.Errorf("%s %s", p, why) |
| + } |
| + return nil |
| + }) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if pages < 10 { |
| + t.Fatalf("read only %d templates under %s; the scan would pass vacuously", pages, root) |
| + } |
| + |
| + // And as served, on the page every visitor meets first. |
| + h := newApp(t).Handler() |
| + rec := get(t, h, "/signin") |
| + if rec.Code != http.StatusOK { |
| + t.Fatalf("GET /signin = %d", rec.Code) |
| + } |
| + for _, why := range chromeWebfonts(rec.Body.String()) { |
| + t.Errorf("GET /signin %s", why) |
| + } |
| + |
| + // The retired files still answer, for pages cached before the change. |
| + for _, name := range []string{"fonts.css", "onest-latin.woff2"} { |
| + if rec := get(t, h, theme.FontPrefix+name); rec.Code != http.StatusOK { |
| + t.Errorf("GET %s%s = %d; keep estilo's font handler mounted for old pages", theme.FontPrefix, name, rec.Code) |
| + } |
| + } |
| +} |
| + |
| +var ( |
| + linkTag = regexp.MustCompile(`(?is)<link\b[^>]*>`) |
| + asFont = regexp.MustCompile(`(?i)\bas\s*=\s*["']?font\b`) |
| + fontFile = regexp.MustCompile(`(?i)\.(woff2?|ttf|otf|eot)\b`) |
| +) |
| + |
| +// chromeWebfonts names each way html would download a font for the |
| +// chrome: estilo's font path at any version, a <link> that preloads a |
| +// font or names a font file, or a face declared inline. |
| +func chromeWebfonts(html string) []string { |
| + var found []string |
| + if dir := path.Dir(strings.TrimSuffix(theme.FontPrefix, "/")) + "/"; strings.Contains(html, dir) { |
| + found = append(found, "names estilo's webfont path "+dir) |
| + } |
| + for _, tag := range linkTag.FindAllString(html, -1) { |
| + if asFont.MatchString(tag) || fontFile.MatchString(tag) { |
| + found = append(found, "links or preloads a font: "+tag) |
| + } |
| + } |
| + if strings.Contains(strings.ToLower(html), "@font-face") { |
| + found = append(found, "declares a font face inline") |
| + } |
| + return found |
| +} |