oficina / memoria Public

Memoria UI pass: wider, unbroken values, quieter lists

Paul, 2026-10-26: results cramped and unstyled, the phone number
squished, "we never want to see these squished dates".

- Column: rastrillo's own 64rem rather than 46rem, with snippets at a
  readable 80ch.
- Phone numbers, eircodes, VAT numbers and dates never wrap. Addresses
  and emails can, so nothing widens the page.
- Documents list:
  - dates read "26 Oct 2026", with the full stamp on hover;
  - the title takes the spare width;
  - "Add content" sits beside the count;
  - Delete is quiet until its row is hovered or focused;
  - Source and Passages hide below 40rem.
- Sources are named for people (Notion, Pasted, Uploaded), and the
  result line drops "passage N".
- Highlights are softer and titles a step larger. The explanation table
  scrolls in its own box.

Reviewed by GPT-6 Astra: layout approved at 1440/390 in both themes.
Its three sideways-scroll findings are fixed, and a new browser test
(make browser) checks four pages at 320/390/417/640px. Each regression
is built and red.

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

Squashed from feat/memoria-ui-pass into main.
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 3d7b5cca5cd5a9fcbcec4c02363e99d39c717f56 parent 7c38586
8 files changed, +222 −41
  • Makefile +1 −1
  • internal/memoria/render.go +16 −0
  • internal/memoria/static/memoria.css +61 −13
  • internal/memoria/store.go +21 −14
  • internal/memoria/templates/index.html +12 −7
  • internal/memoria/templates/results.html +7 −3
  • internal/memoriatest/factbox_test.go +3 −3
  • internal/memoriatest/reflow_browser_test.go +101 −0

CI passed — run details

