Skip to content

Feature/UUID debug.txt#193

Open
Abhinavpv28 wants to merge 93 commits intodevelopfrom
feature/uuid_debug.txt
Open

Feature/UUID debug.txt#193
Abhinavpv28 wants to merge 93 commits intodevelopfrom
feature/uuid_debug.txt

Conversation

@Abhinavpv28
Copy link
Copy Markdown
Contributor

No description provided.

Abhinavpv28 and others added 16 commits May 4, 2026 20:30
… built-in special-char removal)

Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/00abcaba-8a41-4b88-ae12-07b5ff780ff9

Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
…ectly

rrd_logproc_convert_issue_type() was converting '-' to '_', turning the
suffix '_Search-67768-67' into '_SEARCH_67768_67'. This added extra '_'
separators into the archive filename that broke the analytics portal's
filename parser — it could no longer identify the timestamp field, so
download requests used an incorrect S3 key.

Fix: keep '-' as '-' in the sanitized output. The archive filename now
uses '_' to separate structural fields (MAC, issueType, timestamp) and
'-' within the UUID suffix, giving the portal a reliable delimiter.

Also increase issue_type_sanitized buffer in uploadRRDLogs.c from 64 to
256 bytes so a full UUID suffix never causes a silent truncation failure.

Before: 04B86A12F9F8_DEVICE_DEVICEIP_SEARCH_67768_67_<timestamp>_RRD_DEBUG_LOGS.tgz
After:  04B86A12F9F8_DEVICE_DEVICEIP_SEARCH-67768-67_<timestamp>_RRD_DEBUG_LOGS.tgz

All 331 tests pass.

Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/981b6bc1-c9d2-4150-9e9d-851004942ffc

Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
…9 rule

split_issue_type() now discards any suffix whose total length (including
the leading '_') exceeds 9 characters.  The old _Search-/_LogSearch-
prefix validation is removed entirely.

Rule:
  strlen(underscore) <= 9  → suffix accepted
  strlen(underscore)  > 9  → suffix discarded

This means:
  - Short session tokens (e.g. "_ab12345", 8 chars) are carried through
  - Long UUID-based suffixes like "_Search-b6877385-...) are discarded,
    preventing extra '_' delimiters from breaking the portal filename parser

Affected tests updated:
  - UnderscoreSplitsBaseAndSuffix : uses a short accepted suffix
  - MultipleUnderscoresSplitsAtFirst: "_def_ghi" (8 chars) now kept
  - BaseTruncatedWhenTooSmall / ExactFitBase: "_suffix" (7 chars) now kept
  - SuffixTruncatedWhenTooSmall: uses 9-char suffix with 5-byte buffer
  - OnlyUnderscoreInput: "_" (1 char) now kept
  - LogSearchSuffixIsValid → NineCharSuffixIsAccepted (boundary test)
  - SearchSuffixIsValid → LongSuffixIsDiscarded
  - InvalidSuffixPrefixDiscarded / SearchWithoutHyphenIsInvalid /
    LogSearchWithoutHyphenIsInvalid: updated comments (same outcomes)
  - ProcessIssueTypeEvntTest comments updated to reflect new rule

All 331 tests pass.

Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/c6d6fc29-da2a-46af-a417-c2de67a18448

Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
…tests

- Expand the RRD_MAX_SUFFIX_LEN comment to explain why 9 chars is the limit
- Rename misleading test names that referenced old prefix-based validation:
    InvalidSuffixPrefixDiscarded → SuffixExceedingMaxLengthDiscarded
    SearchWithoutHyphenIsInvalid → SuffixSeventeenCharsDiscarded
    LogSearchWithoutHyphenIsInvalid → SuffixTwentyCharsDiscarded
- LongSuffixIsDiscarded: switch to a neutral _1234567890 example so the
  test does not imply any Search-specific behavior

All 331 tests pass.

Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/c6d6fc29-da2a-46af-a417-c2de67a18448

Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 7, 2026 03:44
@Abhinavpv28 Abhinavpv28 requested a review from a team as a code owner May 7, 2026 03:44
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Code Coverage Summary

                               Total:|84.1%   6188|97.3%  1648|    -      0

@Abhinavpv28
Copy link
Copy Markdown
Contributor Author

@copilot
instead appending the suffix to filemane, can we append it to RRD_OUTPUT_FILE

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 carrying an “issue type suffix” through the remote debugger flow so it can be appended to the upload artifact name, and updates sanitization logic/tests to preserve hyphens (for UUID-like tokens) while also expanding/adjusting unit test coverage.

Changes:

  • Introduces split_issue_type() and a new data_buf::suffix field, then appends the suffix to the upload issue name in checkIssueNodeInfo().
  • Updates issue-type tokenization/sanitization flow and adjusts unit tests accordingly (including new tests for splitting behavior and suffix lifecycle).
  • Preserves hyphens in rrd_logproc_convert_issue_type() and adds a new .gitignore for build/test artifacts.

Reviewed changes

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

Show a summary per file
File Description
src/uploadRRDLogs.c Enlarges sanitized issue type buffer to align with archive filename sizing.
src/unittest/rrdUnitTestRunner.cpp Updates/extends gtest coverage for issue splitting, suffix handling, and sanitization expectations.
src/rrdJsonParser.h Exposes the new split_issue_type() helper.
src/rrdJsonParser.c Adds split_issue_type() and appends suffix into the upload issue name; cleans up suffix on error/exit paths.
src/rrdInterface.c Initializes and frees the newly added data_buf::suffix.
src/rrdEventProcess.c Changes issue token handling to split base/suffix and sanitize base post-split; removes pre-split sanitization.
src/rrdCommon.h Adds suffix field to data_buf.
src/rrd_logproc.c Preserves hyphens during issue type sanitization.
.gitignore Adds ignore rules for autotools/build artifacts and test outputs.

