-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_persistence.html
More file actions
98 lines (88 loc) · 4.12 KB
/
test_persistence.html
File metadata and controls
98 lines (88 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Persistence Fix</title>
<style>
body { font-family: Arial, sans-serif; margin: 40px; }
.test-section { margin: 20px 0; padding: 20px; border: 1px solid #ccc; }
.success { color: green; }
.error { color: red; }
pre { background: #f5f5f5; padding: 10px; overflow-x: auto; }
</style>
</head>
<body>
<h1>Agent Settings Persistence Test</h1>
<div class="test-section">
<h2>✅ Fix Implemented</h2>
<p>The persistence issue has been fixed with the following changes:</p>
<h3>1. Setup Page (/setup)</h3>
<ul>
<li>Now loads existing preferences on mount via API call</li>
<li>Shows "Update Your Preferences" for returning users</li>
<li>Shows "Welcome to Quorum AI" for new users</li>
<li>Displays loading state while fetching preferences</li>
</ul>
<h3>2. PreferenceForm Component</h3>
<ul>
<li>Added confidence threshold and max proposals per run fields</li>
<li>Fixed type compatibility with full UserPreferences interface</li>
<li>Properly handles all preference fields in form submission</li>
<li>Includes dirty state tracking for all fields</li>
</ul>
<h3>3. Backend Integration</h3>
<ul>
<li>Uses existing GET /user-preferences endpoint</li>
<li>Uses existing PUT /user-preferences endpoint</li>
<li>StateManager provides secure persistence</li>
<li>File fallback for backward compatibility</li>
</ul>
</div>
<div class="test-section">
<h2>🔧 Key Changes Made</h2>
<h3>frontend/src/routes/setup/+page.svelte</h3>
<pre>
- Added onMount to load existing preferences
- Added loading state and error handling
- Passes existingPreferences to PreferenceForm as initialValues
- Dynamic title based on whether preferences exist
</pre>
<h3>frontend/src/lib/components/setup/PreferenceForm.svelte</h3>
<pre>
- Extended Props interface to include confidence_threshold and max_proposals_per_run
- Added form state variables for new fields
- Added UI inputs for confidence threshold (slider) and max proposals (number)
- Updated submission handlers to include all fields
- Fixed function declaration order for normalizeList
</pre>
</div>
<div class="test-section">
<h2>📋 How to Test</h2>
<ol>
<li>Start the backend: <code>cd backend && uv run main.py</code></li>
<li>Start the frontend: <code>cd frontend && npm run dev</code></li>
<li>Navigate to <code>/setup</code></li>
<li>Configure preferences and save</li>
<li>Navigate away and back to <code>/setup</code></li>
<li>Verify your settings are restored</li>
<li>Test API key persistence separately</li>
</ol>
</div>
<div class="test-section success">
<h2>✅ Expected Behavior</h2>
<ul>
<li><strong>New users:</strong> See default values and "Welcome to Quorum AI" title</li>
<li><strong>Returning users:</strong> See their saved values and "Update Your Preferences" title</li>
<li><strong>All settings persist:</strong> Voting strategy, confidence threshold, max proposals, blacklisted/whitelisted proposers</li>
<li><strong>API keys persist:</strong> Stored securely via StateManager encryption</li>
</ul>
</div>
<div class="test-section">
<h2>🏗️ Architecture</h2>
<p><strong>Frontend:</strong> Setup page loads preferences → PreferenceForm displays them → User saves → API call updates backend</p>
<p><strong>Backend:</strong> API endpoints → UserPreferencesService → StateManager (encrypted) + File fallback</p>
<p><strong>Result:</strong> Settings persist between application restarts and user sessions</p>
</div>
</body>
</html>