Skip to content

Commit d82b3b7

Browse files
committed
chore: complete v3.1 Deck Discovery milestone
Archive milestone artifacts (roadmap, requirements, phase directories), evolve PROJECT.md with validated requirements and decisions, reorganize ROADMAP.md with collapsed milestone entry. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8ed2ece commit d82b3b7

37 files changed

Lines changed: 356 additions & 139 deletions

.planning/MILESTONES.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# Milestones: Lumio
22

3+
## v3.1 Deck Discovery (Shipped: 2026-03-16)
4+
5+
**Delivered:** End-to-end deck discovery pipeline — from deck.yaml metadata authoring in the deck builder, through Docora webhook indexing into a fulltext-searchable deck_index table, to a Discovery tab in the Android app where users search, browse by tag, and subscribe to shared decks with a single tap.
6+
7+
**Phases completed:** 41-44 (8 plans total)
8+
9+
**Key accomplishments:**
10+
11+
- deck_index table with weighted tsvector/GIN fulltext search (name > tags > description) and immutable wrapper function for generated column
12+
- search_decks RPC with prefix matching for search-as-you-type, tag filtering, and card_count computed at query time
13+
- Subfolder-aware study RPCs: transparent subfolder_path filtering on 7 JOINs across get_study_cards_for_session and get_due_card_count
14+
- docora-webhook deck.yaml detection, parsing (parseYaml wrapper), and idempotent deck_index upsert/delete
15+
- deck-commit commit_yaml action with server-enforced author, language validation, and lightweight YAML serialization
16+
- DeckMetadataForm in deck builder with collapsible UI, dirty tracking, YAML load/save, EN/IT i18n
17+
- Discovery tab (4th bottom tab, compass icon) with search-as-you-type, tag chip bar, optimistic subscribe/unsubscribe
18+
- Shared deck entries in Repos screen with display_name enrichment from deck_index
19+
20+
**Stats:**
21+
22+
- 52 files changed (+7,691 / -78 lines)
23+
- 4 phases, 8 plans, 17 tasks
24+
- 4 days (2026-03-13 to 2026-03-16)
25+
26+
**Git range:** `2cca21a``734b67d` (31 commits)
27+
28+
**What's next:** v3.2 TBD
29+
30+
---
31+
332
## v3.0 Deck Builder Web (Shipped: 2026-03-13)
433

534
**Delivered:** React SPA deck builder at deck.lumio.toto-castaldi.com where authenticated users create decks and flashcards in markdown, committed via edge function to a shared Git repo, synced by Docora for AI question generation.

.planning/PROJECT.md

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## What This Is
44

5-
Lumio è una piattaforma di studio basata su flashcard che sfrutta l'AI per trasformare concetti in sessioni di apprendimento interattive con ripetizione spaziata. Due frontend: app nativa Android (React Native/Expo) per lo studio e web app React SPA (deck.lumio.toto-castaldi.com) per la creazione di deck e carte. L'app Android è bilingue IT/EN con branding Lumio, ripetizione spaziata SM-2, sessioni configurabili con cap RPC, dashboard compatta 2x2, card browse, storico sessioni, gestione errori sync, autenticazione dual-mode (Google OAuth + email/password), account linking bidirezionale, e password reset via OTP. Il deck builder web permette di creare/modificare deck e carte in markdown con editor live preview, committate via edge function su un repo Git condiviso. Il contenuto viene dai repository Git, le domande sono pre-generate dal sistema. Docora sincronizza e genera domande AI per entrambi i flussi (repo utente e repo condiviso).
5+
Lumio è una piattaforma di studio basata su flashcard che sfrutta l'AI per trasformare concetti in sessioni di apprendimento interattive con ripetizione spaziata. Due frontend: app nativa Android (React Native/Expo) per lo studio e web app React SPA (deck.lumio.toto-castaldi.com) per la creazione di deck e carte. L'app Android è bilingue IT/EN con branding Lumio, ripetizione spaziata SM-2, sessioni configurabili con cap RPC, dashboard compatta 2x2, card browse, storico sessioni, gestione errori sync, autenticazione dual-mode (Google OAuth + email/password), account linking bidirezionale, password reset via OTP, e discovery di deck condivisi con ricerca fulltext e iscrizione. Il deck builder web permette di creare/modificare deck e carte in markdown con editor live preview e metadata (nome, descrizione, lingua, tag) salvati in deck.yaml, committate via edge function su un repo Git condiviso. Il contenuto viene dai repository Git, le domande sono pre-generate dal sistema. Docora sincronizza e genera domande AI per entrambi i flussi (repo utente e repo condiviso), e indicizza i metadata deck nel deck_index per la ricerca fulltext.
66

