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: populate a readable prompt for Bridge Word/Compound Chain training-log questions

[._.]/ Adam Eivy3cebffad2b23
diff --git a/client/src/components/meatspace/post/WordplayTrainer.jsx b/client/src/components/meatspace/post/WordplayTrainer.jsx
index 89423ecffa..570aff469b 100644
--- a/client/src/components/meatspace/post/WordplayTrainer.jsx
+++ b/client/src/components/meatspace/post/WordplayTrainer.jsx
@@ -217,13 +217,22 @@ export default function WordplayTrainer({ onBack, config, onConfigUpdate }) {
e?.preventDefault();
const responseMs = Date.now() - questionStartRef.current;
+ // A human-readable label for the prompt this response answers, sourced
+ // from the current challenge/puzzle regardless of mode. Bridge Word has
+ // no single rootWord/word/idiom field — its prompt is the clue set the
+ // player was shown — so it needs its own fallback rather than falling
+ // through to '' (which left the persisted training-log breakdown unable
+ // to identify which bridge puzzle was missed).
+ const promptLabel = currentPrompt?.rootWord || currentPrompt?.word || currentPrompt?.idiom
+ || (currentPrompt?.clues || []).join(' / ') || '';
+
let responseObj;
if (selectedMode === 'compound-chain') {
- responseObj = { questionIndex, items, responseMs };
+ responseObj = { questionIndex, prompt: promptLabel, items, responseMs };
} else {
responseObj = {
questionIndex,
- prompt: currentPrompt?.rootWord || currentPrompt?.word || currentPrompt?.idiom || '',
+ prompt: promptLabel,
response: inputValue.trim(),
responseMs,
};
diff --git a/client/src/components/meatspace/post/WordplayTrainer.test.jsx b/client/src/components/meatspace/post/WordplayTrainer.test.jsx
index b009899a79..d95abb79c3 100644
--- a/client/src/components/meatspace/post/WordplayTrainer.test.jsx
+++ b/client/src/components/meatspace/post/WordplayTrainer.test.jsx
@@ -72,6 +72,7 @@ describe('WordplayTrainer — training-log persistence (issue #2097)', () => {
// carrying the score/feedback already computed for the results screen.
expect(entry.questions).toHaveLength(1);
expect(entry.questions[0]).toMatchObject({
+ prompt: 'fire',
items: ['firehouse'],
score: 85,
feedback: 'Nice compounds!',
@@ -106,4 +107,39 @@ describe('WordplayTrainer — training-log persistence (issue #2097)', () => {
await screen.findByText('Next');
expect(submitTrainingEntry).not.toHaveBeenCalled();
});
+
+ it('persists a Bridge Word breakdown with a readable prompt built from the clue set (issue #2114)', async () => {
+ // Regression: Bridge Word puzzles have no rootWord/word/idiom field, only
+ // `clues`. Before this fix, the persisted question's `prompt` silently
+ // fell through to '' for this mode — the training log couldn't identify
+ // which puzzle a missed answer belonged to.
+ generatePostDrill.mockResolvedValue({
+ type: 'bridge-word',
+ puzzles: [{ clues: ['news___', '___back'], answer: 'paper' }],
+ });
+ scorePostLlmDrill.mockResolvedValue({
+ evaluation: { scores: [{ score: 40, feedback: 'Not quite' }] },
+ });
+
+ render(<WordplayTrainer onBack={() => {}} config={{}} onConfigUpdate={() => {}} />);
+
+ fireEvent.click(await screen.findByText('Bridge Word'));
+ await waitFor(() => expect(screen.getByText('news___')).toBeInTheDocument());
+
+ const input = screen.getByPlaceholderText(/bridge word is/i);
+ fireEvent.change(input, { target: { value: 'wrongword' } });
+ fireEvent.click(screen.getByText('Submit'));
+
+ const seeResults = await screen.findByText('See Results');
+ fireEvent.click(seeResults);
+
+ await waitFor(() => expect(submitTrainingEntry).toHaveBeenCalledTimes(1));
+ const entry = submitTrainingEntry.mock.calls[0][0];
+ expect(entry.questions[0]).toMatchObject({
+ prompt: 'news___ / ___back',
+ response: 'wrongword',
+ score: 40,
+ correct: false,
+ });
+ });
});