Skip to content

fix: explain empty consolidation viewer states#812

Open
mturac wants to merge 2 commits into
rohitg00:mainfrom
mturac:fix/issue-754-consolidation-empty-states
Open

fix: explain empty consolidation viewer states#812
mturac wants to merge 2 commits into
rohitg00:mainfrom
mturac:fix/issue-754-consolidation-empty-states

Conversation

@mturac
Copy link
Copy Markdown

@mturac mturac commented Jun 3, 2026

Summary

  • show gate/source details when semantic and procedural dashboard sections are empty
  • add lessons and crystals empty states that explain where those tiers come from
  • add a viewer regression test for consolidation empty-state guidance

Tests

  • git diff --check
  • npm test -- test/viewer-consolidation-empty-state.test.ts
  • npm run build

Closes #754

Summary by CodeRabbit

  • New Features

    • Consolidated, gate-based empty-state UI across Dashboard, Lessons, and Crystals
    • Semantic Memory shows gate requirements, current sessions, and guidance
    • Procedural Memory shows pattern counts with gate requirements
    • Lessons and Crystals include structured source/origin rows and inline command examples
  • Tests

    • Added tests verifying empty-state instructional content and gate messaging

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

@mturac is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4d015d90-dead-4342-a0d4-c06f2108bdc5

📥 Commits

Reviewing files that changed from the base of the PR and between 3fdf11d and a64fa09.

📒 Files selected for processing (2)
  • src/viewer/index.html
  • test/viewer-consolidation-empty-state.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/viewer/index.html

📝 Walkthrough

Walkthrough

The viewer UI's empty-state messaging for consolidation tabs is redesigned to show gate requirements and current input counts. New CSS styles and helper functions render standardized cards across all consolidation sections. Dashboard, Lessons, and Crystals views display their respective gate criteria and suggested actions. A test suite validates the empty-state content presence.

Changes

Consolidation tier empty-state messaging

Layer / File(s) Summary
Empty-state styles and helper functions
src/viewer/index.html
New .empty-gates CSS block structures gate rows with labels and values. Helper functions gateRows() and consolidationEmptyState() build HTML cards for standardized empty-state messaging with gate requirements and optional action HTML.
Dashboard memory empty states
src/viewer/index.html
Semantic Memory and Procedural Memory empty branches render gate requirements via consolidationEmptyState(), showing current session/pattern counts and where to check those values. Procedural Memory computes patternCount from existing memories.
Lessons and Crystals empty states
src/viewer/index.html
Lessons and Crystals view empty states use consolidationEmptyState() to display sources, inline command examples as <pre> blocks, and links to related documentation.
Empty-state validation test
test/viewer-consolidation-empty-state.test.ts
New Vitest suite calls renderViewerDocument() and asserts the HTML contains expected empty-state text fragments covering consolidation tiers, gate descriptions, and memory/action identifiers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Poem

🐰 In empty panes the little gates now sing,
Counts and commands tucked under each wing,
Helpers build cards with tidy rows in line,
Lessons and crystals display how to shine,
I hop and test — the viewer's prompts look fine.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR partially addresses #754 objectives by adding empty-state UI components for the viewer with gate requirements, but does not implement the API endpoints (/agentmemory//status) mentioned as required in the issue scope. Complete the implementation by adding the /agentmemory//status API endpoints to return {count, gate, currentInputs, suggestedAction} for each tier as specified in issue #754.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: explain empty consolidation viewer states' directly reflects the main change: adding explanatory UI for empty consolidation tabs.
Out of Scope Changes check ✅ Passed The PR changes are properly scoped: new JS helpers (gateRows, consolidationEmptyState) and test coverage for the viewer empty-state UI directly address issue #754 without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/viewer/index.html (1)

1427-1427: ⚡ Quick win

Escape current before injecting into HTML.

current is inserted directly while other fields are escaped. Keeping this escaped avoids future XSS footguns if the helper is reused with non-numeric input.

🛡️ Proposed fix
-        '<div class="empty-lead">Current count: ' + current + '. This is an input gate, not a broken tab.</div>' +
+        '<div class="empty-lead">Current count: ' + esc(current) + '. This is an input gate, not a broken tab.</div>' +
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/viewer/index.html` at line 1427, The snippet injects the variable current
directly into HTML; escape current using the same HTML-escaping helper used
elsewhere (e.g., escapeHtml or the existing escaping utility) before
concatenation so the line becomes the escaped value for current inside the '<div
class="empty-lead">…</div>' string; update the construction that produces that
string to call the escape helper on current (or coerce to Number if it must be
numeric) to prevent XSS.
test/viewer-consolidation-empty-state.test.ts (1)

12-24: ⚡ Quick win

Add an assertion for insights empty-state guidance.

This regression test covers four tiers but skips insights, which is part of the stated consolidation empty-state scope.

✅ Suggested assertion addition
     expect(html).toContain("Crystals come from crystallize actions");
     expect(html).toContain("mem::auto-crystallize");
+    expect(html).toContain("Insights are waiting for consolidation inputs");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/viewer-consolidation-empty-state.test.ts` around lines 12 - 24, Add an
assertion in the viewer-consolidation-empty-state.test.ts near the other expects
that verifies the rendered html (variable html) includes the insights
empty-state guidance text; follow the same pattern as the existing lines (e.g.,
the expect(html).toContain(...) checks for "Semantic facts...", "Procedures...",
"Lessons...", "Crystals...") and add one expect(html).toContain(...) that
matches the canonical insights guidance string shown in the UI so insights are
covered by this consolidation empty-state test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/viewer/index.html`:
- Around line 1419-1424: The shared title lookup for the empty-state map (the
var title = { ... }[kind] || 'Nothing to show yet') is missing an insights key
so when kind === 'insights' it falls back to the generic copy; add an
"insights": '<appropriate insights message>' entry to the object literal
alongside semantic, procedural, lessons, and crystals so the lookup returns the
intended insights-specific string when kind is "insights".

---

Nitpick comments:
In `@src/viewer/index.html`:
- Line 1427: The snippet injects the variable current directly into HTML; escape
current using the same HTML-escaping helper used elsewhere (e.g., escapeHtml or
the existing escaping utility) before concatenation so the line becomes the
escaped value for current inside the '<div class="empty-lead">…</div>' string;
update the construction that produces that string to call the escape helper on
current (or coerce to Number if it must be numeric) to prevent XSS.

In `@test/viewer-consolidation-empty-state.test.ts`:
- Around line 12-24: Add an assertion in the
viewer-consolidation-empty-state.test.ts near the other expects that verifies
the rendered html (variable html) includes the insights empty-state guidance
text; follow the same pattern as the existing lines (e.g., the
expect(html).toContain(...) checks for "Semantic facts...", "Procedures...",
"Lessons...", "Crystals...") and add one expect(html).toContain(...) that
matches the canonical insights guidance string shown in the UI so insights are
covered by this consolidation empty-state test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6a6d9aca-fc32-4729-8509-93d04f97952b

📥 Commits

Reviewing files that changed from the base of the PR and between 3e90110 and 3fdf11d.

📒 Files selected for processing (2)
  • src/viewer/index.html
  • test/viewer-consolidation-empty-state.test.ts

Comment thread src/viewer/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Viewer: surface per-tier gate reasons when consolidation tabs are empty

1 participant