77
## Core Value
88

@@ -101,20 +101,20 @@ Gli utenti studiano concetti tramite quiz generati dall'AI — il contenuto vien
101101
- ✓ Edge function deck-commit con 8 azioni GitHub API e isolamento path utente — v3.0
102102
- ✓ Docora sync repo condiviso per generazione AI — v3.0
103103
- ✓ Deploy produzione deck.lumio.toto-castaldi.com con SSL e CI/CD — v3.0
104+
- ✓ deck_index table con fulltext search tsvector/GIN e ranking pesato (name > tags > description) — v3.1
105+
- ✓ search_decks RPC con prefix matching per search-as-you-type e filtro tag — v3.1
106+
- ✓ Iscrizione a sottocartella deck (subfolder_path su user_repositories) con studio filtrato — v3.1
107+
- ✓ lumio-decks repo piattaforma sempre disponibile per sync Docora — v3.1
108+
- ✓ docora-webhook indicizza deck.yaml in deck_index (upsert/delete) — v3.1
109+
- ✓ deck-commit commit_yaml action con autore server-enforced e serializzazione YAML — v3.1
110+
- ✓ DeckMetadataForm nel deck builder (nome, descrizione, lingua, tag) con caricamento/salvataggio YAML — v3.1
111+
- ✓ Discovery tab (4° tab, icona bussola) con ricerca fulltext, chip tag, subscribe/unsubscribe ottimistico — v3.1
112+
- ✓ Deck condivisi visibili nella schermata Repos con display_name arricchito da deck_index — v3.1
113+
- ✓ i18n completa Discovery IT/EN (17 chiavi per lingua) — v3.1
104114

105115
### Active
106116

107-
## Current Milestone: v3.1 Deck Discovery
108-
109-
**Goal:** Permettere agli utenti mobile di scoprire e aggiungere deck creati con il deck builder, tramite ricerca fulltext su metadata deck nel repo condiviso lumio-decks.
110-
111-
**Target features:**
112-
- Metadata a livello deck nel deck builder (nome, descrizione, categoria, tag) salvati in file deck.yaml
113-
- Indice deck in Supabase con fulltext search Postgres, popolato dal sync Docora di lumio-decks
114-
- Sincronizzazione lumio-decks a livello piattaforma (sempre presente)
115-
- Schermata discovery nell'app mobile con search bar fulltext su nome, categoria, tag, autore
116-
- Iscrizione utente a sottocartella specifica del repo condiviso (non intero repo)
117-
- Visualizzazione carte filtrate per deck scelto
117+
(None — planning next milestone)
118118

119119
**Future milestones:**
120120
- v3.2: TBD
@@ -155,18 +155,19 @@ Gli utenti studiano concetti tramite quiz generati dall'AI — il contenuto vien
155155

156156
## Context
157157

