Skip to content

Fix/378 inbox daily digest tests docs#1158

Open
soomtochukwu wants to merge 3 commits into
Stellar-Mail:mainfrom
soomtochukwu:fix/378-inbox-daily-digest-tests-docs
Open

Fix/378 inbox daily digest tests docs#1158
soomtochukwu wants to merge 3 commits into
Stellar-Mail:mainfrom
soomtochukwu:fix/378-inbox-daily-digest-tests-docs

Conversation

@soomtochukwu

Copy link
Copy Markdown
Contributor

Add tests and documentation for daily digest. Closes #378
Adds comprehensive unit test coverage and detailed setup documentation for the isolated Inbox Daily Digest tool inside tools/v1/individual/inbox-daily-digest/.

Deliverables

Unit Tests (tests/)

  • tests/digestGuards.test.ts — validates edge cases of mailbox snapshot structures (arrays/objects), normalization of control characters and HTML tags, stable ID generation, and cap limits
  • tests/components.test.ts — validates shallow rendering, visual/layout state structures, accessibility elements (aria-busy), and error/warning display logic
  • Mocked React hook states (useState, useMemo) at the test module level to support testing functional components without DOM/browser dependencies

Vitest Configuration (vitest.config.ts)

  • Independent Vitest configuration file mapping tests inside tools/v1/individual/inbox-daily-digest/tests/

Documentation (README.md)

  • Expanded to detail file structures, setup guidelines, manual review checks, and command references to execute test suites independently

Verification

Run the isolated test suite:

npx vitest run -c tools/v1/individual/inbox-daily-digest/vitest.config.ts

All 13 tests pass cleanly.

Boundary Compliance

  • Confined entirely to tools/v1/individual/inbox-daily-digest/
  • Isolated from global test suites, avoiding any project-wide configuration churn

…ail#376

Builds the **Inbox Daily Digest** tool's core UI and accessibility surface inside its isolated folder `tools/v1/individual/inbox-daily-digest/`.

## Deliverables

### UI Components (`components/`)
- `InboxDailyDigestTool.tsx` — main container orchestrating the state machine and tone selection
- `states/DigestEmptyState.tsx` — idle state prompting user to generate daily digest preview
- `states/DigestLoadingState.tsx` — accessible loading state with spinner and `aria-busy="true"`
- `states/DigestErrorState.tsx` — accessible error display with dynamic message and a retry button
- `states/DigestSuccessState.tsx` — lists metrics, top emails, next actions, and tone details

### Styling & CSS (`styles.css`)
- Structured layout with grid and flexbox, custom badges, and responsive view adjustments
- Clean color palette adhering to the tool requirements (no generic red/blue/green)
- Focus states and animation handling (supporting `prefers-reduced-motion: reduce`)

### Documentation (`docs/visual-style.md`)
- Outlines layout structure, typography, interactive states, and responsive styling details

## Boundary Compliance
- All changes stay inside `tools/v1/individual/inbox-daily-digest/`
- No modification to main app shell, routing, inbox, wallet, Stellar core, database, or design system
…ar-Mail#377

Adds safety, input validation, and performance constraints to the **Inbox Daily Digest** tool inside `tools/v1/individual/inbox-daily-digest/`.

## Deliverables

### Safety Guards (`services/digestGuards.ts`)
- `guardDigestEmails(input, options)` — sanitizes, validates, and caps raw mailbox entries
- Normalizes whitespaces, strips control characters and HTML tags, and truncates overly long strings (e.g. sender, subject, body fields)
- Rejects non-array snapshots and non-object elements gracefully, returning warnings instead of throwing errors

### UI Integration
- Integrates the input sanitization guard inside `InboxDailyDigestTool.tsx` generator callbacks
- Added an alert box in `DigestSuccessState.tsx` to render any processing and truncation notes returned by the guard report

### Documentation (`docs/security-performance.md`)
- Documents threat assumptions, unsafe input handling, performance caps, and reviewer validation guidelines

## Boundary Compliance
- Confined to `tools/v1/individual/inbox-daily-digest/`
- Zero changes to main app or existing security-sensitive shared code
- Memory and processing limits are enforced to protect against denial-of-service from hostile mail payloads
Adds comprehensive unit test coverage and detailed setup documentation for the isolated **Inbox Daily Digest** tool inside `tools/v1/individual/inbox-daily-digest/`.

## Deliverables

### Unit Tests (`tests/`)
- `tests/digestGuards.test.ts` — validates edge cases of mailbox snapshot structures (arrays/objects), normalization of control characters and HTML tags, stable ID generation, and cap limits
- `tests/components.test.ts` — validates shallow rendering, visual/layout state structures, accessibility elements (`aria-busy`), and error/warning display logic
- Mocked React hook states (`useState`, `useMemo`) at the test module level to support testing functional components without DOM/browser dependencies

### Vitest Configuration (`vitest.config.ts`)
- Independent Vitest configuration file mapping tests inside `tools/v1/individual/inbox-daily-digest/tests/`

### Documentation (`README.md`)
- Expanded to detail file structures, setup guidelines, manual review checks, and command references to execute test suites independently

## Verification

Run the isolated test suite:
```bash
npx vitest run -c tools/v1/individual/inbox-daily-digest/vitest.config.ts
```
All 13 tests pass cleanly.

## Boundary Compliance
- Confined entirely to `tools/v1/individual/inbox-daily-digest/`
- Isolated from global test suites, avoiding any project-wide configuration churn
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.

[V1][individual] Inbox Daily Digest - Testing and documentation

1 participant