-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area/frontendThis is frontend onlyThis is frontend only
Description
Summary
Severity: 🟠 HIGH
Component: Frontend Browser Preview Mocks
Category: Misleading UI State
Problem
Browser mock functions return hardcoded true for tool availability checks, making the UI claim features are available when they're not in browser preview mode.
Affected Files & Fixes
1. Workspace Mock - Fake Worktree Data
File: apps/frontend/src/renderer/lib/mocks/workspace-mock.ts:6-18
Current (WRONG):
getWorktreeStatus: async () => ({
success: true,
data: {
exists: true, // ❌ HARDCODED
worktreePath: '/Users/demo/projects/sample-project/.worktrees/003-fix-bug', // ❌ FAKE
branch: 'auto-claude/fix-pagination-bug',
commitCount: 3,
filesChanged: 5
}
}),Should be:
getWorktreeStatus: async () => ({
success: true,
data: {
exists: false, // ✓ Honest - no worktree in browser
worktreePath: null,
branch: null,
commitCount: 0,
filesChanged: 0
}
}),2. Infrastructure Mock - Ollama False Positive
File: apps/frontend/src/renderer/lib/mocks/infrastructure-mock.ts:68-85
Current (WRONG):
checkOllamaInstalled: async () => ({
success: true,
data: {
installed: true, // ❌ LYING TO UI
path: '/usr/local/bin/ollama',
version: '0.1.0',
}
}),
listOllamaModels: async () => ({
success: true,
data: {
models: [
{ name: 'llama2', size_gb: 3.73 }, // ❌ DEMO DATA
],
}
}),Should be:
checkOllamaInstalled: async () => ({
success: true,
data: {
installed: false, // ✓ Honest - not available in browser
path: null,
version: null,
}
}),
listOllamaModels: async () => ({
success: true,
data: {
models: [], // ✓ Empty list - no models in browser
count: 0
}
}),3. Global Window Pollution
File: apps/frontend/src/renderer/lib/mocks/infrastructure-mock.ts:176-189
Current (WRONG):
onDownloadProgress: (callback) => {
(window as any).__downloadProgressCallback = callback; // ❌ GLOBAL POLLUTION
return () => {
delete (window as any).__downloadProgressCallback;
};
},Should be:
// Use EventTarget or callback queue
const progressCallbacks = new Set<Function>();
onDownloadProgress: (callback) => {
progressCallbacks.add(callback);
return () => {
progressCallbacks.delete(callback);
};
},Impact
- ❌ UI shows tools as installed when they're not (confusing)
- ❌ Users might try to use features that don't work in browser preview
- ❌ Global object pollution can cause memory leaks or state bugs
- ❌ Developers testing browser preview get misleading feedback
Acceptance Criteria
- All
installed: truechanged toinstalled: false - All
exists: truechanged toexists: falsefor unavailable features - All fake paths/data replaced with null/empty
- Global window pollution removed
- UI correctly shows "Not available in browser preview" states
- Browser preview documentation updated
Testing
// Test browser preview mode
const status = await window.electronAPI.workspace.getWorktreeStatus();
expect(status.data.exists).toBe(false); // Should be false, not true
const ollama = await window.electronAPI.infrastructure.checkOllamaInstalled();
expect(ollama.data.installed).toBe(false); // Should be false, not truePriority
HIGH - Misleading UI state affects developer experience
References
- Mock Elimination Audit: Frontend HIGH findings Auto claude/add followup on done task #1-3
- Related:
apps/frontend/src/renderer/lib/browser-mock.ts(main mock system)
Metadata
Metadata
Assignees
Labels
area/frontendThis is frontend onlyThis is frontend only