oneie 3.6.26 → 3.6.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.claude/agents/TROUBLESHOOTING.md +530 -0
  2. package/.claude/agents/agent-claude.md +645 -0
  3. package/.claude/agents/agent-clone.md +2 -0
  4. package/.claude/agents/agent-frontend.md +162 -21
  5. package/.claude/agents/agent-writer.md +722 -0
  6. package/.claude/commands/chat.md +504 -0
  7. package/.claude/commands/create.md +134 -18
  8. package/.claude/commands/fast.md +531 -0
  9. package/.claude/commands/one.md +79 -90
  10. package/.claude/commands/optimize.md +74 -0
  11. package/.claude/commands/plan.md +420 -373
  12. package/.claude/commands/review.md +99 -0
  13. package/.claude/commands/server.md +97 -48
  14. package/.claude/commands/start.md +182 -0
  15. package/.claude/commands/test.md +197 -0
  16. package/.claude/commands/validate.md +140 -0
  17. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  18. package/.claude/hooks/auto-format.sh +106 -0
  19. package/.claude/hooks/formatting.py +187 -0
  20. package/.claude/hooks/ontology-validation.py +255 -0
  21. package/.claude/hooks/validate-imports.py +182 -0
  22. package/.claude/hooks/validate-ontology.py +140 -0
  23. package/.claude/hooks/write-news.sh +194 -0
  24. package/CLAUDE.md +150 -1057
  25. package/one/knowledge/cascading-context-specification.md +1617 -0
  26. package/one/knowledge/claude-code-integration.md +1293 -0
  27. package/one/knowledge/development-commands.md +251 -0
  28. package/one/knowledge/guidelines.md +314 -0
  29. package/one/knowledge/parallel-agents.md +932 -0
  30. package/one/knowledge/performance.md +459 -0
  31. package/one/knowledge/troubleshooting.md +434 -0
  32. package/one/things/plans/dsl-claude-code.md +1011 -0
  33. package/one/things/plans/video-backend.md +638 -0
  34. package/one/things/plans/video-frontend.md +432 -0
  35. package/one/things/plans/video-old-archived.md +656 -0
  36. package/package.json +1 -1
  37. package/.claude/agents/AUDIT-agent-ops-alignment.md +0 -379
