Docs team mode: an empty list under Unknown is partial, not a 503
Paul's ruling on list pages, as worded: under Unknown the list page shows the empty state with the partial notice. Only the list page, which renders the notice, may list empty under Unknown; the native list and the dashboard feed stay unavailable, and NotMember stays complete.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+59
−2
internal/docs/grants.go+1 −1internal/docs/handlers.go+3 −0internal/docs/team_access.go+13 −0internal/docs/team_emission.go+1 −1internal/docs/team_router_test.go+41 −0
CI passed — run details
diff --git a/internal/docs/grants.go b/internal/docs/grants.go| index fd7e3e8..8e431eb 100644 |
| --- a/internal/docs/grants.go |
| +++ b/internal/docs/grants.go |
| @@ -350,7 +350,7 @@ func (s *Store) listForLimited(ctx context.Context, a Actor, limit int) ([]*Docu |
| } |
| if s.team != nil && len(docs) == 0 { |
| a, ok := s.access(ctx, a) |
| - if !ok || a.state() == roster.Unknown { |
| + if !ok || a.state() == roster.Unknown && !a.partialNotice { |
| return nil, errTeamUnavailable |
| } |
| } |
diff --git a/internal/docs/handlers.go b/internal/docs/handlers.go| index b944d19..57c7b11 100644 |
| --- a/internal/docs/handlers.go |
| +++ b/internal/docs/handlers.go |
| @@ -283,6 +283,9 @@ func (h *handlers) list(w http.ResponseWriter, r *http.Request) { |
| // JavaScript (spec §6.2) — the form is a GET and the page it lands |
| // on is an ordinary page. |
| query := strings.TrimSpace(r.URL.Query().Get("q")) |
| + // This page shows the partial notice, so under Unknown its list may be |
| + // empty: the empty state and the notice, not a 503. |
| + h.acceptPartial(r) |
| data := listPage{ |
| HomeLinkLabel: h.homeLinkLabel(r), |
diff --git a/internal/docs/team_access.go b/internal/docs/team_access.go| index 0dbdb30..9713204 100644 |
| --- a/internal/docs/team_access.go |
| +++ b/internal/docs/team_access.go |
| @@ -22,6 +22,9 @@ type requestAccess struct { |
| responseDocs map[int64]permission |
| runtime *teamRuntime |
| actor Actor |
| + // partialNotice: this response renders the partial notice, so a list |
| + // built under Unknown may be empty (acceptPartial). |
| + partialNotice bool |
| } |
| type permission uint8 |
| @@ -213,6 +216,16 @@ func (h *handlers) requireMemberRequest(w http.ResponseWriter, r *http.Request, |
| return false |
| } |
| +// acceptPartial lets a list built under Unknown be empty, for a response |
| +// that renders the partial notice: an empty partial list, not a 503 (Paul's |
| +// ruling, 2026-10-28). A list nobody marks (the dashboard feed, the native |
| +// list) keeps refusing an empty Unknown list as unavailable. |
| +func (h *handlers) acceptPartial(r *http.Request) { |
| + if a, ok := r.Context().Value(accessContextKey{}).(*requestAccess); ok && a != nil && a.runtime == h.store.team { |
| + a.partialNotice = true |
| + } |
| +} |
| + |
| // partialCatalog is the notice for a list built under Unknown: the person's |
| // shares, without the team rung (Paul's ruling, 2026-10-28). Ask it after |
| // the list is built, from the same Access, so a lease that lapsed while |
diff --git a/internal/docs/team_emission.go b/internal/docs/team_emission.go| index cf2e25f..bd4f87b 100644 |
| --- a/internal/docs/team_emission.go |
| +++ b/internal/docs/team_emission.go |
| @@ -34,7 +34,7 @@ func (a *requestAccess) checkResponse(ctx context.Context) error { |
| if a.responseStore == nil { |
| return errTeamUnavailable |
| } |
| - if len(a.responseDocs) == 0 && a.state() == roster.Unknown { |
| + if len(a.responseDocs) == 0 && a.state() == roster.Unknown && !a.partialNotice { |
| return errTeamUnavailable |
| } |
| for id, p := range a.responseDocs { |
diff --git a/internal/docs/team_router_test.go b/internal/docs/team_router_test.go| index 1ecfc49..855915f 100644 |
| --- a/internal/docs/team_router_test.go |
| +++ b/internal/docs/team_router_test.go |
| @@ -401,3 +401,44 @@ func TestTeamRouterHomeOnlyFirstEntryUnderUnknownIsRetryable(t *testing.T) { |
| t.Fatal("undecided first entry allocated a principal", e) |
| } |
| } |
| + |
| +// Under Unknown the list page is the partial list with the notice even when |
| +// it is empty: the empty state and the notice, not a 503 (Paul's ruling on |
| +// list pages, 2026-10-28). NotMember's empty list is complete, so it carries |
| +// no notice; item pages and the dashboard feed are unchanged. |
| +func TestTeamEmptyListUnderUnknownIsPartialNotUnavailable(t *testing.T) { |
| + f := newTeamRouterFixture(t) |
| + b := f.browser() |
| + b.localSignin(t, "bob@example.com") |
| + // Bob signed in locally with no Home link is a guest, and nothing is |
| + // shared with him: an empty list, complete, with no notice. |
| + if r := b.do("GET", "/", ""); r.Code != 200 || strings.Contains(r.Body.String(), `<p>docs.team.partial</p>`) || !strings.Contains(r.Body.String(), "docs.list.empty.title") { |
| + t.Fatal("guest's empty list", r.Code) |
| + } |
| + b.linkProof(t, teamSubject('b'), "bob@example.com") |
| + routerRedirect(t, b.do("POST", "/account/home/confirm", ""), connectedURL("/")) |
| + if r := b.do("GET", "/", ""); r.Code != 200 || !strings.Contains(r.Body.String(), "Bob private") { |
| + t.Fatal("member list", r.Code) |
| + } |
| + f.directory.change(nil, true) |
| + f.clock.step(61 * time.Second) |
| + for _, path := range []string{"/", "/?q=Bob"} { |
| + r := b.do("GET", path, "") |
| + body := r.Body.String() |
| + if r.Code != 200 || !strings.Contains(body, `<p>docs.team.partial</p>`) || strings.Contains(body, "Bob private") || strings.Contains(body, "Bob shared") { |
| + t.Fatal("empty list under Unknown was not partial", path, r.Code) |
| + } |
| + } |
| + if r := b.do("GET", "/", ""); !strings.Contains(r.Body.String(), "docs.list.empty.title") { |
| + t.Fatal("empty partial list lost its empty state") |
| + } |
| + if r := b.do("GET", "/d/"+f.hidden.Sqid, ""); r.Code != 503 { |
| + t.Fatal("own item under Unknown was not a retryable 503", r.Code) |
| + } |
| + // The native list renders no notice, so it is still unavailable. |
| + native := b.request("GET", "/", "") |
| + native.Header.Set("Accept", "application/json") |
| + if r := b.serve(native); r.Code != 503 { |
| + t.Fatal("native list under Unknown was not unavailable", r.Code) |
| + } |
| +} |