WIP memoria: whole rows open — lists, the documents table, sources; one Try per person
Paul, 2026-10-31: "the link should fill the whole list item". The front page's lists are rastrillo's list row ([rst-row]/[rst-row-main]); the documents table and sources list use Memoria's own [rst-click-row], a stretched link on layer 1 with Delete on layer 2. A first version named its rows rst-row, which is rastrillo's: its control lift hid whether Memoria's own rule worked, and broke the table into flex. Browser test, three mutations red. Try now offers each person once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 files changed,
+158
−23
Makefile+1 −1internal/memoria/static/memoria.css+28 −10internal/memoria/static/search.js+7 −1internal/memoria/templates/connectors.html+2 −2internal/memoria/templates/documents.html+4 −2internal/memoria/templates/index.html+3 −1internal/memoria/trysuggest.go+14 −5internal/memoria/trysuggest_test.go+5 −1internal/memoriatest/rows_browser_test.go+94 −0
CI failed — run details
diff --git a/Makefile b/Makefile| index d7bc7e7..d36dfd1 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|NoSidewaysScroll|SettlesADeferredBox|WholeResultIsALink|StaleAIAnswer|AnswerSlotSettles|ThumbsUp|TypeaheadAnswerCopies' ./internal/memoriatest/ |
| + RASTRILLO_CHROME="$(RASTRILLO_CHROME)" CGO_ENABLED=0 go test -tags browser -count=1 -run 'OnTap|ProductionCSP|NoSidewaysScroll|SettlesADeferredBox|WholeResultIsALink|StaleAIAnswer|AnswerSlotSettles|ThumbsUp|TypeaheadAnswerCopies|AWholeRowOpens' ./internal/memoriatest/ |
| .PHONY: credits |
| credits: |
diff --git a/internal/memoria/static/memoria.css b/internal/memoria/static/memoria.css| index 20df9fc..1be2e76 100644 |
| --- a/internal/memoria/static/memoria.css |
| +++ b/internal/memoria/static/memoria.css |
| @@ -162,16 +162,13 @@ html { scrollbar-gutter: stable; } |
| } |
| [rst-home-clear]:hover { color: var(--rst-text); } |
| [rst-home-list] { list-style: none; margin: 0; padding: 0; } |
| -[rst-home-list] li { |
| - border-bottom: 1px solid var(--rst-line); |
| - font-size: 0.9375rem; |
| - overflow: hidden; |
| - padding: 0.45rem 0; |
| - text-overflow: ellipsis; |
| - white-space: nowrap; |
| -} |
| -[rst-home-list] a { color: var(--rst-text); text-decoration: none; } |
| -[rst-home-list] a:hover { text-decoration: underline; } |
| +/* The front page's lists are rastrillo's list rows; a little tighter |
| + than its default, as a secondary part of a page. */ |
| +[rst-home-list] [rst-row] { padding: 0.55rem 0.5rem; margin: 0 -0.5rem; border-radius: 0.375rem; border-top: 0; border-bottom: 1px solid var(--rst-line); } |
| +[rst-home-list] [rst-row-main] > a { font-weight: 500; } |
| +[rst-home-list] [rst-row-main] > a, |
| +[rst-home-list] [rst-row-sub] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } |
| +[rst-home-list] [rst-row-main] > a { display: block; } |
| [rst-home] [rst-search] { margin-bottom: 0.75rem; } |
| @media (max-width: 640px) { |
| [rst-home] { padding-top: 18svh; } |
| @@ -770,3 +767,24 @@ h3[rst-doc-heading] { font-size: 1.1rem; } |
| [rst-foot-details] summary { cursor: pointer; font-size: 0.8125rem; list-style: none; } |
| [rst-foot-details] summary::-webkit-details-marker { display: none; } |
| [rst-foot-details] p { font-size: 0.8125rem; margin: 0.5rem 0 0; } |
| + |
| +/* A table row or list item whose main link opens it (Paul, 2026-10-31: |
| + any list item with a link should be clickable as a whole). Where a |
| + list can be rastrillo's own list row ([rst-row] / [rst-row-main], the |
| + front page's lists) it is; this is for what cannot — a table row, which |
| + [rst-row] would turn into a flex box, and the sources list's grid. |
| + Memoria's own attribute names, because [rst-row] is rastrillo's. |
| + |
| + The link's ::after stretches over the row on layer 1, so the whole row |
| + is the link with no script, and every other control in the row — a |
| + Delete — sits on layer 2 and keeps its own click. The link itself is |
| + static, because a shared stylesheet makes links position: relative, |
| + which kept the stretch inside the link's own text (found by the browser |
| + test). */ |
| +[rst-click-row] { position: relative; } |
| +[rst-click-row] [rst-click-link] { position: static; } |
| +[rst-click-link]::after { content: ""; inset: 0; position: absolute; z-index: 1; } |
| +[rst-click-row] a:not([rst-click-link]), |
| +[rst-click-row] button, |
| +[rst-click-row] form { position: relative; z-index: 2; } |
| +[rst-click-row]:hover { background: var(--rst-surface-2); } |
diff --git a/internal/memoria/static/search.js b/internal/memoria/static/search.js| index a80ff98..797e330 100644 |
| --- a/internal/memoria/static/search.js |
| +++ b/internal/memoria/static/search.js |
| @@ -240,12 +240,18 @@ |
| var ul = section.querySelector("[rst-home-list]"); |
| var past = load(); |
| if (!past.length) return; |
| + // rastrillo's list row, as the server draws "Recently updated": the |
| + // one link covers the row. |
| past.forEach(function (x) { |
| var li = document.createElement("li"); |
| + li.setAttribute("rst-row", ""); |
| + var main = document.createElement("span"); |
| + main.setAttribute("rst-row-main", ""); |
| var a = document.createElement("a"); |
| a.href = "/?q=" + encodeURIComponent(x); |
| a.textContent = x; |
| - li.appendChild(a); |
| + main.appendChild(a); |
| + li.appendChild(main); |
| ul.appendChild(li); |
| }); |
| section.hidden = false; |
diff --git a/internal/memoria/templates/connectors.html b/internal/memoria/templates/connectors.html| index 87b3f83..4b8ee4c 100644 |
| --- a/internal/memoria/templates/connectors.html |
| +++ b/internal/memoria/templates/connectors.html |
| @@ -54,8 +54,8 @@ |
| <h2>Connectors</h2> |
| <ul rst-sources> |
| - <li> |
| - <a href="/connectors/notion" rst-source-name>Notion</a> |
| + <li rst-click-row> |
| + <a href="/connectors/notion" rst-source-name rst-click-link>Notion</a> |
| <p rst-muted> |
| {{if .Configured}}Connected.{{else}}Not connected.{{end}} |
| Imports the pages you share with a Notion integration, and everything nested under them. |
diff --git a/internal/memoria/templates/documents.html b/internal/memoria/templates/documents.html| index 06824f3..c4c4e94 100644 |
| --- a/internal/memoria/templates/documents.html |
| +++ b/internal/memoria/templates/documents.html |
| @@ -18,8 +18,10 @@ |
| <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> |
| + {{/* The whole row opens the document (Paul, 2026-10-31): the title's |
| + link stretches over the row, and Delete sits above it. */}} |
| + <tr rst-click-row> |
| + <td><a href="/documents/{{.ID}}" rst-click-link>{{.Title}}</a></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> |
diff --git a/internal/memoria/templates/index.html b/internal/memoria/templates/index.html| index d791512..e55f458 100644 |
| --- a/internal/memoria/templates/index.html |
| +++ b/internal/memoria/templates/index.html |
| @@ -43,7 +43,9 @@ |
| <section> |
| <h2 rst-home-label>Recently updated</h2> |
| <ul rst-home-list> |
| - {{range .}}<li><a href="/documents/{{.ID}}">{{.Title}}</a>{{if .Path}} <span rst-muted>· {{.Path}}</span>{{end}} <span rst-muted>· <time datetime="{{.UpdatedISO}}">{{.UpdatedDay}}</time></span></li>{{end}} |
| + {{/* The whole row opens it (Paul, 2026-10-31): rastrillo's list row, |
| + whose one primary link covers the row. */}} |
| + {{range .}}<li rst-row><span rst-row-main><a href="/documents/{{.ID}}">{{.Title}}</a><span rst-row-sub>{{if .Path}}{{.Path}} · {{end}}<time datetime="{{.UpdatedISO}}">{{.UpdatedDay}}</time></span></span></li>{{end}} |
| </ul> |
| </section> |
| {{end}} |
diff --git a/internal/memoria/trysuggest.go b/internal/memoria/trysuggest.go| index fe26617..6bd404f 100644 |
| --- a/internal/memoria/trysuggest.go |
| +++ b/internal/memoria/trysuggest.go |
| @@ -175,7 +175,10 @@ func (s *Store) workOutTry(ctx context.Context) ([]string, error) { |
| for k, ds := range merged { |
| byLabel = append(byLabel, scored{spelled[k], len(ds)}) |
| } |
| - var byPerson []scored |
| + // One suggestion per name: two documents titled "Paul Campbell" (a |
| + // people row and a profile, say) offered "who is Paul Campbell" twice |
| + // (Paul, 2026-10-31). The name keeps its best count. |
| + people := map[string]int{} |
| for id, title := range own { |
| if !personTitle.MatchString(title) { |
| continue |
| @@ -186,19 +189,25 @@ func (s *Store) workOutTry(ctx context.Context) ([]string, error) { |
| n++ |
| } |
| } |
| + if n > people[title] { |
| + people[title] = n |
| + } |
| + } |
| + var byPerson []scored |
| + for title, n := range people { |
| if n > 0 { |
| byPerson = append(byPerson, scored{"who is " + title, n}) |
| } |
| } |
| - kinds, people := rank(byLabel), rank(byPerson) |
| + kinds, persons := rank(byLabel), rank(byPerson) |
| // Alternate, so neither kind crowds the other out. |
| var out []string |
| - for i := 0; len(out) < MaxTry && (i < len(kinds) || i < len(people)); i++ { |
| + for i := 0; len(out) < MaxTry && (i < len(kinds) || i < len(persons)); i++ { |
| if i < len(kinds) { |
| out = append(out, kinds[i]) |
| } |
| - if i < len(people) && len(out) < MaxTry { |
| - out = append(out, people[i]) |
| + if i < len(persons) && len(out) < MaxTry { |
| + out = append(out, persons[i]) |
| } |
| } |
| if out == nil { |
diff --git a/internal/memoria/trysuggest_test.go b/internal/memoria/trysuggest_test.go| index eb7bb88..8ad6ce2 100644 |
| --- a/internal/memoria/trysuggest_test.go |
| +++ b/internal/memoria/trysuggest_test.go |
| @@ -15,7 +15,9 @@ import ( |
| // MUTATION-TESTED 2026-10-30, each reverted: sibling documents not |
| // skipped → "a sibling's words"; the kind word not added → "office"; |
| // labels not merged → "merged"; a person counted from their own document |
| -// → "only mentioned by itself"; the TTL check removed → "cached". |
| +// → "only mentioned by itself"; the TTL check removed → "cached"; one |
| +// suggestion per document rather than per name → "who is Bill Horsman" |
| +// twice (Paul's screenshot, 2026-10-31). |
| func TestTryIsBuiltFromTheDocuments(t *testing.T) { |
| ctx := context.Background() |
| s := storeForTest(t) |
| @@ -25,6 +27,8 @@ func TestTryIsBuiltFromTheDocuments(t *testing.T) { |
| {Source: "upload", Key: "b", Title: "Bill Horsman", Body: "Membership Type: Member"}, |
| {Source: "upload", Key: "m", Title: "Board notes", Body: "Bill Horsman to circulate the minutes."}, |
| {Source: "upload", Key: "x", Title: "Ann Lone", Body: "Nobody else mentions Ann."}, |
| + // A second document with the same name: still one suggestion. |
| + {Source: "upload", Key: "b2", Title: "Bill Horsman", Body: "Profile: on the board since 2019."}, |
| } { |
| if _, err := s.Ingest(ctx, d); err != nil { |
| t.Fatal(err) |
diff --git a/internal/memoriatest/rows_browser_test.go b/internal/memoriatest/rows_browser_test.go| new file mode 100644 |
| index 0000000..974c20b |
| --- /dev/null |
| +++ b/internal/memoriatest/rows_browser_test.go |
| @@ -0,0 +1,94 @@ |
| +//go:build browser |
| + |
| +package memoriatest |
| + |
| +import ( |
| + "context" |
| + "io" |
| + "log/slog" |
| + "net/http" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/rastrillo/rastrillo/db" |
| + "amadan.net/rastrillo/rastrillo/harness" |
| + "github.com/chromedp/chromedp" |
| + |
| + memoria "amadan.net/oficina/memoria/internal/memoria" |
| +) |
| + |
| +// A list row with a link opens as a whole (Paul, 2026-10-31: "the link |
| +// should fill the whole list item"): a click on a row's empty part goes |
| +// where its link goes, and a Delete in the same row is still a Delete. |
| +// |
| +// MUTATION-TESTED 2026-10-31, each reverted: the ::after stretch removed |
| +// → "documents row"; the front page's row not rastrillo's list row |
| +// (rst-row-main dropped) → "recently updated"; Delete not lifted above |
| +// the stretch → "Delete". The first version named its rows rst-row, which |
| +// is rastrillo's own list row: its control-lifting rule kept Delete |
| +// working whatever this app's CSS said, and the Delete mutation stayed |
| +// green until the names were Memoria's own. |
| +func TestAWholeRowOpens(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, a, err := memoria.AppForTest(d, origin, testDEK(t), logger) |
| + if err != nil { |
| + t.Fatalf("AppForTest: %v", err) |
| + } |
| + if _, err := a.Store().Ingest(context.Background(), memoria.IngestSpec{Source: "upload", Key: "o", Title: "Office", Body: "Office phone: +353 (0)1 547 7854"}); err != nil { |
| + t.Fatal(err) |
| + } |
| + return mux |
| + }) |
| + ctx, cancel := context.WithTimeout(rig.Context(), 40*time.Second) |
| + defer cancel() |
| + // clickAt clicks a point inside the element, near its right edge: |
| + // past the link's own text, on the row's empty part. |
| + clickRight := func(sel string) chromedp.Action { |
| + return chromedp.ActionFunc(func(ctx context.Context) error { |
| + var box []float64 |
| + if err := chromedp.Evaluate(`(function(){var r=document.querySelector(`+"`"+sel+"`"+`).getBoundingClientRect();return [r.right-8, r.top+r.height/2]})()`, &box).Do(ctx); err != nil { |
| + return err |
| + } |
| + return chromedp.MouseClickXY(box[0], box[1]).Do(ctx) |
| + }) |
| + } |
| + var home, docs, del string |
| + err := chromedp.Run(ctx, |
| + chromedp.Navigate(rig.Origin+"/"), |
| + chromedp.WaitVisible(`[rst-home-list] li`, chromedp.ByQuery), |
| + clickRight(`[rst-home-list] li`), |
| + chromedp.Sleep(800*time.Millisecond), |
| + chromedp.Location(&home), |
| + chromedp.Navigate(rig.Origin+"/documents"), |
| + chromedp.WaitVisible(`tr[rst-click-row]`, chromedp.ByQuery), |
| + // The Updated cell: neither the title nor Delete. |
| + clickRight(`tr[rst-click-row] td:nth-child(4)`), |
| + chromedp.Sleep(800*time.Millisecond), |
| + chromedp.Location(&docs), |
| + chromedp.Navigate(rig.Origin+"/documents"), |
| + chromedp.WaitVisible(`tr[rst-click-row]`, chromedp.ByQuery), |
| + chromedp.Click(`tr[rst-click-row] a[href$="/delete"]`, chromedp.ByQuery), |
| + chromedp.Sleep(800*time.Millisecond), |
| + chromedp.Location(&del), |
| + ) |
| + if err != nil { |
| + t.Fatalf("rows: %v", err) |
| + } |
| + if !strings.Contains(home, "/documents/") || strings.HasSuffix(home, "/delete") { |
| + t.Errorf("recently updated: a click on the row went to %s", home) |
| + } |
| + if !strings.Contains(docs, "/documents/") || strings.HasSuffix(docs, "/delete") || strings.HasSuffix(docs, "/documents") { |
| + t.Errorf("documents row: a click on the row went to %s", docs) |
| + } |
| + if !strings.HasSuffix(del, "/delete") { |
| + t.Errorf("Delete: a click on it went to %s", del) |
| + } |
| +} |