Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: address Copilot review — input guards, progress bar, save safety

Adam Eivy681a4a376d44
diff --git a/client/src/components/meatspace/post/PostDrillConfig.jsx b/client/src/components/meatspace/post/PostDrillConfig.jsx
index 9dab9aeef7..c242ac4e20 100644
--- a/client/src/components/meatspace/post/PostDrillConfig.jsx
+++ b/client/src/components/meatspace/post/PostDrillConfig.jsx
@@ -64,9 +64,12 @@ export default function PostDrillConfig({ config, onSaved, onBack }) {
}
function updateField(type, key, value) {
+ const coerced = value === '' || value === null || value === undefined
+ ? undefined
+ : Number(value);
setDrillTypes(prev => ({
...prev,
- [type]: { ...prev[type], [key]: Number(value) }
+ [type]: { ...prev[type], [key]: coerced }
}));
}
diff --git a/client/src/components/meatspace/post/PostDrillRunner.jsx b/client/src/components/meatspace/post/PostDrillRunner.jsx
index 901402d697..94e0bff259 100644
--- a/client/src/components/meatspace/post/PostDrillRunner.jsx
+++ b/client/src/components/meatspace/post/PostDrillRunner.jsx
@@ -79,7 +79,7 @@ export default function PostDrillRunner({ session }) {
const question = currentDrill.questions[currentQuestionIndex];
const timePct = timeLimitMs > 0 ? (timeLeft / timeLimitMs) * 100 : 0;
- const progressPct = totalQuestions > 0 ? ((currentQuestionIndex) / totalQuestions) * 100 : 0;
+ const progressPct = totalQuestions > 0 ? ((currentQuestionIndex + 1) / totalQuestions) * 100 : 0;
// Timer bar color
let timerColor = 'bg-port-accent';
diff --git a/client/src/components/meatspace/post/PostHistory.jsx b/client/src/components/meatspace/post/PostHistory.jsx
index 3617e89e50..eddc5882c3 100644
--- a/client/src/components/meatspace/post/PostHistory.jsx
+++ b/client/src/components/meatspace/post/PostHistory.jsx
@@ -34,7 +34,7 @@ export default function PostHistory({ onBack }) {
: undefined;
const [s, st] = await Promise.all([
getPostSessions(from),
- getPostStats(range || 365)
+ getPostStats(range)
]);
setSessions((s || []).slice().reverse());
setStats(st);
diff --git a/client/src/components/meatspace/post/PostSessionResults.jsx b/client/src/components/meatspace/post/PostSessionResults.jsx
index 941f52644f..4add1c9097 100644
--- a/client/src/components/meatspace/post/PostSessionResults.jsx
+++ b/client/src/components/meatspace/post/PostSessionResults.jsx
@@ -15,8 +15,8 @@ export default function PostSessionResults({ session, tags = {}, onSaved, onBack
sessionScore >= 50 ? 'text-port-warning' : 'text-port-error';
async function handleSave() {
- await saveSession(tags);
- onSaved();
+ const savedSession = await saveSession(tags);
+ if (savedSession) onSaved();
}
return (
diff --git a/client/src/components/meatspace/tabs/PostTab.jsx b/client/src/components/meatspace/tabs/PostTab.jsx
index 6e57c86ba3..d1854bc3fe 100644
--- a/client/src/components/meatspace/tabs/PostTab.jsx
+++ b/client/src/components/meatspace/tabs/PostTab.jsx
@@ -27,10 +27,10 @@ export default function PostTab() {
setRecentSessions(sessions);
}
- function handleStart(drillConfigs, tags) {
+ async function handleStart(drillConfigs, tags) {
setSessionTags(tags || {});
- session.startSession(drillConfigs);
- setView('running');
+ const started = await session.startSession(drillConfigs);
+ if (started) setView('running');
}
function handleDrillComplete() {
diff --git a/client/src/hooks/usePostSession.js b/client/src/hooks/usePostSession.js
index f61427a5fe..00c5540e49 100644
--- a/client/src/hooks/usePostSession.js
+++ b/client/src/hooks/usePostSession.js
@@ -48,6 +48,7 @@ export function usePostSession() {
questionStartRef.current = Date.now();
drillStartRef.current = Date.now();
setState(STATES.DRILLING);
+ return drill;
}, []);
const finishDrill = useCallback((finalAnswers) => {
diff --git a/server/routes/meatspace.js b/server/routes/meatspace.js
index 484649eedf..87656835ad 100644
--- a/server/routes/meatspace.js
+++ b/server/routes/meatspace.js
@@ -318,7 +318,8 @@ router.post('/post/sessions', asyncHandler(async (req, res) => {
* Rolling averages and trends
*/
router.get('/post/stats', asyncHandler(async (req, res) => {
- const days = req.query.days ? parseInt(req.query.days, 10) : 30;
+ const rawDays = req.query.days != null ? parseInt(req.query.days, 10) : 30;
+ const days = Number.isNaN(rawDays) ? 30 : rawDays > 0 ? Math.min(rawDays, 365) : 0;
const stats = await postService.getPostStats(days);
res.json(stats);
}));