oficina / docs Public

Merge branch 'signin-door' into main

Merge signin-door: sign-in is the Oficina door
claude agent, operated by paul@keymail.dev ee9ecb10e01004a625d604cea69fd05c76c9e5df parent dd54950parent 13310c5
12 files changed, +79 −5
  • go.mod +1 −1
  • go.sum +4 −0
  • internal/docs/app.go +3 −0
  • internal/docs/auth.go +8 −0
  • internal/docs/auth_navigation.go +4 −0
  • internal/docs/auth_navigation_test.go +6 −0
  • internal/docs/auth_test.go +2 −2
  • internal/docs/home_render.go +3 −0
  • internal/docs/render.go +4 −1
  • internal/docs/signin_door_test.go +42 −0
  • internal/docs/views/layout.html +1 −0
  • internal/docs/views/signin.html +1 −1

CI passed — run details

diff --git a/go.mod b/go.mod
index 0c72b5a..027a701 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module github.com/carlosframework/docs
go 1.26.5
require (
- amadan.net/oficina/estilo.git v0.0.0-20260929165053-846b39772f3c
+ amadan.net/oficina/estilo.git v0.0.0-20260929185827-41201439fd22
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489
amadan.net/oficina/home/roster v0.0.0-20260908123429-74dda570e0cf
amadan.net/rastrillo/native/server v0.0.0-20260923173546-2a5d07b2c8d3
diff --git a/go.sum b/go.sum
index 14bcf6a..4ca18d2 100644
--- a/go.sum
+++ b/go.sum
@@ -8,6 +8,10 @@ amadan.net/oficina/estilo.git v0.0.0-20260929095838-0994675f496e h1:LTSmIWUS8RjP
amadan.net/oficina/estilo.git v0.0.0-20260929095838-0994675f496e/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
amadan.net/oficina/estilo.git v0.0.0-20260929165053-846b39772f3c h1:YYocIz3r3b4oIA0K/58JkSsmyTOCzMT/2GaW/MFbbPo=
amadan.net/oficina/estilo.git v0.0.0-20260929165053-846b39772f3c/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
+amadan.net/oficina/estilo.git v0.0.0-20260929183653-cc2c1e56fb4b h1:UOxYBKsOSRHcHHYNKt0i6cB1Z4yT2soywOTWURYvBWo=
+amadan.net/oficina/estilo.git v0.0.0-20260929183653-cc2c1e56fb4b/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
+amadan.net/oficina/estilo.git v0.0.0-20260929185827-41201439fd22 h1:RR9qP85FU1cZdn788v1zSLgZbKMGBmSk6Q7Rezj5JYI=
+amadan.net/oficina/estilo.git v0.0.0-20260929185827-41201439fd22/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489 h1:RPKtyry/71i06o8L+gjAaUyexbmG56kO1YPs601URAM=
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489/go.mod h1:YISpzFJ+iMgrM0rUL032OSzsAQbP4/nozvXLCCOcn1k=
amadan.net/oficina/home/roster v0.0.0-20260908123429-74dda570e0cf h1:SRKjCUgtk42WwR7VSn+V0eLNk20mfiY8dQmzdw13Sbo=
diff --git a/internal/docs/app.go b/internal/docs/app.go
index 7a31d01..9e325c8 100644
--- a/internal/docs/app.go
+++ b/internal/docs/app.go
@@ -11,6 +11,7 @@
package docs
import (
+ "amadan.net/oficina/estilo.git/sky"
"context"
"errors"
"fmt"
@@ -614,6 +615,8 @@ func New(cfg Config) (*App, error) {
r.Handle(brand.Prefix+"*", brand.Handler())
// Onest, Calma's typeface, served by estilo under its versioned prefix.
r.Handle(theme.FontPrefix+"*", theme.FontHandler())
+ // The sky behind the sign-in door: a closed set of SVGs, public.
+ r.Handle(sky.Prefix+"*", sky.Handler())
// Everything else needs a real, signed-in person — rastrillo
// SKILL.md §5/§1's "signed-in routes... in a Group with
diff --git a/internal/docs/auth.go b/internal/docs/auth.go
index 7a0c508..61b44eb 100644
--- a/internal/docs/auth.go
+++ b/internal/docs/auth.go
@@ -15,6 +15,7 @@ import (
"amadan.net/oficina/estilo.git/brand"
"amadan.net/oficina/estilo.git/chrome"
+ "amadan.net/oficina/estilo.git/sky"
rauth "github.com/carlosframework/rastrillo/auth"
"github.com/carlosframework/rastrillo/mail"
"github.com/carlosframework/rastrillo/sessions"
@@ -435,6 +436,9 @@ type signinPage struct {
Sent *chrome.SignInNotice
ContinueURL string
SubmitLabel string
+ // Door heads the continuation card (Icon, App, Sky), so the moment
+ // between the form and Keymail looks like the same door.
+ Door chrome.SignInNotice
}
// signinAgainPath is where "Use a different address" goes: the local
@@ -488,6 +492,8 @@ func (h *handlers) signin(w http.ResponseWriter, r *http.Request) {
title = rastrillo.T(r, "docs.signin.sent.title")
data.Sent = &chrome.SignInNotice{
Icon: icon,
+ App: "Docs",
+ Sky: sky.For(r.Host),
Heading: title,
Body: rastrillo.T(r, "docs.signin.sent.body"),
Link: &chrome.Link{Href: h.signinAgainHref(r), Label: rastrillo.T(r, "docs.signin.sent.again")},
@@ -495,6 +501,8 @@ func (h *handlers) signin(w http.ResponseWriter, r *http.Request) {
} else {
form := &chrome.SignIn{
Icon: icon,
+ App: "Docs",
+ Sky: sky.For(r.Host),
Heading: title,
Action: "/signin",
AddressLabel: rastrillo.T(r, "docs.signin.address.label"),
diff --git a/internal/docs/auth_navigation.go b/internal/docs/auth_navigation.go
index 0496657..6d5f261 100644
--- a/internal/docs/auth_navigation.go
+++ b/internal/docs/auth_navigation.go
@@ -1,6 +1,9 @@
package docs
import (
+ "amadan.net/oficina/estilo.git/brand"
+ "amadan.net/oficina/estilo.git/chrome"
+ "amadan.net/oficina/estilo.git/sky"
"bytes"
"net/http"
"net/url"
@@ -32,6 +35,7 @@ func (h *handlers) beginSignin(next http.HandlerFunc) http.HandlerFunc {
Frame: h.frame(r, frameOptions{titleParts: []string{rastrillo.T(r, "docs.signin.title")}, signinPage: true}),
SubmitLabel: rastrillo.T(r, "docs.signin.keymail"),
ContinueURL: destination,
+ Door: chrome.SignInNotice{Icon: brand.Path("docs"), App: "Docs", Sky: sky.For(r.Host)},
}
if err := h.render.page(w, r, "signin", data); err != nil {
h.logger.Error("docs: render Keymail continuation", "err", err)
diff --git a/internal/docs/auth_navigation_test.go b/internal/docs/auth_navigation_test.go
index a1f9584..9288162 100644
--- a/internal/docs/auth_navigation_test.go
+++ b/internal/docs/auth_navigation_test.go
@@ -48,6 +48,12 @@ func TestKeymailContinuation(t *testing.T) {
if strings.Contains(body, `action="/signin"`) {
t.Fatal("continuation rendered another sign-in form")
}
+ // It is the door's card on the sky, not a bare page.
+ for _, part := range []string{"estilo-door", "estilo-sky-layer", "<span>Docs</span>"} {
+ if !strings.Contains(body, part) {
+ t.Fatalf("continuation is not the door: lacks %q", part)
+ }
+ }
if dir := os.Getenv("DOCS_OAUTH_BROWSER_FIXTURE"); dir != "" {
if err := os.MkdirAll(dir, 0700); err != nil {
t.Fatal(err)
diff --git a/internal/docs/auth_test.go b/internal/docs/auth_test.go
index 1d5d5dd..24b9a64 100644
--- a/internal/docs/auth_test.go
+++ b/internal/docs/auth_test.go
@@ -118,8 +118,8 @@ func TestSignInPageRendersSignedOut(t *testing.T) {
if !strings.Contains(body, `<label rst-field-label for="estilo-signin-address">docs.signin.address.label</label>`) {
t.Error("email input has no persistent associated translated label")
}
- if !strings.Contains(body, `type="email" id="estilo-signin-address" name="address" required autocomplete="email"`) {
- t.Error("label target must remain the required email input with email autocomplete")
+ if !strings.Contains(body, `type="email" id="estilo-signin-address" name="address" required autofocus autocomplete="email"`) {
+ t.Error("label target must remain the required, focused email input with email autocomplete")
}
}
diff --git a/internal/docs/home_render.go b/internal/docs/home_render.go
index 7baf3bd..f2a22be 100644
--- a/internal/docs/home_render.go
+++ b/internal/docs/home_render.go
@@ -5,6 +5,7 @@ import (
"amadan.net/oficina/estilo.git/brand"
"amadan.net/oficina/estilo.git/chrome"
+ "amadan.net/oficina/estilo.git/sky"
"github.com/carlosframework/rastrillo"
)
@@ -35,6 +36,8 @@ func (rd *renderer) homeLink(w http.ResponseWriter, r *http.Request, state, addr
// in going back through Home.
page.SignedOut = &chrome.SignInNotice{
Icon: brand.Path("docs"),
+ App: "Docs",
+ Sky: sky.For(r.Host),
Heading: rastrillo.T(r, "docs.signedout.heading"),
Body: rastrillo.T(r, "docs.signedout.body"),
Link: &chrome.Link{Href: "/signin", Label: rastrillo.T(r, "docs.chrome.signin")},
diff --git a/internal/docs/render.go b/internal/docs/render.go
index 70f89c9..7755cb1 100644
--- a/internal/docs/render.go
+++ b/internal/docs/render.go
@@ -1,6 +1,7 @@
package docs
import (
+ "amadan.net/oficina/estilo.git/sky"
"bytes"
"embed"
"fmt"
@@ -658,7 +659,9 @@ func vendoredStaticFS() (fs.FS, error) {
"static/estilo/base.css": {Data: base.CSS()},
"static/estilo/menu.css": {Data: estilomenu.CSS()},
"static/estilo/chrome.css": {Data: chrome.CSS()},
- "static/estilo/chrome.js": {Data: chrome.JS()},
+ // The sky behind the sign-in door; images from sky.Handler.
+ "static/estilo/sky.css": {Data: sky.CSS()},
+ "static/estilo/chrome.js": {Data: chrome.JS()},
}
for _, name := range []string{"icon-32.png", "apple-touch-icon.png", "brand.css", "LICENSE.lucide"} {
body, err := brandFS.ReadFile("brand/" + name)
diff --git a/internal/docs/signin_door_test.go b/internal/docs/signin_door_test.go
new file mode 100644
index 0000000..7554dde
--- /dev/null
+++ b/internal/docs/signin_door_test.go
@@ -0,0 +1,42 @@
+package docs
+
+import (
+ "net/http"
+ "net/http/httptest"
+ "regexp"
+ "strings"
+ "testing"
+)
+
+// The sign-in page is the Oficina door (estilo chrome): a card on the
+// suite sky with this app's mark and name, its sky layers served signed
+// out by estilo's handler rather than shadowed by the app's /static/.
+func TestSignInPageIsTheDoor(t *testing.T) {
+ app, err := NewForTest(t)
+ if err != nil {
+ t.Fatal(err)
+ }
+ GET := func(p string) *httptest.ResponseRecorder {
+ return serve(app, httptest.NewRequest(http.MethodGet, p, nil))
+ }
+ rec := GET("/signin")
+ body := rec.Body.String()
+ for _, want := range []string{"estilo-door", "<span>Docs</span>", `name="address"`, " autofocus"} {
+ if !strings.Contains(body, want) {
+ t.Errorf("sign-in page lacks %q", want)
+ }
+ }
+ if !regexp.MustCompile(`<img estilo-sky-layer="placeholder"[^>]*src="data:image/png;base64,`).MatchString(body) {
+ t.Error("sign-in page has no inline sky placeholder")
+ }
+ layer := regexp.MustCompile(`<img estilo-sky-layer="[a-z]+"[^>]*src="(/static/estilo/sky/v1/[^"]+)"`).FindStringSubmatch(body)
+ if layer == nil {
+ t.Fatal("sign-in page links no served sky layer")
+ }
+ if got := GET(layer[1]); got.Code != http.StatusOK || got.Header().Get("Content-Type") != "image/svg+xml" {
+ t.Errorf("GET %s signed out: %d %q, want 200 image/svg+xml", layer[1], got.Code, got.Header().Get("Content-Type"))
+ }
+ if !regexp.MustCompile(`/static/estilo/sky\.[0-9a-f]{16}\.css`).MatchString(body) {
+ t.Error("sign-in page does not link sky.css")
+ }
+}
diff --git a/internal/docs/views/layout.html b/internal/docs/views/layout.html
index afcdb10..bfffd90 100644
--- a/internal/docs/views/layout.html
+++ b/internal/docs/views/layout.html
@@ -25,6 +25,7 @@
<link rel="stylesheet" href="{{asset "static/estilo/base.css"}}">
<link rel="stylesheet" href="{{asset "static/estilo/menu.css"}}">
<link rel="stylesheet" href="{{asset "static/estilo/chrome.css"}}">
+<link rel="stylesheet" href="{{asset "static/estilo/sky.css"}}">
<script defer src="{{asset "static/rastrillo.js"}}"></script>
<script defer src="{{asset "static/estilo/busy.js"}}"></script>
{{iconAssets}}
diff --git a/internal/docs/views/signin.html b/internal/docs/views/signin.html
index 0a37e1a..fc34fbc 100644
--- a/internal/docs/views/signin.html
+++ b/internal/docs/views/signin.html
@@ -13,7 +13,7 @@
{{define "content"}}
{{- if .ContinueURL}}
<meta http-equiv="refresh" content="0;url={{.ContinueURL}}">
-<section estilo-signin><p><a rst-btn="primary" href="{{.ContinueURL}}">{{.SubmitLabel}}</a></p></section>
+{{template "estilo-door-open" .Door}}<p><a rst-btn="primary" href="{{.ContinueURL}}">{{.SubmitLabel}}</a></p>{{template "estilo-door-close"}}
{{- else if .Sent}}{{template "estilo-signin-sent" .Sent}}
{{- else}}{{template "estilo-signin" .Form}}{{end}}
{{end}}