Skip to content

test: cover memory presentation components#1875

Merged
senamakel merged 3 commits into
tinyhumansai:mainfrom
aqilaziz:codex/1870-memory-components-tests
May 16, 2026
Merged

test: cover memory presentation components#1875
senamakel merged 3 commits into
tinyhumansai:mainfrom
aqilaziz:codex/1870-memory-components-tests

Conversation

@aqilaziz
Copy link
Copy Markdown
Contributor

@aqilaziz aqilaziz commented May 15, 2026

Summary

  • Add unit coverage for memory empty-state and stats presentation components
  • Cover memory result grouping, row selection, and empty result rendering
  • Cover ActionableCard direct actions and delayed snooze callback

Refs #1870

Verification

  • pnpm --dir app test -- src/components/intelligence/tests/MemoryPresentation.test.tsx
  • pnpm --dir app exec prettier --check src/components/intelligence/tests/MemoryPresentation.test.tsx
  • pnpm --dir app exec eslint src/components/intelligence/tests/MemoryPresentation.test.tsx

Notes

  • Full local pre-push hook reached cargo check and failed because the local disk ran out of space (os error 112). The PR itself only adds a frontend test file; GitHub CI should run the full gate on a clean runner.

Summary by CodeRabbit

  • Tests

    • Added a comprehensive test suite for memory presentation UI: verifies empty-state rendering, stats display, chunk grouping by age (TODAY/YESTERDAY/THIS WEEK/OLDER), selection behavior, actionable item actions (complete/dismiss), and snooze timing with deterministic timers.
  • Accessibility

    • Memory rows now expose their active state to assistive technologies so screen readers and keyboard users get accurate selection feedback.

Review Change Stack

@aqilaziz aqilaziz requested a review from a team May 15, 2026 23:28
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1fbbd2ab-88fc-424e-ae3e-fa04493b0d7c

📥 Commits

Reviewing files that changed from the base of the PR and between 174c594 and 6dacde0.

📒 Files selected for processing (1)
  • app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/components/intelligence/tests/MemoryPresentation.test.tsx

📝 Walkthrough

Walkthrough

Adds a Vitest + React Testing Library suite for memory presentation components and sets aria-pressed on MemoryResultList chunk row buttons to reflect selection state.

Changes

Memory Presentation UI Tests & a11y

Layer / File(s) Summary
Test helpers and setup infrastructure
app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx
Mock builders for Chunk and ActionableItem, deterministic localDayAt timestamp helper, and Vitest fake timer setup/teardown.
MemoryPresentation empty state
app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx
Asserts empty-memory placeholder renders expected test id, heading, and integration prompt.
MemoryStatsBar display and formatting
app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx
Asserts storage size, file/document counts, "today" activity, and session/token labels are formatted and displayed correctly.
MemoryResultList grouping, selection, and accessibility
app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx, app/src/components/intelligence/MemoryResultList.tsx
Tests chunk grouping into TODAY/YESTERDAY/THIS WEEK/OLDER, selection callback behavior, empty-state message, and adds aria-pressed to chunk row <button>s reflecting active selection.
ActionableCard interactions and snooze timing
app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx
Tests actionable item fields, onComplete/onDismiss callbacks, and async snooze behavior delayed until after the exit/animation delay using fake timers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #1870: Adds tests for MemoryResultList, MemoryStatsBar, MemoryEmptyPlaceholder, and ActionableCard matching the test backfill requested in that issue.

Poem

🐇 I stitched mock chunks beneath the moonlit code,
Timers set steady so ages gently flow,
Empty states, counts, and selections all in row,
Snooze waits its turn while callbacks softly glow,
A tiny rabbit cheers — the tests now hop and go.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 'test: cover memory presentation components' accurately and clearly describes the main change: adding comprehensive test coverage for memory presentation UI components.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

🧹 Nitpick comments (1)
app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx (1)

131-133: ⚡ Quick win

Prefer selection assertions over CSS-class checks.

This couples the test to is-active styling rather than user-observable behavior. Assert selection via accessible state (aria-selected/aria-pressed) or another visible signal to make refactors less brittle.

As per coding guidelines, "Use behavior-driven testing over implementation details in Vitest unit tests, with helpers from app/src/test/."

🤖 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 `@app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx` around
lines 131 - 133, Replace the brittle CSS-class assertion that checks
selectedRow.closest('button') for class "is-active" with a behavior-driven
accessibility assertion: locate the interactive element (the same selectedRow
and its closest('button')) and assert its accessible selection state (e.g.,
aria-pressed or aria-selected) using toHaveAttribute('aria-pressed','true') or
toHaveAttribute('aria-selected','true'), or use getByRole(...) and assert the
pressed/selected state; use the project test helpers for accessibility if
available to keep the test tied to user-visible behavior rather than styling.
🤖 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.

Nitpick comments:
In `@app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx`:
- Around line 131-133: Replace the brittle CSS-class assertion that checks
selectedRow.closest('button') for class "is-active" with a behavior-driven
accessibility assertion: locate the interactive element (the same selectedRow
and its closest('button')) and assert its accessible selection state (e.g.,
aria-pressed or aria-selected) using toHaveAttribute('aria-pressed','true') or
toHaveAttribute('aria-selected','true'), or use getByRole(...) and assert the
pressed/selected state; use the project test helpers for accessibility if
available to keep the test tied to user-visible behavior rather than styling.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 72abe81c-40da-4d0a-accb-32ab8f1f0f66

📥 Commits

Reviewing files that changed from the base of the PR and between 02cf2ce and f18cd44.

📒 Files selected for processing (1)
  • app/src/components/intelligence/__tests__/MemoryPresentation.test.tsx

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 15, 2026
@aqilaziz
Copy link
Copy Markdown
Contributor Author

Addressed the CodeRabbit nit: MemoryResultList rows now expose the selected state via �ria-pressed, and the test asserts that accessible state instead of the styling class.

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 15, 2026
@aqilaziz
Copy link
Copy Markdown
Contributor Author

Updated after CI on the latest base: empty-state assertions now accept the current Memory copy while still checking the same behavior. Local focused test, eslint, and prettier check pass.

@senamakel senamakel merged commit b7d8d4b into tinyhumansai:main May 16, 2026
23 checks passed
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.

2 participants