Skip to content

Conversation

@Abhinavpv28
Copy link
Contributor

@Abhinavpv28 Abhinavpv28 commented Dec 28, 2025

Reason for change: Migrate uploadSTBlogs.sh to C implementation
Test Procedure: Focused Regression
Risks: Low
Signed-off-by: Abhinav P V Abhinav_Valappil@comcast.com

Copilot AI review requested due to automatic review settings December 28, 2025 11:28
@Abhinavpv28 Abhinavpv28 requested a review from a team as a code owner December 28, 2025 11:28
Copy link
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 refactors the RuntimeContext structure to simplify variable access by flattening nested sub-structures into a single flat structure. Previously, fields were organized into separate sub-structures (paths, flags, settings, device, endpoints, retry, certificates), requiring access patterns like ctx->paths.log_path. Now all fields are direct members of RuntimeContext, accessed as ctx->log_path.

Key Changes:

  • Flattened RuntimeContext structure by removing 7 nested sub-structures
  • Updated all source and test files to use direct field access instead of nested access
  • Maintained all field names and documentation

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
uploadstblogs/include/uploadstblogs_types.h Removed nested struct definitions (UploadFlags, UploadSettings, PathConfig, EndpointConfig, DeviceInfo, CertificateConfig, RetryConfig) and flattened all fields into RuntimeContext
uploadstblogs/src/validation.c Updated all field accesses from ctx->paths.* and ctx->settings.* to direct access
uploadstblogs/src/uploadstblogs.c Updated all field accesses from ctx->flags.*, ctx->paths.*, ctx->device.*, and ctx->endpoints.* to direct access
uploadstblogs/src/strategy_selector.c Updated all field accesses from ctx->flags.*, ctx->settings.*, ctx->device.*, and ctx->paths.* to direct access
uploadstblogs/src/strategy_reboot.c Updated all field accesses from ctx->paths.*, ctx->settings.*, ctx->flags.*, and ctx->device.* to direct access
uploadstblogs/src/strategy_ondemand.c Updated all field accesses from ctx->paths.*, ctx->flags.*, and ctx->device.* to direct access
uploadstblogs/src/strategy_handler.c Updated field accesses from ctx->device.* to direct access
uploadstblogs/src/strategy_dcm.c Updated all field accesses from ctx->paths.* and ctx->settings.* to direct access
uploadstblogs/src/retry_logic.c Updated all field accesses from ctx->retry.* to direct access
uploadstblogs/src/path_handler.c Updated all field accesses from ctx->endpoints.*, ctx->settings.*, and ctx->device.* to direct access
uploadstblogs/src/log_collector.c Updated all field accesses from ctx->paths.* and ctx->settings.* to direct access
uploadstblogs/src/event_manager.c Updated field accesses from ctx->device.* to direct access
uploadstblogs/src/context_manager.c Updated all field accesses from all nested structures to direct access throughout initialization and loading functions
uploadstblogs/src/archive_manager.c Updated all field accesses from ctx->device.* and ctx->paths.* to direct access
uploadstblogs/unittest/*.cpp (11 files) Updated all test code to use direct field access instead of nested structure access

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Valappil, Abhinav (Contractor) added 2 commits December 28, 2025 17:11
Copilot AI review requested due to automatic review settings December 28, 2025 12:21
Copy link
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 34 out of 34 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

uploadstblogs/include/uploadstblogs_types.h:188

  • The nested structure type definitions (UploadFlags, UploadSettings, PathConfig, EndpointConfig, DeviceInfo, CertificateConfig, RetryConfig) at lines 105-188 are no longer used after flattening RuntimeContext. These type definitions should be removed to avoid confusion and maintain code cleanliness, as they're now obsolete.
typedef struct {
    int rrd_flag;                   /**< RRD mode flag */
    int dcm_flag;                   /**< DCM mode flag */
    int flag;                       /**< General upload flag */
    int upload_on_reboot;           /**< Upload on reboot flag */
    int trigger_type;               /**< Type of upload trigger */
} UploadFlags;

/**
 * @struct UploadSettings
 * @brief Boolean settings for upload behavior
 */
typedef struct {
    bool privacy_do_not_share;      /**< Privacy mode enabled */
    bool ocsp_enabled;              /**< OCSP validation enabled */
    bool encryption_enable;         /**< Encryption enabled */
    bool direct_blocked;            /**< Direct path blocked */
    bool codebig_blocked;           /**< CodeBig path blocked */
    bool include_pcap;              /**< Include PCAP files */
    bool include_dri;               /**< Include DRI logs */
    bool tls_enabled;               /**< TLS 1.2 support enabled */
    bool maintenance_enabled;       /**< Maintenance mode enabled */
} UploadSettings;

/**
 * @struct PathConfig
 * @brief File system paths and directories
 */
