oficina / sheets Public

Sheets: 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.
- 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>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 0cc96dcd5a46f76672541e83136ceabececc6604 parent 0947f55
6 files changed, +100 −23
  • go.mod +1 −1
  • go.sum +2 −2
  • internal/sheets/estilo.go +5 −2
  • internal/sheets/nowebfont_test.go +92 −0
  • internal/sheets/templates/layout.html +0 −1
  • internal/sheets/theme_assets_test.go +0 −17

CI passed — run details

diff --git a/go.mod b/go.mod
index 6b790a7..6fd99ef 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module amadan.net/oficina/sheets
go 1.25.0
require (
- amadan.net/oficina/estilo.git v0.0.0-20261024233714-f14458a4683c
+ amadan.net/oficina/estilo.git v0.0.0-20261025200559-260f98c42e2d
amadan.net/oficina/home/connect v0.0.0-20261024233715-ff16bf56bc4d
amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816
amadan.net/oficina/home/handoff v0.0.0-20261024233715-ff16bf56bc4d
diff --git a/go.sum b/go.sum
index 263db62..6da4cdf 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/sheets/estilo.go b/internal/sheets/estilo.go
index 0c94c92..c349803 100644
--- a/internal/sheets/estilo.go
+++ b/internal/sheets/estilo.go
@@ -8,8 +8,11 @@ import (
)
// mountEstilo serves what estilo ships from Go rather than as files in
-// static/: every app's icon (for the switcher) and Onest, Calma's
-// typeface. Both handlers serve closed sets under their own prefixes.
+// static/: every app's icon (for the switcher), the sign-in door's sky,
+// and estilo's retired v1 Onest files. Those stay 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. Each handler
+// serves a closed set under its own prefix.
func mountEstilo(r chi.Router) {
r.Handle(brand.Prefix+"*", brand.Handler())
r.Handle(theme.FontPrefix+"*", theme.FontHandler())
diff --git a/internal/sheets/nowebfont_test.go b/internal/sheets/nowebfont_test.go
new file mode 100644
index 0000000..8fb0d77
--- /dev/null
+++ b/internal/sheets/nowebfont_test.go
@@ -0,0 +1,92 @@
+package sheets
+
+import (
+ "io/fs"
+ "net/http"
+ "net/http/httptest"
+ "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 (estilo.go) so a page cached before
+// this still resolves its stylesheet; nothing may name them.
+//
+// This replaces TestOnestIsLinkedAndServed, 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 := "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.
+ app := New(Config{})
+ rec := do(t, app, httptest.NewRequest(http.MethodGet, "/signin", nil))
+ 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 := do(t, app, httptest.NewRequest(http.MethodGet, theme.FontPrefix+name, nil)); 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
+}
diff --git a/internal/sheets/templates/layout.html b/internal/sheets/templates/layout.html
index b988bf2..5d7c9d9 100644
--- a/internal/sheets/templates/layout.html
+++ b/internal/sheets/templates/layout.html
@@ -31,7 +31,6 @@
<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"}}">
-<link rel="stylesheet" href="/static/estilo/fonts/v1/fonts.css">
<link rel="stylesheet" href="{{asset "static/tokens.css"}}">
<link rel="stylesheet" href="{{asset "static/estilo/busy.css"}}">
<link rel="stylesheet" href="{{asset "static/theme.css"}}">
diff --git a/internal/sheets/theme_assets_test.go b/internal/sheets/theme_assets_test.go
index b103d65..4703e11 100644
--- a/internal/sheets/theme_assets_test.go
+++ b/internal/sheets/theme_assets_test.go
@@ -58,23 +58,6 @@ func TestSharedThemeAssetFingerprintAndCache(t *testing.T) {
}
}
-// The layout names Onest's stylesheet under estilo's versioned prefix, and
-// the app serves it there: when estilo moves the fonts, this fails rather
-// than every page quietly falling back to the system face.
-func TestOnestIsLinkedAndServed(t *testing.T) {
- app := New(Config{})
- page := do(t, app, httptest.NewRequest(http.MethodGet, "/signin", nil))
- css := theme.FontPrefix + "fonts.css"
- if !strings.Contains(page.Body.String(), `href="`+css+`"`) {
- t.Fatalf("layout does not link %s", css)
- }
- for _, path := range []string{css, theme.FontPrefix + "onest-latin.woff2"} {
- if res := do(t, app, httptest.NewRequest(http.MethodGet, path, nil)); res.Code != http.StatusOK {
- t.Fatalf("GET %s = %d", path, res.Code)
- }
- }
-}
-
// The busy rule (estilo's busy): the page links busy.css after tokens.css
// and busy.js after the shim, all three are served, and the shim served is
// estilo's — rastrillo's without the old busy rule, which would fight the