fix(drive): use AppForTest now that requireSession fails closed
The drive built the app with App() and relied on the nil-auth pass-through that no longer exists, so every page 500'd. Also drops the dead NewStore/base64 lines the review pointed at.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiWVaR69Vb2Lzc9wgfit1v
1 file changed,
+5
−9
tools/drive/main.go+5 −9
diff --git a/tools/drive/main.go b/tools/drive/main.go| index 4be5916..8c1461c 100644 |
| --- a/tools/drive/main.go |
| +++ b/tools/drive/main.go |
| @@ -9,15 +9,14 @@ |
| // at all with a mouse — and its tools/drive is the committed version of |
| // the same recipe. |
| // |
| -// It builds the app with auth left nil, which makes requireSession a |
| -// pass-through (see app.go). That is a test seam, not a product one: |
| -// cmd/memoria refuses to start without sign-in configured, and |
| -// TestConfigRefusesIncompleteEnvironment holds it to that. |
| +// It builds the app through memoria.AppForTest, which sets an explicit |
| +// unauthenticated flag. requireSession itself fails closed — an earlier |
| +// version fell through on nil auth and a code review showed the test that |
| +// was supposed to make that safe did not exist. |
| package main |
| import ( |
| "context" |
| - "encoding/base64" |
| "flag" |
| "fmt" |
| "log/slog" |
| @@ -54,17 +53,14 @@ func main() { |
| if err != nil { |
| panic(err) |
| } |
| - _ = base64.StdEncoding |
| - mux, _, err := memoria.App(d, "http://"+*addr, sealer, logger) |
| + mux, _, err := memoria.AppForTest(d, "http://"+*addr, sealer, logger) |
| if err != nil { |
| panic(err) |
| } |
| // Seed enough to make every surface non-empty: results, a heading |
| // trail, a highlight, a document list with more than one row. |
| - store := memoria.NewStore(d, sealer, nil) |
| - _ = store |
| seedViaHTTP(mux, *addr) |
| fmt.Printf("drive serving on http://%s (no sign-in)\n", *addr) |