Comment thread src/rrdJsonParser.c Outdated
Comment on lines +49 to +56
/* Maximum allowed suffix length (including the leading '_').
* The analytics portal parses archive filenames by splitting on '_'. A suffix
* longer than this limit would introduce extra '_' delimiters that shift the
* timestamp field to a wrong position, causing download failures.
* 9 characters = '_' + up to 8 alphanumeric/short-token chars: long UUID-based
* suffixes (e.g. "_Search-b6877385-...") are always > 9 and are therefore
* discarded before the archive name is built. */
#define RRD_MAX_SUFFIX_LEN 9
Comment thread src/rrdJsonParser.c
Comment on lines +82 to +99
void split_issue_type(const char *input, char *base, size_t base_len, char *suffix, size_t suffix_len)
{
if (base && base_len > 0)
{
base[0] = '\0';
}
if (suffix && suffix_len > 0)
{
suffix[0] = '\0';
}

if (!input || !base || !suffix)
{
return;
}

if (base_len == 0 || suffix_len == 0)
{
Comment thread src/rrdEventProcess.c
Comment on lines 691 to 695
while (str[source] != '\0')
{
if (isalnum(str[source]) || str[source] == ',' || str[source] == '.')
//if (isalnum(str[source]) || str[source] == ',' || str[source] == '.' || str[source] == '_'|| str[source] == '-')
if (isalnum(str[source]) || str[source] == ',' || str[source] == '.')
{
Comment thread src/rrd_logproc.c
Comment on lines 121 to 126
for (size_t i = 0; input[i] && j < size-1; ++i) {
char c = input[i];
if (isalnum((unsigned char)c)) output[j++] = toupper((unsigned char)c);
else if (c == '_' || c == '-' || c == '.') output[j++] = '_';
else if (c == '_' || c == '.') output[j++] = '_';
else if (c == '-') output[j++] = '-'; // preserve hyphens so suffix UUID tokens remain distinct
// skip other chars
Comment thread src/rrdEventProcess.c
Comment on lines 79 to +83
cmdBuff = (data_buf *)malloc(sizeof(data_buf));
if (cmdBuff)
{
dataMsgLen = strlen(cmdMap[index]) + 1;
char base[128] = {0};
char local_suffix[128] = {0};
Comment thread src/rrdEventProcess.c
Comment on lines 715 to 720
int cnt = 1, i = 0;
char *str = input_str;

removeSpecialCharacterfromIssueTypeList(str);
while (*str == delimeter)
str++;

Copy link
Copy Markdown

Copilot AI commented May 7, 2026

@copilot
instead appending the suffix to filemane, can we append it to RRD_OUTPUT_FILE

Done in ce81da8. The suffix is now appended to RRD_OUTPUT_FILE (e.g., debug_outputs_ab12345.txt) instead of the upload archive filename. The issueData struct gained a suffix field, which is propagated from buff->suffix through checkIssueNodeInfoinvokeSanityandCommandExecexecuteCommands, where it's inserted before the .txt extension when building finalOutFile. The upload call now uses buff->mdata directly without any suffix.

Copilot AI review requested due to automatic review settings May 7, 2026 06:36
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 9 out of 10 changed files in this pull request and generated 5 comments.

Comment thread src/rrdJsonParser.c
Comment on lines +53 to +56
* 9 characters = '_' + up to 8 alphanumeric/short-token chars: long UUID-based
* suffixes (e.g. "_Search-b6877385-...") are always > 9 and are therefore
* discarded before the archive name is built. */
#define RRD_MAX_SUFFIX_LEN 50
Comment thread src/rrdEventProcess.c
Comment on lines 691 to 695
while (str[source] != '\0')
{
if (isalnum(str[source]) || str[source] == ',' || str[source] == '.')
//if (isalnum(str[source]) || str[source] == ',' || str[source] == '.' || str[source] == '_'|| str[source] == '-')
if (isalnum(str[source]) || str[source] == ',' || str[source] == '.')
{
Comment thread src/rrdEventProcess.c
Comment on lines 715 to 720
int cnt = 1, i = 0;
char *str = input_str;

removeSpecialCharacterfromIssueTypeList(str);
while (*str == delimeter)
str++;

Comment thread src/rrd_logproc.c
Comment on lines 121 to 126
for (size_t i = 0; input[i] && j < size-1; ++i) {
char c = input[i];
if (isalnum((unsigned char)c)) output[j++] = toupper((unsigned char)c);
else if (c == '_' || c == '-' || c == '.') output[j++] = '_';
else if (c == '_' || c == '.') output[j++] = '_';
else if (c == '-') output[j++] = '-'; // preserve hyphens so suffix UUID tokens remain distinct
// skip other chars
Comment thread src/rrdEventProcess.c
Comment on lines +109 to 113
}
dataMsgLen = strlen(base) + 1;
RRD_data_buff_init(cmdBuff, EVENT_MSG, RRD_DEEPSLEEP_INVALID_DEFAULT); /* Setting Deafult Values*/
cmdBuff->inDynamic = rbuf->inDynamic;
if(cmdBuff->inDynamic)
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