158-
**Stato attuale (post v3.0):**
158+
**Stato attuale (post v3.1):**
159159
- Monorepo pnpm: apps/android (Expo/React Native), apps/deck-builder (Vite/React SPA), apps/landing (static HTML), packages/core, packages/shared
160-
- Backend Supabase: auth (Google OAuth + email/password), DB, storage, edge functions (deck-commit con 8 azioni GitHub API), Docora webhook + study_sessions + card_review_schedule tables
160+
- Backend Supabase: auth (Google OAuth + email/password), DB, storage, edge functions (deck-commit con 9 azioni GitHub API + docora-webhook con deck.yaml indexing), Docora webhook + study_sessions + card_review_schedule + deck_index tables
161161
- Tech stack Android: Expo SDK 54, React Native 0.81, react-navigation, @lumio/core, i18n-js, react-native-marked, supermemo@2.0.23
162162
- Tech stack Deck Builder: Vite 7, React 19, react-router 7, Tailwind 4, @uiw/react-md-editor 4, vitest
163163
- CI/CD: lint-and-typecheck → build-apk → deploy-landing → deploy-deck-builder → deploy-migrations → deploy-functions
164164
- Versioning: STATE.md milestone → extract-version.cjs → version.ts, APK versionName, landing page, edge function
165165
- Auth condivisa: dual-mode Google OAuth + email/password, OTP verification, password reset, account linking bidirezionale
166-
- App Android bilingue IT/EN con branding Lumio, SM-2, sessioni configurabili, dashboard 2x2, card browse, study history, sync error handling
167-
- Deck builder web bilingue IT/EN con dark mode, deck CRUD, card authoring con markdown editor, live preview, toolbar
168-
- ~49,200 LOC (TS/TSX/CSS/SQL) — ~20,600 Android + ~28,600 deck-builder
169-
- 12 milestones shipped: v1.1 → v2.3 (mobile), v3.0 (deck builder web)
166+
- App Android bilingue IT/EN con branding Lumio, SM-2, sessioni configurabili, dashboard 2x2, card browse, study history, sync error handling, Discovery tab
167+
- Deck builder web bilingue IT/EN con dark mode, deck CRUD, card authoring con markdown editor, live preview, toolbar, metadata form (deck.yaml)
168+
- Discovery pipeline: deck.yaml → Docora webhook → deck_index (tsvector/GIN) → search_decks RPC → Discovery screen
169+
- ~56,900 LOC (TS/TSX/CSS/SQL) — ~28,300 Android + ~28,600 deck-builder
170+
- 13 milestones shipped: v1.1 → v3.1
170171

171172
## Constraints
172173

@@ -262,6 +263,20 @@ Gli utenti studiano concetti tramite quiz generati dall'AI — il contenuto vien
262263
| Responsive MDEditor: split desktop, toggle mobile | Optimal UX per viewport via matchMedia | ✓ Good — v3.0 |
263264
| HTTP-only Nginx template, Certbot adds SSL on server | SSL config is server-specific, not repo-portable | ✓ Good — v3.0 |
264265
| deploy-deck-builder parallels deploy-landing in CI | Independent apps, no build dependency between them | ✓ Good — v3.0 |
266+
| Immutable wrapper function for tsvector generated column | PostgreSQL requires IMMUTABLE for generated columns; to_tsvector is STABLE | ✓ Good — v3.1 |
267+
| 'simple' tsvector config (no stemming) | Multilingual deck names need exact token match, not language-specific stemming | ✓ Good — v3.1 |
268+
| subfolder_path on user_repositories (not separate table) | Simpler schema, reuses existing subscription model | ✓ Good — v3.1 |
269+
| COALESCE-based unique index for nullable subfolder_path | Broader compatibility than NULLS NOT DISTINCT, clearer semantics | ✓ Good — v3.1 |
270+
| websearch_to_tsquery replaced with prefix matching | Search-as-you-type requires partial word matching (:* suffix) | ✓ Good — v3.1 |
271+
| Card count computed at query time (not stored) | Avoids sync complexity between cards table and deck_index | ✓ Good — v3.1 |
272+
| Transparent subfolder filter via JOIN conditions | No RPC signature changes, backward compatible with NULL subfolder_path | ✓ Good — v3.1 |
273+
| parseYaml wrapper reusing parseFrontmatter | No new YAML library needed; existing parser handles deck.yaml structure | ✓ Good — v3.1 |
274+
| Server-enforced author from user profile | Client value always ignored; prevents impersonation | ✓ Good — v3.1 |
275+
| UPSERT for idempotent webhook delivery | Handles out-of-order Docora webhook events gracefully | ✓ Good — v3.1 |
276+
| Client-side join for user_repositories + deck_index | No FK relationship, PostgREST cannot embed | ✓ Good — v3.1 |
277+
| 409 conflict as success in subscribeToDeck | Idempotent double-tap handling without error UI | ✓ Good — v3.1 |
278+
| Optimistic UI with Set rollback for subscribe | Immediate visual feedback, revert on error | ✓ Good — v3.1 |
279+
| Collapsible metadata form (collapsed by default) | Non-intrusive for quick deck browsing, expand when needed | ✓ Good — v3.1 |
265280

266281
---
267-
*Last updated: 2026-03-13 after v3.1 milestone start*
282+
*Last updated: 2026-03-16 after v3.1 milestone*

