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

address review (claude,codex): clarify capImageRefs comment + assert universeRun tag in StoryBuilder render test

Adam Eivydcab06fa3f15
diff --git a/client/src/lib/bibleLimits.js b/client/src/lib/bibleLimits.js
index ea53785946..c398d2949f 100644
--- a/client/src/lib/bibleLimits.js
+++ b/client/src/lib/bibleLimits.js
@@ -80,10 +80,11 @@ export const BIBLE_LIMITS = Object.freeze({
INGREDIENT_ID_MAX: 64,
});
-// Client-side helper (no server mirror): trim an imageRefs list to the
-// server-enforced last-N cap (IMAGE_REFS_PER_ENTRY_MAX). Shared by the
-// optimistic imageRefs-append paths in the universe/canon render surfaces so a
-// local stamp never grows past what the durable server append keeps.
+// Client-only helper (the cap *value* IMAGE_REFS_PER_ENTRY_MAX is mirrored from
+// the server; this convenience function is not). Trims an imageRefs list to that
+// last-N cap, mirroring the server's `appendEntryImageRef` rotation. Shared by
+// the optimistic imageRefs-append paths in the universe/canon render surfaces so
+// a local stamp never grows past what the durable server append keeps.
export const capImageRefs = (refs) => (
refs.length > BIBLE_LIMITS.IMAGE_REFS_PER_ENTRY_MAX
? refs.slice(-BIBLE_LIMITS.IMAGE_REFS_PER_ENTRY_MAX)
diff --git a/client/src/pages/StoryBuilder.test.jsx b/client/src/pages/StoryBuilder.test.jsx
index b983247bc9..eac4b4c517 100644
--- a/client/src/pages/StoryBuilder.test.jsx
+++ b/client/src/pages/StoryBuilder.test.jsx
@@ -443,6 +443,16 @@ describe('StoryBuilder — detail stepper', () => {
const arg = api.generateImage.mock.calls[0][0];
expect(arg.prompt).toContain('Kessa');
expect(arg.prompt.toLowerCase()).toContain('noir');
+ // #1362: the render carries the durable universeRun.entryRef tag so the
+ // server-side appendEntryImageRef hook files it — no client follow-up PATCH.
+ expect(arg.universeRun).toEqual({
+ universeId: 'u1',
+ universeName: 'Giant',
+ entryRef: { kind: 'canon', kindKey: 'characters', id: 'ch1' },
+ label: 'Kessa',
+ category: 'characters',
+ });
+ expect(api.updateUniverse).not.toHaveBeenCalled();
});
it('persists the provider/model picker choice to session.llm', async () => {