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 taste progress header counting follow-ups as core questions

[._.]/ Adam Eivy9b3af7022cce
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index cfa9294dea..1069359024 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -35,6 +35,8 @@
## Fixed
+- **Digital Twin Taste questionnaire no longer shows "Question 5 of 3" after follow-ups.** The progress header used total response count (core + follow-ups) as the current question number against a core-only total, so once branching follow-ups fired the counter overran the "of N". It now reports the 1-based index among core questions for that section, so the label stays "Question 2 of 3" even when follow-ups sit between cores.
+
- **Accessibility: icon-only controls, keyboard-trapped elements, and unlabeled form fields across the app are now screen-reader and keyboard accessible.** An audit found ~65 icon-only buttons (modal/panel close `✕`, calendar prev/next, refresh, inline-edit save/cancel/edit/delete, reorder, delete, skip/back) with no accessible name, 15 `<div>`/`<span>` elements that were clickable by mouse only (no keyboard focus or Enter/Space activation), and several settings/config inputs missing a `<label>` association. Buttons gained descriptive `aria-label`s; clickable non-buttons now use a new shared helper `clickableProps()` (`client/src/lib/a11yKeyboard.js` — adds `role="button"`, `tabIndex`, and Enter/Space `onKeyDown`) so keyboard users can reach and activate them; and the form fields (external SD API URL, Python interpreter path, test-render prompt, per-row AI provider/model selects, image-gen seed) got proper `htmlFor`/`id` or `aria-label` associations. `IconPicker` also gained Escape-to-dismiss and an `aria-hidden` backdrop. The shared shells (Layout, Modal, Drawer, ⌘K, Logo, MediaImage) were already accessible and unchanged.
- **Sidebar nav no longer truncates long link names.** App names (and other child labels) under Apps and the rest of the sidebar used `truncate` in a 224px rail, so names like `barnhub.online` or `IdeatorPro…` collapsed to ellipsis with no way to read them. Labels now wrap with `break-words`, always expose the full name via `title`, the pin control is overlaid so it no longer steals label width, and the expanded sidebar is slightly wider (`w-64`).
diff --git a/server/services/taste-questionnaire.js b/server/services/taste-questionnaire.js
index c52cf6ee51..eaf9764f36 100644
--- a/server/services/taste-questionnaire.js
+++ b/server/services/taste-questionnaire.js
@@ -472,6 +472,20 @@ export async function getTasteProfile() {
};
}
+/**
+ * Build progress for a taste question.
+ * `current` is the 1-based index among *core* questions (not total responses),
+ * so the UI can show "Question 2 of 3" even after follow-ups inflate the response list.
+ */
+function buildQuestionProgress(config, sectionData, coreQuestion) {
+ const coreIndex = config.questions.findIndex(cq => cq.id === coreQuestion.id);
+ return {
+ current: coreIndex >= 0 ? coreIndex + 1 : sectionData.responses.length + 1,
+ coreTotal: config.questions.length,
+ totalAnswered: sectionData.responses.length
+ };
+}
+
/**
* Get the next question for a section.
* Returns core questions first, then triggered follow-ups based on previous answers.
@@ -494,11 +508,7 @@ export async function getNextQuestion(sectionId) {
text: q.text,
type: q.type,
isFollowUp: false,
- progress: {
- current: sectionData.responses.length + 1,
- coreTotal: config.questions.length,
- totalAnswered: sectionData.responses.length
- }
+ progress: buildQuestionProgress(config, sectionData, q)
};
}
@@ -518,11 +528,7 @@ export async function getNextQuestion(sectionId) {
type: 'text',
isFollowUp: true,
triggeredBy: q.id,
- progress: {
- current: sectionData.responses.length + 1,
- coreTotal: config.questions.length,
- totalAnswered: sectionData.responses.length
- }
+ progress: buildQuestionProgress(config, sectionData, q)
};
}
}
diff --git a/server/services/taste-questionnaire.test.js b/server/services/taste-questionnaire.test.js
new file mode 100644
index 0000000000..437c47c0fd
--- /dev/null
+++ b/server/services/taste-questionnaire.test.js
@@ -0,0 +1,104 @@
+import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';
+import { join } from 'path';
+import { mockPathsDataRoot } from '../lib/mockPathsDataRoot.js';
+
+const { tempRoot, makeProxy, cleanup } = mockPathsDataRoot({
+ prefix: 'portos-taste-',
+ // taste-questionnaire binds PATHS.digitalTwin at module load; redirect it
+ // into the temp tree so tests never touch the real install profile.
+ extraOverrides: (dataRoot) => ({
+ digitalTwin: join(dataRoot, 'digital-twin'),
+ }),
+});
+
+vi.mock('../lib/fileUtils.js', async () => {
+ const actual = await vi.importActual('../lib/fileUtils.js');
+ return makeProxy(actual);
+});
+
+// Avoid digitalTwinEvents side effects during answer submit
+vi.mock('./digital-twin.js', () => ({
+ digitalTwinEvents: { emit: vi.fn() },
+}));
+
+beforeEach(() => {
+ vi.resetModules();
+});
+
+afterAll(() => {
+ cleanup();
+});
+
+describe('getNextQuestion progress', () => {
+ it('reports core index, not total responses, after follow-ups', async () => {
+ const taste = await import('./taste-questionnaire.js');
+
+ // Core Q1
+ let next = await taste.getNextQuestion('food');
+ expect(next.questionId).toBe('food-core-1');
+ expect(next.progress).toEqual({
+ current: 1,
+ coreTotal: 3,
+ totalAnswered: 0,
+ });
+
+ // Answer with a spice trigger so a follow-up is queued
+ await taste.submitAnswer('food', 'food-core-1', 'I love intense spice and heat');
+
+ next = await taste.getNextQuestion('food');
+ expect(next.isFollowUp).toBe(true);
+ expect(next.questionId).toBe('food-fu-spice');
+ // Follow-up still anchors progress to the parent core question
+ expect(next.progress.current).toBe(1);
+ expect(next.progress.coreTotal).toBe(3);
+ expect(next.progress.totalAnswered).toBe(1);
+
+ await taste.submitAnswer('food', 'food-fu-spice', 'Thai and Sichuan especially');
+
+ // Core Q2 — must be "2 of 3", not "3 of 3" (responses.length + 1)
+ next = await taste.getNextQuestion('food');
+ expect(next.questionId).toBe('food-core-2');
+ expect(next.isFollowUp).toBe(false);
+ expect(next.progress).toEqual({
+ current: 2,
+ coreTotal: 3,
+ totalAnswered: 2,
+ });
+
+ await taste.submitAnswer(
+ 'food',
+ 'food-core-2',
+ 'I cook improvisationally, rarely following recipes'
+ );
+
+ next = await taste.getNextQuestion('food');
+ // Improvisational answer triggers food-fu-improv
+ expect(next.isFollowUp).toBe(true);
+ expect(next.progress.current).toBe(2);
+ expect(next.progress.coreTotal).toBe(3);
+
+ await taste.submitAnswer('food', next.questionId, 'Yes, freestyle almost always');
+
+ // Core Q3 after two cores + two follow-ups → still "3 of 3", never "5 of 3"
+ next = await taste.getNextQuestion('food');
+ expect(next.questionId).toBe('food-core-3');
+ expect(next.isFollowUp).toBe(false);
+ expect(next.progress).toEqual({
+ current: 3,
+ coreTotal: 3,
+ totalAnswered: 4,
+ });
+ expect(next.progress.current).toBeLessThanOrEqual(next.progress.coreTotal);
+ });
+
+ it('starts at Question 1 of N with no prior responses', async () => {
+ const taste = await import('./taste-questionnaire.js');
+ await taste.resetSection('movies');
+
+ const next = await taste.getNextQuestion('movies');
+ expect(next.questionId).toBe('movies-core-1');
+ expect(next.progress.current).toBe(1);
+ expect(next.progress.coreTotal).toBe(3);
+ expect(next.progress.totalAnswered).toBe(0);
+ });
+});