feat(store): default auto_summarize ON for new users (ADR-018)
Migration 011 flips the auto_summarize column default to TRUE and brings existing rows (maintainer + current registrations) along. Onboarded friends now get zero-friction discovery: scheduled discovery (ADR-018) both discovers AND summarizes new videos, so a user's list fills and summarizes itself instead of presenting an empty list of manual Summarize buttons. Safe only because the process-wide caption-fetch rate gate (ADR-014 item 2, prior commit) now exists — auto + scheduled + multi-user would otherwise self-inflict 429s every cycle. The down migration reverts the default but intentionally leaves existing rows as-is (no surprise manual regression on rollback). RegisterUser already lets the column default drive the value, so no app change is needed; the account-page manual toggle still works. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -357,27 +357,28 @@ func TestSummarizeModeToggle(t *testing.T) {
|
||||
app := newApp(t)
|
||||
resetDB(t, rawPool(t))
|
||||
|
||||
// Account page defaults to manual.
|
||||
// Account page defaults to automatic (ADR-018: onboarded users get
|
||||
// zero-friction discovery — the list fills and summarizes itself).
|
||||
rec := do(t, app, httptest.NewRequest(http.MethodGet, "/account", nil))
|
||||
require.Equal(t, http.StatusOK, rec.Code)
|
||||
html := body(t, rec)
|
||||
require.Contains(t, html, "Manual", "default mode shown")
|
||||
require.Contains(t, html, "Switch to automatic")
|
||||
require.Contains(t, html, "Automatic", "default mode shown")
|
||||
require.Contains(t, html, "Switch to manual")
|
||||
|
||||
// Toggle to automatic via HTMX returns the refreshed control.
|
||||
// Toggle to manual via HTMX returns the refreshed control.
|
||||
req := httptest.NewRequest(http.MethodPost, "/account/summarize-mode",
|
||||
strings.NewReader("enabled=true"))
|
||||
strings.NewReader("enabled=false"))
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
req.Header.Set("HX-Request", "true")
|
||||
rec = do(t, app, req)
|
||||
require.Equal(t, http.StatusOK, rec.Code)
|
||||
html = body(t, rec)
|
||||
require.Contains(t, html, "Automatic")
|
||||
require.Contains(t, html, "Switch to manual")
|
||||
require.Contains(t, html, "Manual")
|
||||
require.Contains(t, html, "Switch to automatic")
|
||||
|
||||
got, err := app.Store.GetAutoSummarize(ctx, userID)
|
||||
require.NoError(t, err)
|
||||
require.True(t, got, "mode persisted")
|
||||
require.False(t, got, "mode persisted")
|
||||
}
|
||||
|
||||
func postSummarize(t *testing.T, app *web.App, videoID string, htmx bool) *httptest.ResponseRecorder {
|
||||
|
||||
Reference in New Issue
Block a user