typedef struct {
    char log_path[MAX_PATH_LENGTH];           /**< Main log directory */
    char prev_log_path[MAX_PATH_LENGTH];      /**< Previous logs directory */
    char archive_path[MAX_PATH_LENGTH];       /**< Archive output directory */
    char rrd_file[MAX_PATH_LENGTH];           /**< RRD log file path */
    char dri_log_path[MAX_PATH_LENGTH];       /**< DRI logs directory */
    char temp_dir[MAX_PATH_LENGTH];           /**< Temporary directory */
    char telemetry_path[MAX_PATH_LENGTH];     /**< Telemetry directory */
    char dcm_log_file[MAX_PATH_LENGTH];       /**< DCM log file path */
    char dcm_log_path[MAX_PATH_LENGTH];       /**< DCM log directory */
    char iarm_event_binary[MAX_PATH_LENGTH];  /**< IARM event sender location */
} PathConfig;

/**
 * @struct EndpointConfig
 * @brief Upload endpoint URLs and links
 */
typedef struct {
    char endpoint_url[MAX_URL_LENGTH];        /**< Upload endpoint URL */
    char upload_http_link[MAX_URL_LENGTH];    /**< HTTP upload link */
    char presign_url[MAX_URL_LENGTH];         /**< Pre-signed URL */
    char proxy_bucket[MAX_URL_LENGTH];        /**< Proxy bucket for fallback uploads */
} EndpointConfig;

/**
 * @struct DeviceInfo
 * @brief Device identification information
 */
typedef struct {
    char mac_address[MAX_MAC_LENGTH];         /**< Device MAC address */
    char device_type[32];                     /**< Device type (mediaclient, etc.) */
    char build_type[32];                      /**< Build type */
} DeviceInfo;

/**
 * @struct CertificateConfig
 * @brief TLS/mTLS certificate paths
 */
typedef struct {
    char cert_path[MAX_CERT_PATH_LENGTH];     /**< Client certificate path */
    char key_path[MAX_CERT_PATH_LENGTH];      /**< Private key path */
    char ca_cert_path[MAX_CERT_PATH_LENGTH];  /**< CA certificate path */
} CertificateConfig;

/**
 * @struct RetryConfig
 * @brief Retry and timeout configuration
 */
typedef struct {
    int direct_max_attempts;        /**< Max attempts for direct path */
    int codebig_max_attempts;       /**< Max attempts for CodeBig path */
    int direct_retry_delay;         /**< Retry delay for direct (seconds) */
    int codebig_retry_delay;        /**< Retry delay for CodeBig (seconds) */
    int curl_timeout;               /**< Curl operation timeout */
    int curl_tls_timeout;           /**< TLS handshake timeout */
} RetryConfig;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Valappil, Abhinav (Contractor) added 2 commits December 30, 2025 13:18
Copilot AI review requested due to automatic review settings December 30, 2025 08:29
Copy link
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 36 out of 36 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

bool maintenance_enabled; /**< Maintenance mode enabled */

} UploadSettings;

Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

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

Empty line removed from the structure definition. While this doesn't affect functionality, it changes the structure formatting which appears inconsistent with the rest of the type definitions in this file.

Suggested change

Copilot uses AI. Check for mistakes.
#include "strategy_handler.h"
#include "log_collector.h"
#include "archive_manager.h"
#include "archive_manager.h"
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

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

Duplicate include directive. Line 39 includes "archive_manager.h" but line 40 also includes the same file. Remove one of the duplicate includes.

Suggested change
#include "archive_manager.h"

Copilot uses AI. Check for mistakes.
Valappil, Abhinav (Contractor) added 2 commits December 30, 2025 15:16
Copilot AI review requested due to automatic review settings December 31, 2025 04:33
Copy link
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 37 out of 37 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Valappil, Abhinav (Contractor) added 2 commits December 31, 2025 10:19
Copilot AI review requested due to automatic review settings December 31, 2025 04:59
Copy link
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 39 out of 39 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Abhinavpv28 Abhinavpv28 changed the title Simplify strucrure variables RDK-57502 - [RDKE] Migrate Operation Support Log Upload Related Scripts To C Implementation Dec 31, 2025
Valappil, Abhinav (Contractor) added 2 commits December 31, 2025 14:07
Copilot AI review requested due to automatic review settings December 31, 2025 13:15
Copy link
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 39 out of 40 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

nhanasi
nhanasi previously approved these changes Dec 31, 2025
Copilot AI review requested due to automatic review settings January 1, 2026 04:53
Copy link
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 40 out of 41 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Valappil, Abhinav (Contractor) added 2 commits January 1, 2026 10:49
Copilot AI review requested due to automatic review settings January 1, 2026 05:43
Copy link
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 40 out of 41 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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