oficina / memoria Public

memoria: every surface asks the app of record (suite revision 10)

Paul, 2026-11-01: "Hold private too, check per person." memoria will hold
siblings' private documents too, so the document page, the documents
list, Recently updated and delete now rule each document per person via
VisibleDocuments (the same rule() search uses): refused is 404, an app
that did not answer is a loud 503 or notice, and memoria deletes only
what it owns. The document page had no check at all — harmless under
revision 9, a private-document leak under revision 10. Spec §8.13 and
decision 3 superseded. Six mutations, all red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 1a5c87612d7cee16dac5a7c39d13af54b8718061 parent 4cc0127
8 files changed, +350 −7
  • docs/superpowers/specs/2026-09-03-memoria-design.md +28 −1
  • internal/memoria/handlers.go +110 −5
  • internal/memoria/static/memoria.css +1 −0
  • internal/memoria/store.go +5 −0
  • internal/memoria/templates/documents.html +4 −1
  • internal/memoria/templates/index.html +1 −0
  • internal/memoria/visible.go +72 −0
  • internal/memoria/visible_test.go +129 −0

CI failed — run details

diff --git a/docs/superpowers/specs/2026-09-03-memoria-design.md b/docs/superpowers/specs/2026-09-03-memoria-design.md
index a740d4a..e2b6d84 100644
--- a/docs/superpowers/specs/2026-09-03-memoria-design.md
+++ b/docs/superpowers/specs/2026-09-03-memoria-design.md
@@ -97,7 +97,7 @@ embedding is a plaintext cell in a costume — §3.1.
|---|---|---|---|
| 1 | **The suite is the app; the team is the boundary; the implementer declares the process set.** A team's instances of sheets, docs, calendar and memoria are one trust domain. | Four boundaries, one per process — memoria could then hold only person-initiated snapshots, stale the moment taken | Paul, 2026-09-03 |
| 2 | **Not a doctrine change.** CARLOS apps to date have been single processes, so process and app coincided. Oficina's app is a suite. The doctrine is that the implementer chooses the boundary; this is applying it, not amending it. | Filing it as a family ruling at `carlos/pegamento`, the way home §2.3 filed its divergence | Paul, 2026-09-03 |
-| 3 | **Team-visibility is a CUSTODY rule; the per-asker check is the AUTHORIZATION rule.** Nothing enters memoria from a sibling unless it is team-visible there, which bounds what memoria holds. Who may *read* it is asked of the owning app, per person, per query. | Draft 1's "one ACL: is a member of this team", which conflated the two and left membership drifting across four tables | Paul, 2026-09-03, after review |
+| 3 | ~~**Team-visibility is a CUSTODY rule;**~~ **SUPERSEDED 2026-11-01 by Paul (suite revision 10): "Hold private too, check per person."** memoria holds every live sibling item, private and granted ones included, and the per-asker check (S2) decides who sees each, on every surface, every request (§8.13). Original row: **Team-visibility is a CUSTODY rule; the per-asker check is the AUTHORIZATION rule.** Nothing enters memoria from a sibling unless it is team-visible there, which bounds what memoria holds. Who may *read* it is asked of the owning app, per person, per query. | Draft 1's "one ACL: is a member of this team", which conflated the two and left membership drifting across four tables | Paul, 2026-09-03, after review |
| 4 | **Model egress is permitted to one named provider**, per-team opt-in, fixed by the team owner, named on every answer **and on every derived artefact** (widened 2026-09-05 under suite **§8's binding sentence**, which says "every artefact it produced" and means it — ruling 6's own row says "disclosed", so the phrase is §8's and the citation should not borrow the ruling's number for it — an answer is transient, a §5.2 artefact outlives the query and is regenerated when a source changes, so it can carry a different provider from the one that first made it), disclosed in the README's first paragraph. | No egress at all; OpenRouter choosing per question; a local model only | Paul, 2026-09-03. **The derived-artefact widening is not his**: raised by the memoria session and adopted into A.4 on 2026-09-05, and he has not ruled on it — §13 |
| 5 | **The search floor works with AI switched off**, and is the product. **With AI off, nothing leaves the instance at all** — which §3.2 shows is a larger difference than draft 1 realised. | An answer-first product with search as a fallback | AGENTS.md §Authorship, applied |
| 6 | **Embeddings and FTS5 postings are content.** They never reach replicated SQLite or the bucket unsealed. | Treating a vector as a derived artefact outside §0's scope, on the grounds that no plaintext bytes appear | Fable trust pass, adopted 2026-09-03 |
@@ -4554,6 +4554,33 @@ decrypted and checked to hold no passage text, another person's handle
or feedback id a 404, a tampered handle a 404, and a revoked document's
coordinate shown as a link that its own page refuses.
+### 8.13 Every surface asks, not search alone (suite revision 10, 2026-11-01)
+
+Paul ruled that memoria holds a sibling's private and individually shared
+documents as well as its team ones, each ruled per person by its app of
+record (*"Hold private too, check per person"*; suite doctrine revision
+10). Search always asked (§4.1). **Every other surface that names a
+document now asks too**, through `Store.VisibleDocuments`, which builds the
+same candidates search does and runs the same `rule()`:
+
+- **a document's page** (`/documents/{id}`): `VISIBLE` opens it; a refusal
+ is the same 404 as a document that does not exist; an app that did not
+ answer is a 503 that says so (§4.1's loud withholding);
+- **the documents list** and **"Recently updated"**: only what this person
+ may see, in order, with §4.1's notices for an app that did not answer —
+ "Recently updated" reads a pool of 30 to find five;
+- **delete** (the question and the POST): memoria deletes only what it is
+ the app of record for (§4.2); another app's document is a 404 here, and
+ leaves through that app's feed.
+
+Typeahead, the AI answer, corrections, feedback and the native API all run
+the ruled search already; "Try" suggestions are built from memoria's own
+documents only (§8.11's amendments). Before revision 10 every sibling
+document was team-readable and the document page's missing check was
+harmless; under it, that page would have shown one person another's
+private document. It was found by reading the page against the ruling,
+before any sibling served memoria.
+
## 9. Surfaces
### 9.1 What memoria exposes
diff --git a/internal/memoria/handlers.go b/internal/memoria/handlers.go
index bba15b4..402cfc7 100644
--- a/internal/memoria/handlers.go
+++ b/internal/memoria/handlers.go
@@ -170,6 +170,9 @@ type page struct {
Documents []Summary
// Recent is the front page's "Recently updated" (RecentDocuments).
Recent []Summary
+ // RecentNotices say which apps did not answer for "Recently updated",
+ // so a shorter list never reads as the whole one (§4.1).
+ RecentNotices []string
// Try is the front page's suggested searches (Store.Try).
Try []string
Drop dropZone
@@ -604,10 +607,24 @@ func (a *app) index(w http.ResponseWriter, r *http.Request) {
// themselves (Paul, 2026-10-30: "some suggestions based on real
// data"). A failure shows nothing here and says so in the log;
// the page is a search box either way.
- recent, err := a.store.Recent(r.Context(), RecentDocuments)
+ recent, err := a.store.Recent(r.Context(), recentPool)
if err != nil {
a.logger.Error("recent documents", "err", err)
}
+ if asker, ok := a.asker(r); ok && len(recent) > 0 {
+ kept, notices, err := a.visibleSummaries(r, asker, recent)
+ if err != nil {
+ a.logger.Error("rule recent documents", "err", err)
+ kept = nil
+ }
+ if len(kept) > RecentDocuments {
+ kept = kept[:RecentDocuments]
+ }
+ recent = kept
+ p.RecentNotices = notices
+ } else {
+ recent = nil
+ }
p.Recent = recent
p.Try = a.store.Try(r.Context())
}
@@ -622,6 +639,31 @@ func (a *app) index(w http.ResponseWriter, r *http.Request) {
// lists under the box.
const RecentDocuments = 5
+// recentPool is how many recently updated documents are read to find
+// RecentDocuments this person may see: siblings' private documents are
+// held too, and most of a pool can be somebody else's.
+const recentPool = 30
+
+// visibleSummaries keeps the summaries this person may see, in order, with
+// §4.1's notices for anything an app did not answer for.
+func (a *app) visibleSummaries(r *http.Request, asker suite.Subject, docs []Summary) ([]Summary, []string, error) {
+ ids := make([]int64, 0, len(docs))
+ for _, d := range docs {
+ ids = append(ids, d.ID)
+ }
+ vis, notices, err := a.store.VisibleDocuments(r.Context(), asker, ids)
+ if err != nil {
+ return nil, nil, err
+ }
+ kept := make([]Summary, 0, len(docs))
+ for _, d := range docs {
+ if vis[d.ID] {
+ kept = append(kept, d)
+ }
+ }
+ return kept, notices, nil
+}
+
// documents is GET /documents: everything stored, with Add content and
// each document's Delete. It was the bottom of the front page until Paul
// asked for a front page that is only a search box (2026-10-29).
@@ -633,6 +675,20 @@ func (a *app) documents(w http.ResponseWriter, r *http.Request) {
a.errorPage(w, r, http.StatusInternalServerError, kindDocument, "")
return
}
+ // Only what this person may see, asked of each document's app of
+ // record (VisibleDocuments): memoria holds siblings' private documents
+ // too (suite revision 10), and a list is a surface like any other.
+ asker, ok := a.asker(r)
+ if !ok {
+ a.errorPage(w, r, http.StatusNotFound, kindDocument, "")
+ return
+ }
+ docs, p.Notices, err = a.visibleSummaries(r, asker, docs)
+ if err != nil {
+ a.logger.Error("rule documents", "err", err)
+ a.errorPage(w, r, http.StatusInternalServerError, kindDocument, "")
+ return
+ }
p.Documents = docs
// A failed delete redirects here, with a cookie of its own; see
// notice.go.
@@ -1196,6 +1252,48 @@ type documentPage struct {
Passages []passage
}
+// ownDocument answers 404 for a document another app owns: memoria may
+// delete only what it is the app of record for (§4.2). A sibling's document
+// is deleted in its own app and leaves through that app's feed; deleting
+// memoria's copy would only re-ingest it.
+func (a *app) ownDocument(w http.ResponseWriter, r *http.Request, id int64) bool {
+ sib, err := a.store.IsSiblingDocument(r.Context(), id)
+ if err != nil || sib {
+ a.errorPage(w, r, http.StatusNotFound, kindDocument, "")
+ return false
+ }
+ return true
+}
+
+// mayOpen asks whether this person may see document id now, and answers
+// the request itself when not: 404 when its app of record says no (never
+// 403, so "not yours" and "not there" are one answer), and a 503 that says
+// so when the app could not be asked (§4.1: withheld loudly, never
+// silently). Memoria's own documents are always yours to open.
+func (a *app) mayOpen(w http.ResponseWriter, r *http.Request, id int64) bool {
+ asker, ok := a.asker(r)
+ if !ok {
+ a.errorPage(w, r, http.StatusNotFound, kindDocument, "")
+ return false
+ }
+ vis, notices, err := a.store.VisibleDocuments(r.Context(), asker, []int64{id})
+ switch {
+ case err != nil:
+ ref := rastrillo.NewRef()
+ a.logger.Error("rule a document", "id", id, "ref", ref, "err", err)
+ a.errorPage(w, r, http.StatusInternalServerError, kindStatus, ref)
+ return false
+ case vis[id]:
+ return true
+ case len(notices) > 0:
+ a.errorPage(w, r, http.StatusServiceUnavailable, kindStatus, "")
+ return false
+ default:
+ a.errorPage(w, r, http.StatusNotFound, kindDocument, "")
+ return false
+ }
+}
+
// documentID is the {id} in the URL, or false for anything that is not
// one — which is the same 404 as a document that is not there.
func documentID(r *http.Request) (int64, bool) {
@@ -1209,6 +1307,9 @@ func (a *app) showDocument(w http.ResponseWriter, r *http.Request) {
a.errorPage(w, r, http.StatusNotFound, kindDocument, "")
return
}
+ if !a.mayOpen(w, r, id) {
+ return
+ }
title, body, err := a.store.Body(r.Context(), id)
if err != nil {
// A row that is not there 404s. It never 403s, so a document
@@ -1273,8 +1374,10 @@ func (a *app) showDocument(w http.ResponseWriter, r *http.Request) {
// POST to the same path is the delete.
func (a *app) confirmDelete(w http.ResponseWriter, r *http.Request) {
id, ok := documentID(r)
- if !ok {
- a.errorPage(w, r, http.StatusNotFound, kindDocument, "")
+ if !ok || !a.ownDocument(w, r, id) {
+ if !ok {
+ a.errorPage(w, r, http.StatusNotFound, kindDocument, "")
+ }
return
}
title, _, err := a.store.Body(r.Context(), id)
@@ -1291,8 +1394,10 @@ func (a *app) confirmDelete(w http.ResponseWriter, r *http.Request) {
func (a *app) deleteDocument(w http.ResponseWriter, r *http.Request) {
id, ok := documentID(r)
- if !ok {
- a.errorPage(w, r, http.StatusNotFound, kindDocument, "")
+ if !ok || !a.ownDocument(w, r, id) {
+ if !ok {
+ a.errorPage(w, r, http.StatusNotFound, kindDocument, "")
+ }
return
}
if err := a.store.Delete(r.Context(), id); err != nil {
diff --git a/internal/memoria/static/memoria.css b/internal/memoria/static/memoria.css
index 9e443f0..cd40575 100644
--- a/internal/memoria/static/memoria.css
+++ b/internal/memoria/static/memoria.css
@@ -124,6 +124,7 @@ html { scrollbar-gutter: stable; }
half the screen less the bar, the main area's own padding and half the
box. The lists below it grow downwards and never move it. */
[rst-home] { padding-top: max(1rem, calc(50svh - 9.5rem)); min-height: 70svh; }
+[rst-home-notice] { font-size: 0.8125rem; margin: 0 0 0.4rem; }
[rst-home-try] {
align-items: center;
display: flex;
diff --git a/internal/memoria/store.go b/internal/memoria/store.go
index af1d573..7b1a01d 100644
--- a/internal/memoria/store.go
+++ b/internal/memoria/store.go
@@ -223,6 +223,10 @@ type Summary struct {
Updated string
UpdatedDay string
UpdatedISO string
+ // Sibling is set when another app is this document's app of record:
+ // memoria lists it only after asking that app (VisibleDocuments) and
+ // never offers to delete it (§4.2).
+ Sibling bool
}
// externalID keys a document by its stable source identifier.
@@ -1042,6 +1046,7 @@ func (s *Store) Summaries(ctx context.Context) ([]Summary, error) {
Updated: stamp(d.UpdatedAt),
UpdatedDay: d.UpdatedAt.UTC().Format("2 Jan 2006"),
UpdatedISO: d.UpdatedAt.UTC().Format(time.RFC3339),
+ Sibling: len(d.SiblingItemID) > 0,
})
}
return out, nil
diff --git a/internal/memoria/templates/documents.html b/internal/memoria/templates/documents.html
index c4c4e94..dbbe930 100644
--- a/internal/memoria/templates/documents.html
+++ b/internal/memoria/templates/documents.html
@@ -1,6 +1,7 @@
{{/* /documents: everything stored, moved off the front page (Paul,
2026-10-29). Adding lives at /add; a failed delete lands here. */}}
{{define "content"}}
+{{if .Notices}}<div rst-callout rst-tone="warning" rst-withheld><div rst-callout-body>{{range .Notices}}<p>{{.}}</p>{{end}}</div></div>{{end}}
{{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>
@@ -27,7 +28,9 @@
<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>
+ {{/* Only memoria's own documents can be deleted here; another app's
+ is deleted in that app (§4.2). */}}
+ <td>{{if not .Sibling}}<a rst-btn="quiet compact" href="/documents/{{.ID}}/delete">Delete</a>{{end}}</td>
</tr>
{{end}}
</tbody>
diff --git a/internal/memoria/templates/index.html b/internal/memoria/templates/index.html
index 62067db..438c9c0 100644
--- a/internal/memoria/templates/index.html
+++ b/internal/memoria/templates/index.html
@@ -48,6 +48,7 @@
{{with .Recent}}
<section>
<h2 rst-home-label>Recently updated</h2>
+ {{range $.RecentNotices}}<p rst-muted rst-home-notice>{{.}}</p>{{end}}
<ul rst-home-list>
{{/* The whole row opens it (Paul, 2026-10-31): rastrillo's list row,
whose one primary link covers the row. */}}
diff --git a/internal/memoria/visible.go b/internal/memoria/visible.go
new file mode 100644
index 0000000..94f4c03
--- /dev/null
+++ b/internal/memoria/visible.go
@@ -0,0 +1,72 @@
+package memoria
+
+import (
+ "context"
+ "fmt"
+
+ "amadan.net/oficina/suite"
+
+ "amadan.net/oficina/memoria/internal/memoria/seal"
+ "amadan.net/oficina/memoria/internal/memoria/sibling"
+)
+
+// VisibleDocuments rules a set of documents for one person, the way search
+// rules a set of passages (§4.1), for every surface that names a document
+// outside search: the documents list, "Recently updated", a document's
+// own page, its delete question.
+//
+// **Why every surface, not search alone** (suite revision 10, Paul,
+// 2026-11-01: "Hold private too, check per person"). Memoria now holds a
+// sibling's private and individually shared documents as well as its team
+// ones, so a page that named a sibling document without asking its app
+// would show one person somebody else's private document. Before revision
+// 10 every sibling document was team-readable and the omission was
+// harmless; the document page did not ask, and it was found by reading the
+// page against the new rule.
+//
+// It returns the ids this person may see now, and §4.1's loud notices for
+// anything an app did not answer for. Memoria's own documents (§4.2) are
+// always visible: there is nobody else to ask. An id with no row is simply
+// absent.
+func (s *Store) VisibleDocuments(ctx context.Context, asker suite.Subject, ids []int64) (map[int64]bool, []string, error) {
+ visible := map[int64]bool{}
+ if len(ids) == 0 {
+ return visible, nil, nil
+ }
+ if asker.Value == "" {
+ return nil, nil, fmt.Errorf("visible documents: no asker; nothing can be authorized")
+ }
+ var docs []Document
+ if err := s.db.G.WithContext(ctx).Select("id", "source", "sibling_item_id", "sibling_revision").
+ Where("id IN ?", ids).Find(&docs).Error; err != nil {
+ return nil, nil, err
+ }
+ all := make([]Result, 0, len(docs))
+ for _, d := range docs {
+ r := Result{DocumentID: d.ID, Source: d.Source}
+ if len(d.SiblingItemID) > 0 {
+ id, err := s.sealer.Open(seal.PurposeItemID, d.SiblingItemID)
+ if err != nil {
+ return nil, nil, fmt.Errorf("open item id %d: %w", d.ID, err)
+ }
+ r.item = sibling.Candidate{Item: suite.ItemRevision{ItemID: string(id), Revision: d.SiblingRevision}}
+ }
+ all = append(all, r)
+ }
+ page := s.rule(ctx, asker, all)
+ for _, r := range page.Results {
+ visible[r.DocumentID] = true
+ }
+ return visible, page.Notices, nil
+}
+
+// IsSiblingDocument reports whether a document's app of record is another
+// app. Memoria may delete only what it owns (§4.2); a sibling's document is
+// deleted in its own app and leaves through that app's feed.
+func (s *Store) IsSiblingDocument(ctx context.Context, id int64) (bool, error) {
+ var d Document
+ if err := s.db.G.WithContext(ctx).Select("id", "sibling_item_id").Where("id = ?", id).Limit(1).Find(&d).Error; err != nil {
+ return false, err
+ }
+ return len(d.SiblingItemID) > 0, nil
+}
diff --git a/internal/memoria/visible_test.go b/internal/memoria/visible_test.go
new file mode 100644
index 0000000..e773721
--- /dev/null
+++ b/internal/memoria/visible_test.go
@@ -0,0 +1,129 @@
+package memoria
+
+import (
+ "context"
+ "io"
+ "log/slog"
+ "net/http"
+ "net/http/httptest"
+ "path/filepath"
+ "strconv"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/suite"
+ "amadan.net/rastrillo/rastrillo/db"
+
+ "amadan.net/oficina/memoria/internal/memoria/seal"
+)
+
+// Every surface that names a document asks its app of record first (suite
+// revision 10, Paul, 2026-11-01: memoria holds siblings' private documents
+// too, ruled per person). Search always did; the document page, the
+// documents list, "Recently updated" and the delete question did not.
+//
+// MUTATION-TESTED 2026-11-01, each reverted: showDocument's mayOpen call
+// removed → "the document page"; the documents list left unfiltered →
+// "the documents list"; Recently updated left unfiltered → "recently
+// updated"; ownDocument removed from the delete question → "delete";
+// the UNKNOWN branch answering 404 → "an app that did not answer".
+func TestEverySurfaceAsksTheAppOfRecord(t *testing.T) {
+ logger := slog.New(slog.NewTextHandler(io.Discard, nil))
+ d, err := db.Open(filepath.Join(t.TempDir(), "app.db"), logger)
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Cleanup(func() { d.Close() })
+ dek := make([]byte, 32)
+ for i := range dek {
+ dek[i] = byte(i * 11)
+ }
+ sealer, err := seal.New(dek)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mux, a, err := AppForTest(d, "http://127.0.0.1:8899", sealer, logger)
+ if err != nil {
+ t.Fatal(err)
+ }
+ cus := &perItemCustody{apps: docsRoster(), give: map[string]suite.Authorization{
+ "theirs": suite.NOT_VISIBLE,
+ "unknown": suite.UNKNOWN,
+ }}
+ a.store.custody = cus
+ ctx := context.Background()
+ ingest := func(spec IngestSpec) int64 {
+ id, err := a.store.Ingest(ctx, spec)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return id
+ }
+ own := ingest(IngestSpec{Source: "upload", Key: "own", Title: "My upload", Body: "Mine."})
+ mine := ingest(IngestSpec{Source: "Docs", Key: "mine", Title: "Shared with me", Body: "Visible.", ItemID: "mine", SiblingRevision: 1})
+ theirs := ingest(IngestSpec{Source: "Docs", Key: "theirs", Title: "Somebody else's private plan", Body: "Secret.", ItemID: "theirs", SiblingRevision: 1})
+ unknown := ingest(IngestSpec{Source: "Docs", Key: "unknown", Title: "Docs could not say", Body: "Maybe.", ItemID: "unknown", SiblingRevision: 1})
+
+ get := func(path string) *httptest.ResponseRecorder {
+ req := httptest.NewRequest("GET", path, nil)
+ req.Header.Set("Accept", "text/html")
+ rec := httptest.NewRecorder()
+ mux.ServeHTTP(rec, req)
+ return rec
+ }
+ doc := func(id int64) string { return "/documents/" + strconv.FormatInt(id, 10) }
+
+ // The document page.
+ if rec := get(doc(mine)); rec.Code != 200 || !strings.Contains(rec.Body.String(), "Shared with me") {
+ t.Errorf("the document page: one shared with me = %d", rec.Code)
+ }
+ if rec := get(doc(own)); rec.Code != 200 {
+ t.Errorf("the document page: memoria's own = %d", rec.Code)
+ }
+ if rec := get(doc(theirs)); rec.Code != 404 || strings.Contains(rec.Body.String(), "Secret") || strings.Contains(rec.Body.String(), "private plan") {
+ t.Errorf("the document page: somebody else's private document = %d", rec.Code)
+ }
+ if rec := get(doc(unknown)); rec.Code != 503 {
+ t.Errorf("an app that did not answer: the document page = %d, want 503", rec.Code)
+ }
+
+ // The documents list.
+ list := get("/documents").Body.String()
+ if !strings.Contains(list, "Shared with me") || !strings.Contains(list, "My upload") {
+ t.Errorf("the documents list: what I may see is missing")
+ }
+ if strings.Contains(list, "private plan") || strings.Contains(list, "could not say") {
+ t.Errorf("the documents list: names a document this person may not see")
+ }
+ if !strings.Contains(list, "rst-withheld") {
+ t.Errorf("the documents list: Docs did not answer for one, and the page does not say so")
+ }
+
+ // Recently updated, on the front page.
+ home := get("/").Body.String()
+ if strings.Contains(home, "private plan") || strings.Contains(home, "could not say") {
+ t.Errorf("recently updated: names a document this person may not see")
+ }
+ if !strings.Contains(home, "Shared with me") {
+ t.Errorf("recently updated: what I may see is missing")
+ }
+
+ // Delete: memoria deletes only what it owns.
+ if rec := get(doc(mine) + "/delete"); rec.Code != 404 {
+ t.Errorf("delete: the question for another app's document = %d, want 404", rec.Code)
+ }
+ if rec := get(doc(own) + "/delete"); rec.Code != 200 {
+ t.Errorf("delete: the question for memoria's own = %d", rec.Code)
+ }
+ post := httptest.NewRequest(http.MethodPost, doc(mine)+"/delete", nil)
+ post.Header.Set("Origin", "http://127.0.0.1:8899")
+ post.Header.Set("Accept", "text/html")
+ rec := httptest.NewRecorder()
+ mux.ServeHTTP(rec, post)
+ if rec.Code != 404 {
+ t.Errorf("delete: the POST for another app's document = %d, want 404", rec.Code)
+ }
+ if vis, _, _ := a.store.VisibleDocuments(ctx, suite.Subject{Kind: suite.SubjectAddress, Value: "x@example.com"}, []int64{mine}); !vis[mine] {
+ t.Errorf("delete: another app's document was deleted by the POST")
+ }
+}