Fix/378 inbox daily digest tests docs#1158
Open
soomtochukwu wants to merge 3 commits into
Open
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 limitstests/components.test.ts— validates shallow rendering, visual/layout state structures, accessibility elements (aria-busy), and error/warning display logicuseState,useMemo) at the test module level to support testing functional components without DOM/browser dependenciesVitest Configuration (
vitest.config.ts)tools/v1/individual/inbox-daily-digest/tests/Documentation (
README.md)Verification
Run the isolated test suite:
All 13 tests pass cleanly.
Boundary Compliance
tools/v1/individual/inbox-daily-digest/