@@ -0,0 +1,434 @@
1
+ ---
2
+ title: Common Issues and Solutions
3
+ dimension: knowledge
4
+ category: troubleshooting
5
+ tags: debugging, errors, solutions, fixes
6
+ related_dimensions: all
7
+ scope: global
8
+ created: 2025-11-08
9
+ version: 1.0.0
10
+ ai_context: |
11
+ Comprehensive troubleshooting guide for common issues in ONE platform
12
+ development, with solutions and preventive measures.
13
+ ---
14
+
15
+ # Common Issues and Solutions
16
+
17
+ **Quick fixes for frequent development problems.**
18
+
19
+ ---
20
+
21
+ ## TypeScript Errors
22
+
23
+ ### Issue: TypeScript errors after schema changes
24
+
25
+ **Symptoms:**
26
+ - Type errors in Convex queries/mutations
27
+ - `_generated` types out of sync
28
+ - Import errors from `@/convex/_generated/api`
29
+
30
+ **Solution:**
31
+ ```bash
32
+ # Regenerate Convex types
33
+ cd backend && npx convex dev
34
+
35
+ # Check frontend types
36
+ cd web && bunx astro check
37
+ ```
38
+
39
+ **Prevention:**
40
+ - Always run `npx convex dev` after schema changes
41
+ - Wait for type generation to complete before coding
42
+ - Use TypeScript strict mode to catch issues early
43
+
44
+ ---
45
+
46
+ ## Authentication Issues
47
+
48
+ ### Issue: Auth not working
49
+
50
+ **Symptoms:**
51
+ - Login fails silently
52
+ - Session not persisting
53
+ - `getUserIdentity()` returns null
54
+
55
+ **Solution:**
56
+ ```bash
57
+ # 1. Check BETTER_AUTH_SECRET matches
58
+ # Compare web/.env.local and backend/.env.local
59
+ grep BETTER_AUTH_SECRET web/.env.local
60
+ grep BETTER_AUTH_SECRET backend/.env.local
61
+
62
+ # 2. Verify Convex deployment URL
63
+ grep PUBLIC_CONVEX_URL web/.env.local
64
+
65
+ # 3. Check auth configuration
66
+ cat backend/convex/auth.ts
67
+ ```
68
+
69
+ **Common Causes:**
70
+ - `BETTER_AUTH_SECRET` mismatch between frontend and backend
71
+ - Wrong `PUBLIC_CONVEX_URL` in frontend
72
+ - Missing OAuth credentials
73
+ - Rate limiting triggered (check `@convex-dev/rate-limiter` logs)
74
+
75
+ **Prevention:**
76
+ - Use same `.env.local` template for web and backend
77
+ - Generate `BETTER_AUTH_SECRET` once and share it
78
+ - Test auth flow after any environment variable changes
79
+
80
+ ---
81
+
82
+ ## Hydration Issues
83
+
84
+ ### Issue: Hydration mismatch
85
+
86
+ **Symptoms:**
87
+ - Console error: "Hydration failed"
88
+ - Component renders differently on server vs client
89
+ - Flash of unstyled content (FOUC)
90
+
91
+ **Solution:**
92
+ ```astro
93
+ <!-- Add client:load directive to interactive components -->
94
+ <ShoppingCart client:load />
95
+
96
+ <!-- Or use client:only for client-only components -->
97
+ <ClientOnlyWidget client:only="react" />
98
+ ```
99
+
100
+ **Common Causes:**
101
+ - Using browser APIs (localStorage, window) in SSR
102
+ - Date/time rendering (server timezone ≠ client timezone)
103
+ - Random values generated on server and client
104
+
105
+ **Prevention:**
106
+ ```typescript
107
+ // Use client-only rendering for browser APIs
108
+ import { useEffect, useState } from 'react';
109
+
110
+ function BrowserComponent() {
111
+ const [mounted, setMounted] = useState(false);
112
+
113
+ useEffect(() => {
114
+ setMounted(true);
115
+ }, []);
116
+
117
+ if (!mounted) return null;
118
+
119
+ // Safe to use browser APIs here
120
+ return <div>{localStorage.getItem('key')}</div>;
121
+ }
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Tailwind Styling Issues
127
+
128
+ ### Issue: Tailwind styles not applying
129
+
130
+ **Symptoms:**
131
+ - Colors not rendering
132
+ - Custom theme variables not working
133
+ - Dark mode not switching
134
+
135
+ **Solution:**
136
+ ```css
137
+ /* Ensure HSL format with hsl() wrapper */
138
+ @theme {
139
+ --color-background: 0 0% 100%; /* HSL format */
140
+ }
141
+
142
+ .my-component {
143
+ background-color: hsl(var(--color-background)); /* hsl() wrapper */
144
+ }
145
+ ```
146
+
147
+ **Common Causes:**
148
+ - Using OKLCH format instead of HSL
149
+ - Missing `hsl()` wrapper around CSS variables
150
+ - Using `@apply` directive (not supported in Tailwind v4)
151
+ - Missing `@source` directive for component files
152
+
153
+ **Prevention:**
154
+ - Always use HSL format: `H S% L%`
155
+ - Always wrap with `hsl()`: `hsl(var(--color-name))`
156
+ - Never use `@apply` in Tailwind v4
157
+ - Add `@source` directive to scan all component files
158
+
159
+ ---
160
+
161
+ ## Build Issues
162
+
163
+ ### Issue: Build fails on Cloudflare
164
+
165
+ **Symptoms:**
166
+ - `react-dom/server` module not found
167
+ - Edge runtime errors
168
+ - SSR errors in production
169
+
170
+ **Solution:**
171
+ ```javascript
172
+ // astro.config.mjs
173
+ export default defineConfig({
174
+ vite: {
175
+ resolve: {
176
+ alias: {
177
+ 'react-dom/server': 'react-dom/server.edge'
178
+ }
179
+ }
180
+ }
181
+ });
182
+ ```
183
+
184
+ **Common Causes:**
185
+ - Missing `react-dom/server.edge` alias
186
+ - Using Node.js-specific APIs in edge runtime
187
+ - Missing environment variables in Cloudflare Pages
188
+
189
+ **Prevention:**
190
+ - Use `react-dom/server.edge` for Cloudflare compatibility
191
+ - Test builds locally: `bun run build`
192
+ - Verify environment variables in Cloudflare dashboard
193
+
194
+ ---
195
+
196
+ ## Convex Issues
197
+
198
+ ### Issue: Query not updating in real-time
199
+
200
+ **Symptoms:**
201
+ - `useQuery` returns stale data
202
+ - Changes in database not reflected in UI
203
+ - Real-time subscriptions not working
204
+
205
+ **Solution:**
206
+ ```typescript
207
+ // Ensure using useQuery (not ConvexHttpClient)
208
+ import { useQuery } from "convex/react";
209
+ import { api } from "@/convex/_generated/api";
210
+
211
+ function MyComponent() {
212
+ // CORRECT: Real-time subscription
213
+ const data = useQuery(api.queries.things.list, { groupId });
214
+
215
+ // WRONG: Static fetch (no real-time updates)
216
+ // const data = await client.query(api.queries.things.list, { groupId });
217
+ }
218
+ ```
219
+
220
+ **Common Causes:**
221
+ - Using `ConvexHttpClient` instead of `useQuery` hook
222
+ - Component not wrapped in `ConvexProvider`
223
+ - Query invalidation not triggered
224
+ - Index not defined for query pattern
225
+
226
+ **Prevention:**
227
+ - Always use `useQuery` for real-time data
228
+ - Wrap app in `ConvexProvider`
229
+ - Define indexes for all query patterns
230
+ - Test real-time updates during development
231
+
232
+ ---
233
+
234
+ ## Content Collections Issues
235
+
236
+ ### Issue: Content not found or types missing
237
+
238
+ **Symptoms:**
239
+ - `getCollection()` returns empty array
240
+ - Type errors on `post.data` fields
241
+ - Content not appearing on pages
242
+
243
+ **Solution:**
244
+ ```bash
245
+ # Regenerate content types
246
+ bunx astro sync
247
+
248
+ # Check content directory structure
249
+ ls -la src/content/blog/
250
+
251
+ # Verify schema matches content
252
+ cat src/content/config.ts
253
+ ```
254
+
255
+ **Common Causes:**
256
+ - Missing `bunx astro sync` after content changes
257
+ - Schema doesn't match content frontmatter
258
+ - Content files in wrong directory
259
+ - Invalid YAML frontmatter
260
+
261
+ **Prevention:**
262
+ - Run `bunx astro sync` after adding/changing content
263
+ - Validate frontmatter matches schema
264
+ - Use TypeScript types: `CollectionEntry<"blog">`
265
+ - Test content rendering locally before deploying
266
+
267
+ ---
268
+
269
+ ## Multi-Tenancy Issues
270
+
271
+ ### Issue: Cross-tenant data leaks
272
+
273
+ **Symptoms:**
274
+ - User sees data from other groups
275
+ - Queries return data from wrong groupId
276
+ - Security audit fails
277
+
278
+ **Solution:**
279
+ ```typescript
280
+ // ALWAYS validate group access
281
+ const group = await ctx.db.get(args.groupId);
282
+ if (!group || group.status !== "active") {
283
+ throw new Error("Invalid group");
284
+ }
285
+
286
+ // ALWAYS scope queries by groupId
287
+ const things = await ctx.db
288
+ .query("things")
289
+ .withIndex("group_type", q =>
290
+ q.eq("groupId", args.groupId).eq("type", args.type)
291
+ )
292
+ .collect();
293
+ ```
294
+
295
+ **Common Causes:**
296
+ - Missing groupId validation
297
+ - Query without groupId scope
298
+ - Using wrong groupId from session
299
+ - Hierarchical access not implemented correctly
300
+
301
+ **Prevention:**
302
+ - NEVER query without groupId scope
303
+ - Validate group exists and is active
304
+ - Test with multiple groups during development
305
+ - Add integration tests for multi-tenancy
306
+
307
+ ---
308
+
309
+ ## Performance Issues
310
+
311
+ ### Issue: Slow page loads or high JS bundle size
312
+
313
+ **Symptoms:**
314
+ - Lighthouse score < 90
315
+ - Large JavaScript bundles (> 200KB)
316
+ - Slow Time to Interactive (TTI)
317
+
318
+ **Solution:**
319
+ ```astro
320
+ <!-- Use appropriate client directives -->
321
+ <HeavyComponent client:visible /> <!-- Load when visible -->
322
+ <SearchBox client:idle /> <!-- Load when idle -->
323
+ <CriticalComponent client:load /> <!-- Load immediately -->
324
+
325
+ <!-- Dynamic imports for heavy components -->
326
+ <script>
327
+ const HeavyChart = lazy(() => import('./HeavyChart'));
328
+ </script>
329
+ ```
330
+
331
+ **Common Causes:**
332
+ - Overuse of `client:load` directive
333
+ - No code splitting
334
+ - Heavy libraries in client bundle
335
+ - No lazy loading for images/components
336
+
337
+ **Prevention:**
338
+ - Default to static HTML (no client directive)
339
+ - Use `client:idle` or `client:visible` for non-critical components
340
+ - Dynamic import heavy libraries
341
+ - Lazy load images with `loading="lazy"`
342
+
343
+ ---
344
+
345
+ ## Deployment Issues
346
+
347
+ ### Issue: Environment variables not working in production
348
+
349
+ **Symptoms:**
350
+ - `process.env.VAR_NAME` is undefined
351
+ - API calls fail with auth errors
352
+ - Database connection fails
353
+
354
+ **Solution:**
355
+ ```bash
356
+ # 1. Check Cloudflare Pages environment variables
357
+ wrangler pages deployment list --project-name=web
358
+
359
+ # 2. Add variables in Cloudflare dashboard
360
+ # Settings → Environment Variables
361
+
362
+ # 3. Ensure PUBLIC_ prefix for client-side vars
363
+ PUBLIC_CONVEX_URL=https://...
364
+ BETTER_AUTH_SECRET=... # Server-side only
365
+ ```
366
+
367
+ **Common Causes:**
368
+ - Missing environment variables in Cloudflare dashboard
369
+ - Forgetting `PUBLIC_` prefix for client-side variables
370
+ - Wrong deployment environment (preview vs production)
371
+ - Environment variables not synced after changes
372
+
373
+ **Prevention:**
374
+ - Use `PUBLIC_` prefix for client-accessible variables
375
+ - Add all variables to Cloudflare dashboard
376
+ - Test in preview deployment before production
377
+ - Document all required environment variables
378
+
379
+ ---
380
+
381
+ ## Git Issues
382
+
383
+ ### Issue: Merge conflicts in generated files
384
+
385
+ **Symptoms:**
386
+ - Conflicts in `_generated/` directory
387
+ - Conflicts in `package-lock.json` or `bun.lockb`
388
+ - Conflicts in `.astro/` cache
389
+
390
+ **Solution:**
391
+ ```bash
392
+ # For generated files, prefer theirs and regenerate
393
+ git checkout --theirs backend/convex/_generated/
394
+ cd backend && npx convex dev
395
+
396
+ # For lockfiles, regenerate
397
+ rm bun.lockb
398
+ bun install
399
+
400
+ # For cache, delete and rebuild
401
+ rm -rf .astro/
402
+ bunx astro sync
403
+ ```
404
+
405
+ **Prevention:**
406
+ - Add `_generated/` to `.gitignore` (already done)
407
+ - Commit lockfiles carefully
408
+ - Clear cache before merging: `rm -rf .astro/`
409
+
410
+ ---
411
+
412
+ ## Quick Diagnostic Commands
413
+
414
+ ```bash
415
+ # Check all types
416
+ bunx astro check && cd backend && npx convex dev
417
+
418
+ # View backend logs
419
+ cd backend && npx convex logs --history 50
420
+
421
+ # Test auth flow
422
+ cd web && bun test test/auth/
423
+
424
+ # Check environment
425
+ env | grep CONVEX
426
+ env | grep BETTER_AUTH
427
+
428
+ # Verify build
429
+ cd web && bun run build
430
+ ```
431
+
432
+ ---
433
+
434
+ **When in doubt, regenerate types, clear cache, and rebuild.**