.planning/ROADMAP.md

Lines changed: 14 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
-**v2.2 Session Limits** — Phases 32-33 (shipped 2026-03-05)
1515
-**v2.3 Dashboard Polish** — Phases 34-35 (shipped 2026-03-05)
1616
-**v3.0 Deck Builder Web** — Phases 36-40 (shipped 2026-03-13)
17-
- 🚧 **v3.1 Deck Discovery** — Phases 41-44 (in progress)
17+
- **v3.1 Deck Discovery** — Phases 41-44 (shipped 2026-03-16)
1818

1919
## Phases
2020

@@ -154,83 +154,19 @@ Full details: `.planning/milestones/v3.0-ROADMAP.md`
154154

155155
</details>
156156

157-
### v3.1 Deck Discovery (In Progress)
158-
159-
**Milestone Goal:** Permettere agli utenti mobile di scoprire e aggiungere deck creati con il deck builder, tramite ricerca fulltext su metadata deck nel repo condiviso lumio-decks.
160-
161-
- [x] **Phase 41: Database Foundation** - Schema, RPCs, RLS, and study pipeline updates for deck discovery and subfolder subscription (completed 2026-03-13)
162-
- [x] **Phase 42: Backend Pipeline** - Edge function enhancements for deck.yaml ingestion and commit support (completed 2026-03-13)
163-
- [x] **Phase 43: Deck Builder Metadata** - Metadata authoring UI for deck authors to publish discoverable decks (completed 2026-03-13)
164-
- [x] **Phase 44: Mobile Discovery** - Discovery tab with fulltext search, category browse, and deck subscription in the Android app (completed 2026-03-16)
165-
166-
## Phase Details
167-
168-
### Phase 41: Database Foundation
169-
**Goal**: Platform has a searchable deck index and subfolder-aware subscription model that integrates with existing study pipeline
170-
**Depends on**: Phase 40 (v3.0 shipped)
171-
**Requirements**: DBSR-01, DBSR-02, DBSR-03, DBSR-04, DBSR-05, STDY-01
172-
**Success Criteria** (what must be TRUE):
173-
1. A fulltext search query against deck_index returns ranked results weighted by name > tags > description
174-
2. A user can subscribe to a specific deck subfolder in the shared repo and the subscription is persisted in user_repositories with subfolder_path
175-
3. Study RPCs return only cards from the subscribed subfolder (not the entire shared repo) when subfolder_path is set
176-
4. The lumio-decks shared repo exists at platform level and is always available for Docora sync
177-
5. A user with zero subscriptions sees zero results from study RPCs for the shared repo (no data leakage)
178-
**Plans**: 2 plans
179-
180-
Plans:
181-
- [ ] 41-01-PLAN.md — Schema foundation: deck_index table with tsvector/GIN, subfolder_path on user_repositories, platform repo seed
182-
- [ ] 41-02-PLAN.md — RPCs: search_decks fulltext search function, study RPCs subfolder filtering
183-
184-
### Phase 42: Backend Pipeline
185-
**Goal**: Edge functions can ingest deck.yaml metadata into the deck index and authors can commit deck.yaml from the deck builder
186-
**Depends on**: Phase 41
187-
**Requirements**: PIPE-01, PIPE-02, PIPE-03
188-
**Success Criteria** (what must be TRUE):
189-
1. When Docora syncs a repo containing deck.yaml files, each deck's metadata appears in deck_index with correct name, description, category, tags, and author
190-
2. When a deck.yaml file is deleted from the repo, the corresponding deck_index row is removed
191-
3. The deck-commit edge function accepts a commit_yaml action that writes deck.yaml to the correct user path with validation
192-
**Plans**: 2 plans
193-
194-
Plans:
195-
- [ ] 42-01-PLAN.md — docora-webhook deck.yaml handling: parseYaml wrapper, upsert into deck_index on create/update, delete on removal
196-
- [ ] 42-02-PLAN.md — deck-commit commit_yaml action: metadata validation, server-enforced author, YAML serialization, GitHub commit
197-
198-
### Phase 43: Deck Builder Metadata
199-
**Goal**: Deck authors can describe their decks with structured metadata that flows into the discovery pipeline
200-
**Depends on**: Phase 42
201-
**Requirements**: DKBL-01, DKBL-02, DKBL-03
202-
**Success Criteria** (what must be TRUE):
203-
1. User can fill in deck display name, description, category (from predefined list), and tags via a form in the deck builder
204-
2. Saving metadata writes a deck.yaml file to the deck folder in the shared repo via deck-commit
205-
3. When selecting a deck that already has a deck.yaml, the metadata form loads with existing values
206-
**Plans**: 2 plans
207-
208-
Plans:
209-
- [ ] 43-01-PLAN.md — API layer: get_yaml server action, getDeckYaml/commitYaml client functions, unit tests
210-
- [ ] 43-02-PLAN.md — UI: DeckMetadataForm component, DeckDetailPanel integration, i18n keys (EN+IT)
211-
212-
### Phase 44: Mobile Discovery
213-
**Goal**: Mobile users can discover shared decks via search, browse by category, and subscribe to study them
214-
**Depends on**: Phase 43
215-
**Requirements**: DISC-01, DISC-02, DISC-03, DISC-04, DISC-05, DISC-06, DISC-07, DISC-08
216-
**Success Criteria** (what must be TRUE):
217-
1. A 4th bottom tab (compass icon) opens the Discovery screen with a search bar and category chip bar
218-
2. Typing in the search bar returns matching decks (debounced) showing name, description, card count, and author
219-
3. Tapping a category chip filters results to that category without typing
220-
4. User can subscribe to a deck with a single tap and the deck's cards appear in their next study session
221-
5. User can unsubscribe from a deck, removing its cards from future study sessions
222-
6. Empty states display contextual guidance (no decks available, no search results, all decks already subscribed)
223-
7. All discovery UI text is available in both IT and EN
224-
**Plans**: 2 plans
225-
226-
Plans:
227-
- [ ] 44-01-PLAN.md — Data layer: discovery functions in @lumio/core (searchDecks, subscribe, unsubscribe, subscriptions, flag emoji) + i18n strings (EN/IT)
228-
- [ ] 44-02-PLAN.md — Discovery UI: 4th tab in MainNavigator, DiscoveryScreen with search/tags/subscribe, DeckCard, TagChipBar, Repos screen shared deck entries
157+
<details>
158+
<summary>✅ v3.1 Deck Discovery (Phases 41-44) — SHIPPED 2026-03-16</summary>
229159

