Skip to content

filter out internal issues#940

Merged
GeorgeGoodall-GovUk merged 2 commits into
mainfrom
938-bug-org-column-must-have-valid-values
Feb 28, 2025
Merged

filter out internal issues#940
GeorgeGoodall-GovUk merged 2 commits into
mainfrom
938-bug-org-column-must-have-valid-values

Conversation

@GeorgeGoodall-GovUk
Copy link
Copy Markdown
Contributor

@GeorgeGoodall-GovUk GeorgeGoodall-GovUk commented Feb 28, 2025

Preview Link

https://submit-pr-[PR_NUMBER].herokuapp.com/

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

correctly filter out issues of responsibility internal before generating the task list

QA Instructions, Screenshots, Recordings

Before

image

Before screenshot here

After

image

After screenshot here

Added/updated tests?

We encourage you to keep the code coverage percentage at 80% and above.

  • Yes
  • No, and this is why: Please replace this line with details on why tests have not been included
  • I need help with writing tests

QA sign off

  • Code has been checked and approved
  • Design has been checked and approved
  • Product and business logic has been checked and proved

[optional] Are there any post-deployment tasks we need to perform?

[optional] Are there any dependencies on other PRs or Work?

Summary by CodeRabbit

  • New Features
    • Enhanced the display of issues so that internal details are automatically filtered out. End-users will now only see externally relevant information, ensuring a clearer and more focused view of reported issues.

@GeorgeGoodall-GovUk GeorgeGoodall-GovUk linked an issue Feb 28, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 28, 2025

Walkthrough

A new middleware function, filterOutInternalIssues, has been introduced in src/controllers/resultsController.js. This function filters the issues array in the incoming request, excluding any issues with a responsibility property set to "internal". It is positioned in the middleware stack to execute after extractIssuesFromResults and before addQualityCriteriaLevelsToIssues. Additionally, a modification in setupTableParams ensures that errors are only considered if their responsibility is not 'internal'.

Changes

File Summary
src/controllers/.../resultsController.js Added filterOutInternalIssues to filter out issues with responsibility: 'internal' and modified setupTableParams to check responsibility before considering an error.

Sequence Diagram(s)

sequenceDiagram
    participant Req as Request
    participant EIR as extractIssuesFromResults
    participant FII as filterOutInternalIssues
    participant AQC as addQualityCriteriaLevelsToIssues

    Req->>EIR: Process issues extraction
    EIR->>FII: Forward issues for filtering
    FII->>AQC: Pass filtered issues along
Loading

Suggested labels

bug

Poem

Oh, hopping through the lines of code,
I found a fix upon the road.
Filtering issues, swift and light,
With clever hops into the night.
A bunny's tune for a cleaner mode!


📜 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 2785960 and 51b91ac.

📒 Files selected for processing (1)
  • src/controllers/resultsController.js (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/controllers/resultsController.js
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: run-tests / test

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 28, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 65.92% 5221 / 7920
🔵 Statements 65.92% 5221 / 7920
🔵 Functions 64.18% 233 / 363
🔵 Branches 80.69% 719 / 891
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/controllers/resultsController.js 51.19% 69.23% 37.5% 51.19% 20-38, 65-69, 73-77, 85-86, 88-89, 93-94, 115-117, 131-139, 176-177, 186-194, 197-200, 203-215, 228-252, 262-263, 282-298, 301-304, 312-324, 331-352, 363-373, 376-378, 381-410
Generated in workflow #894 for commit 51b91ac by the Vitest Coverage Report Action

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: 0

🧹 Nitpick comments (1)
src/controllers/resultsController.js (1)

196-200: Clean implementation of the filtering middleware.

The implementation is succinct and follows the established middleware pattern in this file. It correctly filters out issues where the responsibility is "internal" before they can be processed further in the middleware chain.

One minor suggestion for defensive programming:

export function filterOutInternalIssues (req, res, next) {
-  const { issues } = req
-  req.issues = issues.filter(issue => issue.responsibility !== 'internal')
+  const { issues = [] } = req
+  req.issues = Array.isArray(issues) ? issues.filter(issue => issue.responsibility !== 'internal') : []
  next()
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8195b9a and 2785960.

📒 Files selected for processing (1)
  • src/controllers/resultsController.js (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (2)
src/controllers/resultsController.js (2)

29-29: Good addition of the new middleware.

The placement of the filterOutInternalIssues middleware is correct, positioned between extractIssuesFromResults and addQualityCriteriaLevelsToIssues. This ensures internal issues are filtered out at the appropriate point in the middleware chain.


254-263: Consistent with documented behavior.

The comment confirms that the new filtering middleware aligns with the existing code logic, as it mentions that issues with responsibility set to "internal" should be excluded from results. The new middleware makes this filtering explicit rather than relying solely on the quality criteria level check.

@eveleighoj eveleighoj temporarily deployed to submit-pr-940 February 28, 2025 11:17 Inactive
@GeorgeGoodall-GovUk GeorgeGoodall-GovUk merged commit 23aa2eb into main Feb 28, 2025
@DilwoarH DilwoarH deleted the 938-bug-org-column-must-have-valid-values branch February 28, 2025 14:35
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.

Bug: Org column must have valid values

4 participants