pico

created pr with pico/141.1 on 2026-09-26T01:18:41Z · by c8ef7d19
added pico/141.2 on 2026-09-26T01:40:03Z · by c8ef7d19
1: 2845ffb = 1: 2845ffb refactor: invite system for pgs and prose
-: ------- > 2: ee606d0 chore(prose): require plus or prose feature flag in order to upload
added pico/141.3 on 2026-09-26T14:41:34Z · by c8ef7d19
1: 2845ffb = 1: 2845ffb refactor: invite system for pgs and prose
2: ee606d0 = 2: ee606d0 chore(prose): require plus or prose feature flag in order to upload
-: ------- > 3: e14a99e refactor: remove unnecessary tests
added pico/141.4 on 2026-09-26T14:42:29Z · by c8ef7d19
1: 2845ffb = 1: 2845ffb refactor: invite system for pgs and prose
2: ee606d0 < -: ------- chore(prose): require plus or prose feature flag in order to upload
3: e14a99e ! 2: 7fb4f8f chore(prose): require plus or prose feature flag in order to upload
added pico/141.5 on 2026-09-26T15:11:30Z · by c8ef7d19
1: 2845ffb = 1: 2845ffb refactor: invite system for pgs and prose
2: 7fb4f8f ! 2: e469694 chore(prose): require plus or prose feature flag in order to upload
added pico/141.6 on 2026-10-01T13:39:16Z · by c8ef7d19
1: 2845ffb ! 1: 1e9cddc style(prose): minimal design ethos
2: e469694 ! 2: 0967882 chore(prose): remove with_styles and layout front-matter fields
cmds
checkout latest patchset:
ssh pr.pico.sh pull pico:141 | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull pico:141 [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pico:141
add comment to patch request:
ssh pr.pico.sh comment pico:141 "lgtm!"
+0 -117 pkg/apps/prose/uploader_test.go #
......@@ -40,123 +40,6 @@ func (m *mockFeatureDB) setFeature(userID string, ff *db.FeatureFlag) {
4040 m.features[key] = ff
4141 }
4242
43-func TestFindFeatureFlag(t *testing.T) {
44- cfg := NewConfigSite("prose-test")
45- validExpires := time.Now().Add(24 * time.Hour)
46- expiredExpires := time.Now().Add(-24 * time.Hour)
47- userID := "user-1"
48-
49- t.Run("plus valid returns plus", func(t *testing.T) {
50- mockDB := newMockFeatureDB()
51- plusFF := db.NewFeatureFlag(userID, "plus", uint64(50*shared.MB), int64(5*shared.MB), int64(2*shared.KB))
52- plusFF.ExpiresAt = &validExpires
53- mockDB.setFeature(userID, plusFF)
54-
55- ff, err := findFeatureFlag(mockDB, cfg, userID)
56- if err != nil {
57- t.Fatalf("unexpected error: %v", err)
58- }
59- if ff.Name != "plus" {
60- t.Errorf("expected plus, got %s", ff.Name)
61- }
62- })
63-
64- t.Run("prose valid returns prose when no plus", func(t *testing.T) {
65- mockDB := newMockFeatureDB()
66- proseFF := db.NewFeatureFlag(userID, "prose", uint64(50*shared.MB), int64(5*shared.MB), int64(2*shared.KB))
67- proseFF.ExpiresAt = &validExpires
68- mockDB.setFeature(userID, proseFF)
69-
70- ff, err := findFeatureFlag(mockDB, cfg, userID)
71- if err != nil {
72- t.Fatalf("unexpected error: %v", err)
73- }
74- if ff.Name != "prose" {
75- t.Errorf("expected prose, got %s", ff.Name)
76- }
77- })
78-
79- t.Run("plus valid takes precedence when both plus and prose exist", func(t *testing.T) {
80- mockDB := newMockFeatureDB()
81- plusFF := db.NewFeatureFlag(userID, "plus", uint64(50*shared.MB), int64(5*shared.MB), int64(2*shared.KB))
82- plusFF.ExpiresAt = &validExpires
83- mockDB.setFeature(userID, plusFF)
84-
85- proseFF := db.NewFeatureFlag(userID, "prose", uint64(50*shared.MB), int64(5*shared.MB), int64(2*shared.KB))
86- proseFF.ExpiresAt = &validExpires
87- mockDB.setFeature(userID, proseFF)
88-
89- ff, err := findFeatureFlag(mockDB, cfg, userID)
90- if err != nil {
91- t.Fatalf("unexpected error: %v", err)
92- }
93- if ff.Name != "plus" {
94- t.Errorf("expected plus, got %s", ff.Name)
95- }
96- })
97-
98- t.Run("plus expired falls back to prose if prose is valid", func(t *testing.T) {
99- mockDB := newMockFeatureDB()
100- plusFF := db.NewFeatureFlag(userID, "plus", uint64(50*shared.MB), int64(5*shared.MB), int64(2*shared.KB))
101- plusFF.ExpiresAt = &expiredExpires
102- mockDB.setFeature(userID, plusFF)
103-
104- proseFF := db.NewFeatureFlag(userID, "prose", uint64(50*shared.MB), int64(5*shared.MB), int64(2*shared.KB))
105- proseFF.ExpiresAt = &validExpires
106- mockDB.setFeature(userID, proseFF)
107-
108- ff, err := findFeatureFlag(mockDB, cfg, userID)
109- if err != nil {
110- t.Fatalf("unexpected error: %v", err)
111- }
112- if ff.Name != "prose" {
113- t.Errorf("expected prose, got %s", ff.Name)
114- }
115- })
116-
117- t.Run("plus expired and no prose returns expired error", func(t *testing.T) {
118- mockDB := newMockFeatureDB()
119- plusFF := db.NewFeatureFlag(userID, "plus", uint64(50*shared.MB), int64(5*shared.MB), int64(2*shared.KB))
120- plusFF.ExpiresAt = &expiredExpires
121- mockDB.setFeature(userID, plusFF)
122-
123- _, err := findFeatureFlag(mockDB, cfg, userID)
124- if err == nil {
125- t.Fatalf("expected error, got nil")
126- }
127- if err.Error() != "ERROR: your pico+ has expired" {
128- t.Errorf("unexpected error message: %v", err)
129- }
130- })
131-
132- t.Run("prose expired and no plus returns expired error", func(t *testing.T) {
133- mockDB := newMockFeatureDB()
134- proseFF := db.NewFeatureFlag(userID, "prose", uint64(50*shared.MB), int64(5*shared.MB), int64(2*shared.KB))
135- proseFF.ExpiresAt = &expiredExpires
136- mockDB.setFeature(userID, proseFF)
137-
138- _, err := findFeatureFlag(mockDB, cfg, userID)
139- if err == nil {
140- t.Fatalf("expected error, got nil")
141- }
142- if err.Error() != "ERROR: your prose access has expired" {
143- t.Errorf("unexpected error message: %v", err)
144- }
145- })
146-
147- t.Run("no flags returns required message", func(t *testing.T) {
148- mockDB := newMockFeatureDB()
149-
150- _, err := findFeatureFlag(mockDB, cfg, userID)
151- if err == nil {
152- t.Fatalf("expected error, got nil")
153- }
154- if err.Error() != "ERROR: uploading to prose requires the prose feature flag or pico+" {
155- t.Errorf("unexpected error message: %v", err)
156- }
157- })
158-}
159-
16043 func TestUploadHandlerValidate(t *testing.T) {
16144 cfg := NewConfigSite("prose-test")
16245 validExpires := time.Now().Add(24 * time.Hour)
Back to top