Skip to content

Refactor TransportActions in sample-resource-plugin to include Request and Response as inner classes#6138

Closed
cwperks wants to merge 1 commit intoopensearch-project:mainfrom
cwperks:combine-actions
Closed

Refactor TransportActions in sample-resource-plugin to include Request and Response as inner classes#6138
cwperks wants to merge 1 commit intoopensearch-project:mainfrom
cwperks:combine-actions

Conversation

@cwperks
Copy link
Copy Markdown
Member

@cwperks cwperks commented May 8, 2026

Description

Refactor TransportActions in sample-resource-plugin to include Request and Response as inner classes

  • Category

Maintenance

Check List

  • New functionality includes testing
  • New functionality has been documented
  • New Roles/Permissions have a corresponding security dashboards plugin PR
  • API changes companion pull request created
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…t and Response as inner classes

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ Recommended focus areas for review

Missing constant

Line 45 references RESOURCE_TYPE constant that is imported but never defined in the visible diff. If this constant does not exist in Constants, the code will fail to compile.

import static org.opensearch.sample.utils.Constants.RESOURCE_TYPE;
Missing constant

Line 41 references RESOURCE_GROUP_TYPE constant that is imported but never defined in the visible diff. If this constant does not exist in Constants, the code will fail to compile.

import static org.opensearch.sample.utils.Constants.RESOURCE_GROUP_TYPE;

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Missing super constructor call

The Request constructor reading from StreamInput should call super(in) to properly
initialize the parent ActionRequest class. This ensures proper deserialization of
inherited fields and maintains consistency with OpenSearch framework patterns.

sample-resource-plugin/src/main/java/org/opensearch/sample/resource/actions/transport/CreateResourceTransportAction.java [150-153]

 public Request(StreamInput in) throws IOException {
+    super(in);
     this.resource = in.readNamedWriteable(SampleResource.class);
     this.shouldStoreUser = in.readBoolean();
 }
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a missing super(in) call in the StreamInput constructor. This is important for proper deserialization of inherited fields from ActionRequest and follows OpenSearch framework patterns. The same issue appears in multiple similar classes throughout the PR.

Medium

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 64.15929% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.83%. Comparing base (4d6f34f) to head (4461d45).

Files with missing lines Patch % Lines
...tions/transport/CreateResourceTransportAction.java 54.83% 14 Missing ⚠️
.../transport/CreateResourceGroupTransportAction.java 55.55% 12 Missing ⚠️
...ons/transport/GetResourceGroupTransportAction.java 60.71% 11 Missing ⚠️
...tions/transport/DeleteResourceTransportAction.java 62.96% 10 Missing ⚠️
.../actions/transport/GetResourceTransportAction.java 64.28% 10 Missing ⚠️
.../transport/DeleteResourceGroupTransportAction.java 62.96% 10 Missing ⚠️
...tions/transport/UpdateResourceTransportAction.java 66.66% 7 Missing ⚠️
.../transport/UpdateResourceGroupTransportAction.java 66.66% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6138      +/-   ##
==========================================
- Coverage   74.83%   74.83%   -0.01%     
==========================================
  Files         447      433      -14     
  Lines       28470    28470              
  Branches     4327     4327              
==========================================
- Hits        21306    21305       -1     
- Misses       5172     5174       +2     
+ Partials     1992     1991       -1     
Files with missing lines Coverage Δ
...urce/actions/rest/create/CreateResourceAction.java 100.00% <100.00%> (ø)
.../actions/rest/create/CreateResourceRestAction.java 78.78% <100.00%> (ø)
...urce/actions/rest/create/UpdateResourceAction.java 100.00% <100.00%> (ø)
...urce/actions/rest/delete/DeleteResourceAction.java 100.00% <100.00%> (ø)
.../actions/rest/delete/DeleteResourceRestAction.java 75.00% <100.00%> (ø)
...e/resource/actions/rest/get/GetResourceAction.java 100.00% <100.00%> (ø)
...source/actions/rest/get/GetResourceRestAction.java 100.00% <100.00%> (ø)
...actions/rest/create/CreateResourceGroupAction.java 100.00% <100.00%> (ø)
...ons/rest/create/CreateResourceGroupRestAction.java 82.60% <100.00%> (ø)
...actions/rest/create/UpdateResourceGroupAction.java 100.00% <100.00%> (ø)
... and 12 more

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cwperks cwperks closed this May 9, 2026
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