diff --git a/Makefile b/Makefile
index 8a69a01..691cf78 100644
--- a/Makefile
+++ b/Makefile
@@ -120,7 +120,7 @@ ci: vet fmt-check test migration-check
# Mac from the Playwright cache.
RASTRILLO_CHROME ?= $(firstword $(wildcard $(HOME)/Library/Caches/ms-playwright/chromium-*/chrome-mac*/Chromium.app/Contents/MacOS/Chromium))
browser:
- RASTRILLO_CHROME="$(RASTRILLO_CHROME)" CGO_ENABLED=0 go test -tags browser -count=1 -run 'OnTap|ProductionCSP' ./internal/memoriatest/
+ RASTRILLO_CHROME="$(RASTRILLO_CHROME)" CGO_ENABLED=0 go test -tags browser -count=1 -run 'OnTap|ProductionCSP|NoSidewaysScroll' ./internal/memoriatest/
.PHONY: credits
credits:
diff --git a/internal/memoria/render.go b/internal/memoria/render.go
index 6b19436..0c49d51 100644
--- a/internal/memoria/render.go
+++ b/internal/memoria/render.go
@@ -51,6 +51,7 @@ func funcs() template.FuncMap {
"icon": icons.Icon,
"iconAssets": icons.Assets,
"safeSnippet": safeSnippet,
+ "sourceName": sourceName,
"tone": tone,
}
}
@@ -180,6 +181,21 @@ func tone(kind string) string {
}
}
+// sourceName is how a page names where a document came from. The stored
+// values are identifiers ("paste", "notion"); a reader sees words.
+// Sibling apps are stored already named ("Docs") and pass through.
+func sourceName(s string) string {
+ switch s {
+ case "paste":
+ return "Pasted"
+ case "upload":
+ return "Uploaded"
+ case "notion":
+ return "Notion"
+ }
+ return s
+}
+
// stamp is how a page prints a stored time: converted to UTC and saying
// so. Since rastrillo fb806a2 the driver hands every stored time back in
// UTC, where before it came back in the host's zone, so an unlabelled
diff --git a/internal/memoria/static/memoria.css b/internal/memoria/static/memoria.css
index 28ae29b..2e122a9 100644
--- a/internal/memoria/static/memoria.css
+++ b/internal/memoria/static/memoria.css
@@ -10,10 +10,13 @@
* in) and a long one does not shift everything sideways. */
html { scrollbar-gutter: stable; }
-[rst-page] { box-sizing: border-box; margin: 0 auto; max-width: 46rem; padding: 1.5rem 1rem 4rem; }
+/* 64rem is rastrillo's own column. Memoria narrowed it to 46rem, which on
+ * a desktop left results and the documents table cramped in the middle
+ * of the screen and wrapped dates over four lines (Paul, 2026-10-26). */
+[rst-page] { box-sizing: border-box; margin: 0 auto; max-width: 64rem; padding: 1.5rem 1rem 4rem; }
/* The header is estilo's bar (chrome.css) and is not styled here. The
- * footer is exactly the column's width — [rst-page]'s 46rem less its 1rem
+ * footer is exactly the column's width — [rst-page]'s 64rem less its 1rem
* gutters — so its rule and its text start on the same line as every
* heading and rule above it (they sat 16px to the left, polish audit
* §B6). */
@@ -22,7 +25,7 @@ html { scrollbar-gutter: stable; }
box-sizing: border-box;
margin: 2rem auto 0;
padding: 0.9rem 0 2rem;
- width: min(44rem, 100% - 2rem);
+ width: min(62rem, 100% - 2rem);
}
[rst-inline] { display: inline; }
@@ -42,6 +45,16 @@ html { scrollbar-gutter: stable; }
[rst-search] { margin-bottom: 1.5rem; }
[rst-section] { border-top: 1px solid var(--rst-line); margin-top: 2.5rem; padding-top: 1rem; }
+/* A section's heading and its one action share a line. */
+[rst-section-head] {
+ align-items: center;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.75rem 1rem;
+ justify-content: space-between;
+ margin-bottom: 0.75rem;
+}
+[rst-section-head] h2 { margin: 0; }
/* rastrillo's form bar is position:sticky; bottom:0, which is right for a
* long settings page and wrong here — it floated the submit button over
@@ -242,7 +255,7 @@ html { scrollbar-gutter: stable; }
[rst-tray-listed] { color: var(--rst-text-muted); margin: 0.4rem 0 0; }
[rst-results] { list-style: none; margin: 0; padding: 0; }
-[rst-result] { border-top: 1px solid var(--rst-line); padding: 0.9rem 0; }
+[rst-result] { border-top: 1px solid var(--rst-line); padding: 1.1rem 0; }
[rst-result]:first-child { border-top: 0; }
/* The document's ancestry in its source, above the title. Sits above
rather than below because it is read as a location — "Handbook ›
@@ -274,7 +287,7 @@ html { scrollbar-gutter: stable; }
}
[rst-result-title]:hover,
[rst-table] td > a:not([rst-btn]):hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
-[rst-result-title] { font-weight: 600; }
+[rst-result-title] { font-size: 1.0625rem; font-weight: 600; }
[rst-table] td > a:not([rst-btn]) { font-weight: 550; }
[rst-result-trail] {
/* The token is --rst-text-muted. This said --rst-text-mut, which
@@ -290,11 +303,16 @@ html { scrollbar-gutter: stable; }
font-size: 0.8125rem;
margin-top: 0.1rem;
}
-[rst-result-snippet] { margin: 0.4rem 0 0.2rem; }
+/* The snippet keeps a readable measure inside the wider column: lines
+ * much past 75 characters are hard to follow back to their start. */
+[rst-result-snippet] { line-height: 1.55; margin: 0.45rem 0 0.3rem; max-width: 80ch; }
+/* Softer highlights: no padding, so a run of matched words reads as one
+ * phrase rather than a row of separate chips. */
[rst-result-snippet] mark {
background: var(--rst-accent-soft, var(--rst-line));
+ border-radius: 2px;
color: inherit;
- padding: 0 0.1em;
+ padding: 0;
}
[rst-result-meta] { font-size: 0.8125rem; margin: 0; }
@@ -349,17 +367,42 @@ html { scrollbar-gutter: stable; }
text-align: start;
}
[rst-table] th { font-size: 0.8125rem; font-weight: 560; }
+[rst-table] [rst-num] { font-variant-numeric: tabular-nums; text-align: end; }
+[rst-table] time { white-space: nowrap; }
+/* The documents list: the title takes the spare width, and every other
+ * column is as narrow as its content and never wraps. */
+[rst-docs] td:not(:first-child),
+[rst-docs] th:not(:first-child) { white-space: nowrap; width: 1%; }
+[rst-docs] td:last-child { text-align: end; }
+/* One Delete per row is a column of identical bordered buttons; it reads
+ * as quiet text until the row is hovered or the button is focused. */
+[rst-docs] td:last-child [rst-btn] { background: transparent; border-color: transparent; box-shadow: none; color: var(--rst-text-muted); }
+[rst-docs] tr:hover td:last-child [rst-btn],
+[rst-docs] td:last-child [rst-btn]:focus-visible { border-color: var(--rst-line-strong, var(--rst-line)); color: var(--rst-text); }
+@media (hover: none) {
+ [rst-docs] td:last-child [rst-btn] { border-color: var(--rst-line); color: var(--rst-text); }
+}
+[rst-docs] th, [rst-docs] td { padding-inline-end: 1rem; }
+[rst-docs] th:last-child, [rst-docs] td:last-child { padding-inline-end: 0; }
+/* A wide table scrolls inside its own box rather than widening the page
+ * past a phone's screen. */
+[rst-scroll-x] { overflow-x: auto; }
+/* ?explain=facts: a value is never broken over two lines. */
+[rst-explain-table] td:first-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 320px is the reflow floor the suite holds itself to. The search form
* stays one row: stacked, rastrillo's align-items: center shrank the input
* to a clipped 180px in the middle of the column. */
@media (max-width: 26rem) {
[rst-table] { font-size: 0.875rem; }
- /* The documents table keeps Title, Updated and Delete on a phone:
- * with all five columns it ran 23px past a 320px screen. Source and
- * Passages are on the document's own page. */
- [rst-table] th:nth-child(2), [rst-table] td:nth-child(2),
- [rst-table] th:nth-child(3), [rst-table] td:nth-child(3) { display: none; }
+}
+/* The documents table keeps Title, Updated and Delete below 40rem. With
+ * its narrow columns unwrapped, all five ran past a 417px screen and
+ * pushed Delete off it (review, 2026-10-26). Source and Passages are on
+ * the document's own page. */
+@media (max-width: 40rem) {
+ [rst-docs] th:nth-child(2), [rst-docs] td:nth-child(2),
+ [rst-docs] th:nth-child(3), [rst-docs] td:nth-child(3) { display: none; }
}
/* A zero-result line while the person is still typing (search.js marks
@@ -419,10 +462,15 @@ html { scrollbar-gutter: stable; }
color: var(--rst-text-muted);
font-size: 0.8125rem;
}
+/* A value is never broken: "+353 (0)1 / 547 7854" over two lines reads
+ * as two numbers. */
[rst-fact-value] {
+ font-size: 1.1875rem;
+ font-variant-numeric: tabular-nums;
font-weight: 600;
- font-size: 1.0625rem;
+ overflow-wrap: anywhere;
}
+[rst-fact-value][rst-nowrap] { overflow-wrap: normal; white-space: nowrap; }
[rst-fact-cite] {
font-size: 0.8125rem;
margin-left: auto;
diff --git a/internal/memoria/store.go b/internal/memoria/store.go
index 4ca5cb6..dd78574 100644
--- a/internal/memoria/store.go
+++ b/internal/memoria/store.go
@@ -184,13 +184,18 @@ func (n FactNote) Text() string {
// Summary is a document as the list shows it.
type Summary struct {
- ID int64
- Source string
- Title string
- Path string
- Bytes int
- Chunks int
- Updated string
+ ID int64
+ Source string
+ Title string
+ Path string
+ Bytes int
+ Chunks int
+ // Updated is the full stamp, kept for the hover title; UpdatedDay is
+ // what the list shows ("26 Oct 2026"), short enough never to wrap;
+ // UpdatedISO is the <time> element's machine-readable value.
+ Updated string
+ UpdatedDay string
+ UpdatedISO string
}
// externalID keys a document by its stable source identifier.
@@ -908,13 +913,15 @@ func (s *Store) Summaries(ctx context.Context) ([]Summary, error) {
path = string(p)
}
out = append(out, Summary{
- ID: d.ID,
- Source: d.Source,
- Title: string(t),
- Path: path,
- Bytes: d.Bytes,
- Chunks: int(n),
- Updated: stamp(d.UpdatedAt),
+ ID: d.ID,
+ Source: d.Source,
+ Title: string(t),
+ Path: path,
+ Bytes: d.Bytes,
+ Chunks: int(n),
+ Updated: stamp(d.UpdatedAt),
+ UpdatedDay: d.UpdatedAt.UTC().Format("2 Jan 2006"),
+ UpdatedISO: d.UpdatedAt.UTC().Format(time.RFC3339),
})
}
return out, nil
diff --git a/internal/memoria/templates/index.html b/internal/memoria/templates/index.html
index ce102fe..63a041e 100644
--- a/internal/memoria/templates/index.html
+++ b/internal/memoria/templates/index.html
@@ -32,20 +32,25 @@
{{if .Flash}}<div rst-callout rst-tone="{{.FlashKind | tone}}"{{if eq .FlashKind "danger"}} role="alert"{{end}}><div rst-callout-body><p>{{.Flash}}</p></div></div>{{end}}
<section rst-section>
- <h2>{{len .Documents}} document{{if ne (len .Documents) 1}}s{{end}}</h2>
- <p><a rst-btn="primary" href="/add">Add content</a></p>
+ <div rst-section-head>
+ <h2>{{len .Documents}} document{{if ne (len .Documents) 1}}s{{end}}</h2>
+ <a rst-btn="primary" href="/add">Add content</a>
+ </div>
{{if not .Documents}}
<p rst-muted>Nothing stored yet.</p>
{{else}}
- <table rst-table>
- <thead><tr><th>Title</th><th>Source</th><th>Passages</th><th>Updated</th><th></th></tr></thead>
+ {{/* The title column takes the spare width; every other column is as
+ narrow as its content and never wraps — a date broken over four
+ lines by a long title was the first thing Paul saw (2026-10-26). */}}
+ <table rst-table rst-docs>
+ <thead><tr><th>Title</th><th>Source</th><th rst-num>Passages</th><th>Updated</th><th></th></tr></thead>
<tbody>
{{range .Documents}}
<tr>
<td><a href="/documents/{{.ID}}">{{.Title}}</a></td>
- <td rst-muted>{{.Source}}</td>
- <td rst-muted>{{.Chunks}}</td>
- <td rst-muted>{{.Updated}}</td>
+ <td rst-muted>{{.Source | sourceName}}</td>
+ <td rst-muted rst-num>{{.Chunks}}</td>
+ <td rst-muted><time datetime="{{.UpdatedISO}}" title="{{.Updated}}">{{.UpdatedDay}}</time></td>
{{/* Delete asks first (delete.html): a link to the question, not
a one-click POST. */}}
<td><a rst-btn="quiet compact" href="/documents/{{.ID}}/delete">Delete</a></td>
diff --git a/internal/memoria/templates/results.html b/internal/memoria/templates/results.html
index 41a8adf..7196746 100644
--- a/internal/memoria/templates/results.html
+++ b/internal/memoria/templates/results.html
@@ -59,7 +59,9 @@
at a glance. Decision 4: every answer names its provider. */}}
<p rst-fact{{if .Model}} rst-fact-model{{end}}>
<span rst-fact-label>{{.Label}}</span>
- <span rst-fact-value>{{.Span}}</span>
+ {{/* Short structured values never break; an address or an email
+ can be long, and must wrap rather than widen the page. */}}
+ <span rst-fact-value{{if or (eq .Kind "phone") (eq .Kind "eircode") (eq .Kind "vat")}} rst-nowrap{{end}}>{{.Span}}</span>
{{if .Model}}<span rst-fact-by title="Found by a model, not validated">🤖 {{.Provider}} · {{.Model}}</span>{{end}}
<a href="/documents/{{.DocumentID}}#p{{.Ordinal}}" rst-fact-cite>{{.Title}}{{if .Trail}} › {{.Trail}}{{end}}</a>
</p>
@@ -81,7 +83,8 @@
{{range .Explained}}
<p><strong>{{.Kind}}</strong>: {{.Outcome}}{{if .Qualifiers}} Narrowing words:{{range .Qualifiers}} “{{.}}”{{end}}.{{end}}</p>
{{if .Candidates}}
- <table rst-table>
+ <div rst-scroll-x>
+ <table rst-table rst-explain-table>
<thead><tr><th>Value</th><th>Label</th><th>Document's own label</th><th>Too long</th><th>Matches</th><th>From</th></tr></thead>
<tbody>
{{range .Candidates}}
@@ -96,6 +99,7 @@
{{end}}
</tbody>
</table>
+ </div>
{{end}}
{{end}}
</details>
@@ -137,7 +141,7 @@
<a href="/documents/{{$r.DocumentID}}#p{{$r.Ordinal}}" rst-result-title>{{$r.Title}}</a>
{{if $r.Heading}}<span rst-result-trail>{{$r.Heading}}</span>{{end}}
<p rst-result-snippet>{{$r.Snippet | safeSnippet}}</p>
- <p rst-result-meta rst-muted>{{$r.Source}} · passage {{$r.Ordinal}}</p>
+ <p rst-result-meta rst-muted>{{$r.Source | sourceName}}</p>
</li>
{{end}}
</ol>
diff --git a/internal/memoriatest/factbox_test.go b/internal/memoriatest/factbox_test.go
index 65d8341..3a6cfd7 100644
--- a/internal/memoriatest/factbox_test.go
+++ b/internal/memoriatest/factbox_test.go
@@ -21,7 +21,7 @@ import (
// cannot see any of it. AGENTS.md: a template test proves markup exists,
// not that it renders.
-var factValueRe = regexp.MustCompile(`<span rst-fact-value>([^<]*)</span>`)
+var factValueRe = regexp.MustCompile(`<span rst-fact-value[^>]*>([^<]*)</span>`)
var factLabelRe = regexp.MustCompile(`<span rst-fact-label>([^<]*)</span>`)
func factValues(body string) []string { return capture(factValueRe, body) }
@@ -442,9 +442,9 @@ func TestTheNarrowingLineSitsUnderItsOwnRow(t *testing.T) {
if got := factValues(body); len(got) != 2 {
t.Fatalf("values = %q, want the narrowed phone and the VAT number", got)
}
- phone := strings.Index(body, "<span rst-fact-value>&#43;353 (0)1 547 0001</span>")
+ phone := strings.Index(body, "<span rst-fact-value rst-nowrap>&#43;353 (0)1 547 0001</span>")
note := strings.Index(body, "<p rst-fact-note>")
- vat := strings.Index(body, "<span rst-fact-value>IE3384527RH</span>")
+ vat := strings.Index(body, "<span rst-fact-value rst-nowrap>IE3384527RH</span>")
if phone < 0 || note < 0 || vat < 0 {
t.Fatalf("phone %d, note %d, vat %d: something is missing:\n%s", phone, note, vat, body)
}
diff --git a/internal/memoriatest/reflow_browser_test.go b/internal/memoriatest/reflow_browser_test.go
new file mode 100644
index 0000000..ef3039a
--- /dev/null
+++ b/internal/memoriatest/reflow_browser_test.go
@@ -0,0 +1,101 @@
+//go:build browser
+
+// No page scrolls sideways at a phone's width, in a real Chromium. Run
+// with `make browser`.
+//
+// The UI pass (2026-10-26) stopped values and dates from wrapping, and
+// review found three pages that then ran wider than the screen: a long
+// boxed value at 390px, the documents table at 417px, and the
+// ?explain=facts table at 320px. Measured, not reasoned about: a nowrap
+// rule is correct for a phone number and wrong for an address, and only
+// the page can say which won.
+//
+// MUTATION-TESTED 2026-10-26, each reverted: the documents table's
+// column-hiding breakpoint put back at 26rem → "/ at 417px is 434px
+// wide"; the explanation table's scroll wrapper emptied → "…explain=facts
+// at 320px is 484px wide"; every fact value made nowrap → "/?q=accounts+
+// email at 320px is 536px wide".
+package memoriatest
+
+import (
+ "bytes"
+ "context"
+ "io"
+ "log/slog"
+ "mime/multipart"
+ "net/http"
+ "net/url"
+ "path/filepath"
+ "testing"
+ "time"
+
+ "amadan.net/rastrillo/rastrillo/db"
+ "amadan.net/rastrillo/rastrillo/harness"
+ "github.com/chromedp/cdproto/emulation"
+ "github.com/chromedp/chromedp"
+
+ memoria "amadan.net/oficina/memoria/internal/memoria"
+)
+
+func TestNoSidewaysScrollAtPhoneWidths(t *testing.T) {
+ rig := harness.New(t, func(origin string) http.Handler {
+ logger := slog.New(slog.NewTextHandler(io.Discard, nil))
+ d, err := db.Open(filepath.Join(t.TempDir(), "app.db"), logger)
+ if err != nil {
+ t.Fatalf("db.Open: %v", err)
+ }
+ t.Cleanup(func() { d.Close() })
+ mux, _, err := memoria.AppForTest(d, origin, testDEK(t), logger)
+ if err != nil {
+ t.Fatalf("AppForTest: %v", err)
+ }
+ return mux
+ })
+ for _, doc := range [][2]string{
+ {"Leadership Team — Doc Parsons, Co-founder & Chief Operating Officer", "## Doc Parsons\n\n- +353 86 222 0820"},
+ {"Office", "## Office Address\n\n- The office phone number is: +353 (0)1 547 7854\n" +
+ "- We also have the following unused phone numbers: +353 (0)1 598 1234\n" +
+ " - +353 (0)1 598 1235\n - +353 (0)1 598 1236\n\nOffice VAT: IE3384527RH"},
+ {"Accounts", "## Contact\n\nAccounts email: accounts-payable-and-receivable-team@tito-example.ie"},
+ } {
+ var buf bytes.Buffer
+ mw := multipart.NewWriter(&buf)
+ _ = mw.WriteField("title", doc[0])
+ _ = mw.WriteField("body", doc[1])
+ mw.Close()
+ req, _ := http.NewRequest(http.MethodPost, rig.Origin+"/documents", &buf)
+ req.Header.Set("Content-Type", mw.FormDataContentType())
+ req.Header.Set("Origin", rig.Origin)
+ res, err := http.DefaultClient.Do(req)
+ if err != nil {
+ t.Fatalf("store %q: %v", doc[0], err)
+ }
+ res.Body.Close()
+ }
+
+ paths := []string{
+ "/",
+ "/?q=" + url.QueryEscape("what is the office phone number?") + "&explain=facts",
+ "/?q=" + url.QueryEscape("office phone and vat"),
+ "/?q=" + url.QueryEscape("accounts email"),
+ }
+ for _, width := range []int64{320, 390, 417, 640} {
+ for _, path := range paths {
+ var wide int64
+ ctx, cancel := context.WithTimeout(rig.Context(), 20*time.Second)
+ err := chromedp.Run(ctx,
+ emulation.SetDeviceMetricsOverride(width, 800, 1, true),
+ chromedp.Navigate(rig.Origin+path),
+ chromedp.WaitReady("body", chromedp.ByQuery),
+ chromedp.Evaluate(`document.documentElement.scrollWidth`, &wide),
+ )
+ cancel()
+ if err != nil {
+ t.Fatalf("%s at %dpx: %v", path, width, err)
+ }
+ if wide > width {
+ t.Errorf("%s at %dpx is %dpx wide: the page scrolls sideways", path, width, wide)
+ }
+ }
+ }
+}