Skip to content

Feature/rdk 60236 comma#188

Open
Abhinavpv28 wants to merge 45 commits intodevelopfrom
feature/RDK-60236_Comma
Open

Feature/rdk 60236 comma#188
Abhinavpv28 wants to merge 45 commits intodevelopfrom
feature/RDK-60236_Comma

Conversation

@Abhinavpv28
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 2, 2026 10:17
@Abhinavpv28 Abhinavpv28 requested a review from a team as a code owner May 2, 2026 10:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for issue-type “suffixes” (the substring starting at the first underscore) so that the base issue type is used for profile lookup/processing while the suffix can be preserved and appended when uploading debug output artifacts.

Changes:

  • Add data_buf::suffix and propagate initialization/cleanup in the message-buffer lifecycle.
  • Introduce split_issue_type() and update issue-type processing to split base vs suffix per comma-separated issue token.
  • Update issue-type sanitization to retain _ and -, and adjust/add unit tests around the new behavior.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/unittest/rrdUnitTestRunner.cpp Updates unit tests for issue-type splitting/suffix behavior and message-buffer setup.
src/unittest/UTJson/device.properties Unit test data file used during GTest runs.
src/rrdJsonParser.h Exposes new split_issue_type() helper.
src/rrdJsonParser.c Implements split_issue_type() and uses buff->suffix when constructing upload artifact names; adds additional cleanup.
src/rrdInterface.c Initializes and frees the new data_buf::suffix field.
src/rrdEventProcess.c Splits each issue token into base+suffix and stores suffix per token; expands allowed characters to keep _/-.
src/rrdCommon.h Extends data_buf with a suffix pointer.

Comment thread src/unittest/rrdUnitTestRunner.cpp Outdated
char str[] = "a@,b,&,cd,ef";
char **args = NULL;
int count = issueTypeSplitter(str, ',', &args);
int count = issueTypeSplitter(str, NULL, ',', &args);
Comment on lines 1903 to 1906
char str[] = "";
char **args = NULL;
int count = issueTypeSplitter(str, ',', &args);
int count = issueTypeSplitter(str, NULL, ',', &args);

Comment thread src/unittest/rrdUnitTestRunner.cpp Outdated
Comment on lines +1912 to +1921
TEST(IssueTypeSplitterTest, ExtractsSuffixFromIssueType)
{
char str[] = "Device.DeviceTime_Search";
char outsuffix[128] = {0};
char **args = NULL;
int count = issueTypeSplitter(str, outsuffix, ',', &args);

ASSERT_EQ(count, 1);
ASSERT_STREQ(args[0], "Device.DeviceTime");
ASSERT_STREQ(outsuffix, "_Search");
Comment thread src/unittest/rrdUnitTestRunner.cpp Outdated
Comment on lines +1930 to +1939
TEST(IssueTypeSplitterTest, NoSuffixWhenNoUnderscore)
{
char str[] = "Device.Network";
char outsuffix[128] = {0};
char **args = NULL;
int count = issueTypeSplitter(str, outsuffix, ',', &args);

ASSERT_EQ(count, 1);
ASSERT_STREQ(outsuffix, "");

Comment thread src/rrdEventProcess.c Outdated
char **cmdMap = NULL;
int index = 0, count = 0, dataMsgLen = 0;
data_buf *cmdBuff = NULL;
char suffix[128] = {0};
Comment thread src/rrdEventProcess.c
Comment on lines 90 to +95
cmdBuff->inDynamic = rbuf->inDynamic;
if(cmdBuff->inDynamic)
{
cmdBuff->jsonPath = rbuf->jsonPath;
}
cmdBuff->appendMode = rbuf->appendMode;
cmdBuff->appendMode = rbuf->appendMode;
Comment thread src/rrdInterface.c
Comment on lines 295 to +302
if (sbuf->jsonPath)
{
free(sbuf->jsonPath);
}
if (sbuf->suffix)
{
free(sbuf->suffix);
}
Comment on lines 1887 to 1890
char str[] = "abcd";
char **args = NULL;
int count = issueTypeSplitter(str, ',', &args);
int count = issueTypeSplitter(str, NULL, ',', &args);

Comment on lines 3721 to +3726
data_buf rbuf;
rbuf.mtype = EVENT_MSG;
rbuf.mdata = strdup("Test");
rbuf.inDynamic = true;
rbuf.jsonPath = nullptr;
rbuf.suffix = nullptr;
Copilot AI review requested due to automatic review settings May 2, 2026 10:29
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

Code Coverage Summary

                               Total:|83.1%   5949|97.0%  1532|    -      0

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (3)

src/unittest/rrdUnitTestRunner.cpp:1918

  • These new tests expect issueTypeSplitter to extract an underscore suffix into outsuffix, but the production issueTypeSplitter only splits on the provided delimiter and has no suffix output. Consider testing split_issue_type() directly for suffix extraction, and keep issueTypeSplitter tests focused on delimiter-splitting behavior.
/* --------------- Test processIssueTypeInDynamicProfile() from rrdEventProcess --------------- */
class ProcessIssueTypeInDynamicProfileTest : public ::testing::Test
{
protected:
    issueNodeData issuestructNode;
    data_buf buff;

src/unittest/rrdUnitTestRunner.cpp:1871

  • issueTypeSplitter is a static int issueTypeSplitter(char*, const char, char***) in rrdEventProcess.c (3 params). These test calls pass 4 arguments, so this won’t compile when including rrdEventProcess.c into the runner. Update the tests to match the actual signature (or change the function signature consistently if that’s intended).
    char **args = NULL;
    int count = issueTypeSplitter(str, ',', &args);

src/unittest/rrdUnitTestRunner.cpp:1909

  • issueTypeSplitter allocates args[i] strings (see implementation in rrdEventProcess.c), but this test only frees args and leaks args[0]. Free each args[i] (including index 0) before freeing the array, as done in the other splitter tests.
    int count = issueTypeSplitter(str, ',', &args);

    ASSERT_EQ(count, 1);

    free(args);

Comment thread src/rrdEventProcess.c
Comment on lines 90 to 92
if(cmdBuff->inDynamic)
{
cmdBuff->jsonPath = rbuf->jsonPath;
Comment thread src/rrdInterface.c
Comment on lines 295 to +302
if (sbuf->jsonPath)
{
free(sbuf->jsonPath);
}
if (sbuf->suffix)
{
free(sbuf->suffix);
}
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.

3 participants