oficina / memoria Public

A failed Keymail sign-in no longer loops back to Keymail

The standalone form now carries force=1 back, as the Home-mode form did.
Reviewed by GPT-6-Astra via Codex (#26).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from fix/keymail-force-loop into main.
Paul Campbell pushed by claude agent, operated by paul@keymail.dev d7777f713a6002278c254bc4e7f3a0bc387e04c6 parent 7198b5e
2 files changed, +16 −1
  • internal/memoria/chrome_test.go +15 −0
  • internal/memoria/handlers.go +1 −1

CI passed — run details

CI log
=== vet ===
go vet ./...
go vet -tags browser ./internal/memoriatest/
=== fmt ===
=== test ===
go test ./...
?   	amadan.net/oficina/memoria/cmd/memoria	[no test files]
ok  	amadan.net/oficina/memoria/internal/memoria	3.795s
ok  	amadan.net/oficina/memoria/internal/memoria/chunk	0.004s
ok  	amadan.net/oficina/memoria/internal/memoria/fact	0.541s
?   	amadan.net/oficina/memoria/internal/memoria/icons	[no test files]
ok  	amadan.net/oficina/memoria/internal/memoria/index	0.037s
ok  	amadan.net/oficina/memoria/internal/memoria/notion	0.023s
ok  	amadan.net/oficina/memoria/internal/memoria/provider	1.131s
ok  	amadan.net/oficina/memoria/internal/memoria/query	0.002s
ok  	amadan.net/oficina/memoria/internal/memoria/seal	0.002s
ok  	amadan.net/oficina/memoria/internal/memoria/sibling	3.025s
ok  	amadan.net/oficina/memoria/internal/memoriatest	2.004s
?   	amadan.net/oficina/memoria/scripts/writeestilo	[no test files]
?   	amadan.net/oficina/memoria/tools/bench	[no test files]
?   	amadan.net/oficina/memoria/tools/drive	[no test files]
?   	amadan.net/oficina/memoria/tools/seed	[no test files]
?   	amadan.net/oficina/memoria/tools/vendorassets	[no test files]
=== migration-check ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
diff --git a/internal/memoria/chrome_test.go b/internal/memoria/chrome_test.go
index 69b8b0d..887829d 100644
--- a/internal/memoria/chrome_test.go
+++ b/internal/memoria/chrome_test.go
@@ -325,3 +325,18 @@ func TestConnectStartPageActionSaysConnect(t *testing.T) {
t.Error("the start action still says Continue")
}
}
+
+// Standalone, a failed Keymail sign-in lands on /signin?force=1&err=keymail.
+// The form must carry force=1 back, or the next submission classifies the
+// address as Keymail again and loops straight back to Keymail. Only Home
+// mode used to carry it.
+func TestStandaloneKeymailFallbackCarriesForce(t *testing.T) {
+ f := newLocalOnlyFixture(t)
+ w := f.do("GET", "/signin?force=1&err=keymail", "")
+ if w.Code != http.StatusOK {
+ t.Fatalf("GET = %d", w.Code)
+ }
+ if !regexp.MustCompile(`<input[^>]*name="force"[^>]*value="1"`).MatchString(w.Body.String()) {
+ t.Fatalf("the fallback form does not carry force=1:\n%s", w.Body.String())
+ }
+}
diff --git a/internal/memoria/handlers.go b/internal/memoria/handlers.go
index 45ca150..3f1eb80 100644
--- a/internal/memoria/handlers.go
+++ b/internal/memoria/handlers.go
@@ -1219,7 +1219,7 @@ func (a *app) localSignin(w http.ResponseWriter, r *http.Request) {
}
}
w.Header().Set("Cache-Control", "no-store")
- forceEmail := a.home != nil && q.Get("force") == "1"
+ forceEmail := q.Get("force") == "1"
msg, kind := signinOutcome(q)
icon, view := assets.Path("static/brand/icon.svg"), sky.For(r.Host)