| name | coverity-fix |
| description | Use this to fix discovered static analysis / Coverity issues over selected components in the entservices repo. Use this only after a scan has completed and a master report has been generated for the scanned components. |
Coverity Fix Skill
To perform the Coverity fix, consider the following instructions. As a Coverity remediation lead for RDK, know that every instruction below is mandatory and must be enforced exactly.
The CSV already contains the canonical Component Name and File Path columns. Treat those workspace-relative paths as the source of truth.
MASTER INSTRUCTIONS — ZERO DEVIATION
-
STRICT FULL COMPONENT COVERAGE
- If user specified a branch, switch to it; otherwise, switch to the latest branch
copilot/coverity-analysis-{YYYY_MM_DD-HH.MM.SS} of the repo and read the entire CSV located at .github/agent_output/reports/{repoName}_workspace_static_analysis.csv. You will be using this same branch for the entire fix phase.
- Extract every component name in the exact order listed.
- List all components in order they appear in CSV
- Count components, display the ordered list, and confirm the total.
- For each component, enumerate the distinct workspace-relative file paths exactly as recorded in the CSV
File Path column
- If a component has no issues, explicitly output:
Component <name>: No Coverity issues found.
- Before proceeding to the next step, confirm that the listed components and file paths in the CSV match the actual components and file paths in the repository; do not proceed with the remaining instructions if there are any discrepancies.
- If the check in step 7 succeeds, add a new column to the CSV named
Resolution Status and Notes for use in the next steps.
-
PROCESSING ONE COMPONENT AT A TIME
- Select first component from the list
- Analyze all files for the component completely so that you understand the context of the component when performing fixes in the next step; do not skip helpers, headers, or platform variants.
- Extract all rows from CSV where Component Name matches
- For each row, you will:
- Examine the entire file at File Path
- Locate the exact line or inclusive line range recorded in Line Number
- Review Source Code Snippet and Issue Description
- Understand the identified issue. Identify if it is a false positive, if the suggested fix can be implemented, or if an alternative fix is needed.
- If the issue is a false positive, mark the issue as 'False Positive' with a brief justification in the column
Resolution Status and Notes
- If an alternative fix is needed, implement it then mark the issue as 'Alternate Fix' with a brief justification in the column
Resolution Status and Notes
- Otherwise, implement the Suggested Fix
- Before moving to the next component, self-verify that every CSV row for the current component is either fixed or marked as a false positive, and that the per-component counts reconcile exactly.
- Do not move to next component until current component is 100% complete
- Repeat for all components in sequence
-
COVERITY FIXING RULES
- Preserve Public APIs:
- Do not change public functions' signatures, parameter types, or return types
- Do not modify public struct/class definitions
- Do not alter include guards or exported symbols
- Fix internal logic only
- Code Marking:
- For all edits include comments:
// FIX(Issue ):
// Reason:
// Impact:
- No Massive Rewrites:
- Make minimum necessary changes to fix the issue
- Preserve existing code style and variable names
- Avoid rewriting entire functions unless absolutely necessary
- Forbidden Operations:
- Do not create automation scripts or Python tools
- Do not proceed without explicitly reading source files first
- Do not skip components
- Do not merge components
- Do not skip issues within a component
- Do not switch to a different branch; use the same branch specified in Instruction 1 for the entire fix phase
- Do not change public APIs
-
REQUIRED OUTPUT PER COMPONENT
After fixing all issues in a component, output:
=== COMPONENT: [Component Name] ===
ISSUE SUMMARY:
- Total issues in component: [N]
- Issues fixed: [N]
- False positives (skipped): [N]
UPDATED CODE:
[For each fixed issue, show the updated code snippet with FIX comments]
COVERAGE CONFIRMATION:
All issues in [Component Name] have been addressed. ✓
-
FALSE POSITIVE & RESOLUTION STATS (MANDATORY)
-
After processing all components, provide a table:
| Status | Count |
|--------|-------|
| Total Issues Found | [N] |
| Actually Resolved | [N] |
| False Positives | [N] |
-
END-TO-END COMPLETION CHECK
- Verify each component from CSV has been processed
- Verify all false positives or non-reproducible issues are documented
- Declare: "All [N] components processed. [X] issues fixed, [Y] false positives. Ready to push changes."
- Once the end-to-end completion check is complete, perform a final review of all changes made with Copilot code review tools, ensuring fixes do not introduce new issues and adhere to coding standards.
-
ABSOLUTELY FORBIDDEN
- Skipping or merging components
- Skipping any issue within a component
- Proceeding without reading the actual source file
- Switching remediation to a different analysis branch after processing has started
- Changing public interfaces
- Massive rewrites or speculative fixes
- Creating automation scripts or external tooling
-
PUSH CHANGES AND CREATE PR
- Commit all fixes to the branch with message:
"Fix Coverity issues - [N] issues resolved"
- Create a Pull Request from the branch to
develop
- PR Title:
"Coverity Analysis and Fix - {N} issues resolved"
- PR Body must include:
- Summary of components fixed
- Count of issues resolved vs false positives
- Link to the related analysis branch
- Announce PR creation and await final review