230-
## Progress
160+
- [x] Phase 41: Database Foundation (2 plans) — completed 2026-03-13
161+
- [x] Phase 42: Backend Pipeline (2 plans) — completed 2026-03-13
162+
- [x] Phase 43: Deck Builder Metadata (2 plans) — completed 2026-03-13
163+
- [x] Phase 44: Mobile Discovery (2 plans) — completed 2026-03-16
164+
165+
Full details: `.planning/milestones/v3.1-ROADMAP.md`
231166

232-
**Execution Order:**
233-
Phases execute in numeric order: 41 → 42 → 43 → 44
167+
</details>
168+
169+
## Progress
234170

235171
| Phase | Milestone | Plans Complete | Status | Completed |
236172
|-------|-----------|----------------|--------|-----------|
@@ -246,11 +182,8 @@ Phases execute in numeric order: 41 → 42 → 43 → 44
246182
| 32-33. Session Limits | v2.2 | 2/2 | Complete | 2026-03-05 |
247183
| 34-35. Dashboard Polish | v2.3 | 2/2 | Complete | 2026-03-05 |
248184
| 36-40. Deck Builder Web | v3.0 | 10/10 | Complete | 2026-03-13 |
249-
| 41. Database Foundation | 2/2 | Complete | 2026-03-13 | - |
250-
| 42. Backend Pipeline | 2/2 | Complete | 2026-03-13 | - |
251-
| 43. Deck Builder Metadata | 2/2 | Complete | 2026-03-13 | - |
252-
| 44. Mobile Discovery | 2/2 | Complete | 2026-03-16 | - |
185+
| 41-44. Deck Discovery | v3.1 | 8/8 | Complete | 2026-03-16 |
253186

254187
---
255188
*Roadmap created: 2026-01-29*
256-
*Last updated: 2026-03-15 -- Phase 44 plans created (2 plans)*
189+
*Last updated: 2026-03-16 -- v3.1 Deck Discovery shipped*

0 commit comments

Comments
 (0)