Skip to content

refactor(frameworks): enhance compliance tracking and visualization - #123

Merged
Marfuen merged 1 commit into
mainfrom
mariano/deel-import
Mar 10, 2025
Merged

Marfuen merged 1 commit into
mainfrom
mariano/deel-import

Conversation

@Marfuen

@Marfuen Marfuen commented Mar 10, 2025 •

Copy link
Copy Markdown
Contributor
  • Improve FrameworkProgress component with dynamic circular progress indicators
  • Add useComplianceScores hook to calculate framework compliance metrics
  • Refactor RequirementStatus component with more detailed compliance tracking
  • Remove redundant procedure entries in SOC2 control definitions
  • Optimize policies and evidence requirement compliance calculation
  • Update usePolicies hook to support more flexible pagination and filtering

Summary by CodeRabbit

  • New Features

    • Enhanced compliance dashboards now display interactive visuals with overall compliance scores and detailed breakdowns for policies, evidence tasks, and cloud tests.
    • Enabled framework-specific policy retrieval to provide a more focused policy overview.
  • Improvements

    • Optimized data fetching, caching, and pagination to ensure a smoother and more responsive experience.
  • Data Updates

    • Streamlined regulatory procedure references for clearer compliance documentation.

- Improve FrameworkProgress component with dynamic circular progress indicators
- Add useComplianceScores hook to calculate framework compliance metrics
- Refactor RequirementStatus component with more detailed compliance tracking
- Remove redundant procedure entries in SOC2 control definitions
- Optimize policies and evidence requirement compliance calculation
- Update usePolicies hook to support more flexible pagination and filtering
@vercel

vercel Bot commented Mar 10, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app 🔄 Building (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 8:49pm
comp-portal 🔄 Building (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 8:49pm
web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 8:49pm

@Marfuen
Marfuen merged commit d6640ed into main Mar 10, 2025
@coderabbitai

coderabbitai Bot commented Mar 10, 2025 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

This PR introduces a new action for retrieving policies by framework with proper authentication and error handling. In addition, several UI components and hooks have been updated to standardize pagination parameters (switching from per_page to pageSize) and enhance compliance view logic, including a new hook to compute compliance scores and a component for rendering circular progress indicators. There are also formatting adjustments across multiple files and updates to a JSON data file to remove redundant procedure entries.

Changes

File(s) Change Summary
apps/app/src/actions/policies/get-policies-by-framework.ts Added new action (getPoliciesByFrameworkAction) to fetch policies by framework with authentication, error handling, and logging.
apps/app/src/app/[locale]/(app)/(dashboard)/(home)/components/FrameworkProgress.tsx Introduced a new compliance scoring feature; integrated useComplianceScores hook and added CircleProgress component for visual compliance display.
apps/app/src/app/[locale]/(app)/(dashboard)/(home)/components/FrameworksOverview.tsx Adjusted indentation (formatting) without altering functionality.
apps/app/src/app/[locale]/(app)/(dashboard)/policies/all/(overview)/actions/get-policies.ts,
PoliciesList.tsx,
hooks/usePolicies.ts,
types/index.ts
Standardized pagination by updating per_page to pageSize, modified variable names and hook signatures, and applied formatting improvements.
apps/app/src/components/charts/requirement-status.tsx Enhanced compliance evaluation logic with new types and helper function; added debugging logs and a progress bar for UI compliance representation.
apps/app/src/components/policies/charts/policies-by-framework.tsx Updated usePolicies hook call to include explicit parameters; modified code formatting to use tab-based indentation.
apps/app/src/hooks/use-compliance-scores.ts Introduced new custom hook (useComplianceScores) to compute and memoize compliance scores from policies, evidence tasks, and tests.
apps/app/src/hooks/use-policies-by-framework.ts Added new custom hook (usePoliciesByFramework) using SWR for data fetching, error handling, and a refresh mechanism for policies.
packages/data/controls/soc2.json Removed multiple procedure entries and modified evidence descriptions to reference corresponding procedures documents.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Action as GetPoliciesByFrameworkAction
    participant Auth as AuthActionClient
    participant DB as Database
    Client->>Action: Request policies for a specific framework
    Action->>Auth: Check user authentication
    alt Not Authenticated
        Auth-->>Action: Return error ("Not authorized")
        Action-->>Client: Failure response
    else Authenticated
        Action->>DB: Execute findMany() query for policies
        DB-->>Action: Return policies data or empty result
        alt Policies found
            Action-->>Client: Success response with policies
        else No policies found
            Action-->>Client: Failure ("Policies not found")
        end
    end
Loading
sequenceDiagram
    participant UI as FrameworkProgress Component
    participant Hook as useComplianceScores
    participant Policies as usePolicies
    participant Evidence as useOrganizationEvidenceTasks
    participant Tests as useTests
    UI->>Hook: Invoke hook with frameworks
    Hook->>Policies: Fetch policies data
    Hook->>Evidence: Fetch evidence tasks data
    Hook->>Tests: Fetch cloud tests data
    Note right of Hook: Compute and memoize compliance scores
    Hook-->>UI: Return compliance scores & loading status
Loading

Possibly related PRs

Poem

I'm a nimble rabbit, leaping code trails with glee,
New actions and hooks set our data free.
Policies and scores now dance in a graceful spin,
With clean updates and progress circles built-in.
In every commit, I nibble a byte so bright—
A carrot-fueled celebration in code delight! 🥕


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ddcb7d5 and 2c762fc.

📒 Files selected for processing (12)
  • apps/app/src/actions/policies/get-policies-by-framework.ts (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/(home)/components/FrameworkProgress.tsx (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/(home)/components/FrameworksOverview.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/policies/all/(overview)/actions/get-policies.ts (4 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/policies/all/(overview)/components/PoliciesList.tsx (2 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/policies/all/(overview)/hooks/usePolicies.ts (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/policies/all/(overview)/types/index.ts (1 hunks)
  • apps/app/src/components/charts/requirement-status.tsx (1 hunks)
  • apps/app/src/components/policies/charts/policies-by-framework.tsx (1 hunks)
  • apps/app/src/hooks/use-compliance-scores.ts (1 hunks)
  • apps/app/src/hooks/use-policies-by-framework.ts (1 hunks)
  • packages/data/controls/soc2.json (46 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

This branch was successfully deployed

3 active deployments
Preview – web — 2c762fcc Deployed Mar 10, 2025 by vercel[bot]
Preview – app — 2c762fcc Deployed Mar 10, 2025 by vercel[bot]
Preview – comp-portal — 2c762fcc Deployed Mar 10, 2025 by vercel[bot]
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.

1 participant