Skip to content

Data Product Catalog updates#4897

Draft
timcanham wants to merge 24 commits intonasa:develfrom
timcanham:dp-delete
Draft

Data Product Catalog updates#4897
timcanham wants to merge 24 commits intonasa:develfrom
timcanham:dp-delete

Conversation

@timcanham
Copy link
Copy Markdown
Collaborator

Related Issue(s)
Has Unit Tests (y/n) y
Documentation Included (y/n) y
Generative AI was used in this contribution (y/n) y

Change Description

Rationale

Testing/Review Recommendations

Future Work

AI Usage (see policy)

}

void DpCatalog::getFileState(DpStateEntry& entry) {
FwSignedSizeType DpCatalog::findStateFileEntryIndex(FwDpIdType id, U32 tSec, U32 tSub, FwIndexType dir) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
return found;
}

DpCatalog::DpBtreeNode* DpCatalog::findTreeNode(FwDpIdType id, U32 tSec, U32 tSub) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
this->cmdResponse_out(opCode, cmdSeq, success ? Fw::CmdResponse::OK : Fw::CmdResponse::EXECUTION_ERROR);
}

void DpCatalog ::PROCESS_DP_FILE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg& fileName) {

Check notice

Code scanning / CodeQL

Function too long Note

PROCESS_DP_FILE_cmdHandler has too many lines (101, while 60 are allowed).
this->cmdResponse_out(opCode, cmdSeq, success ? Fw::CmdResponse::OK : Fw::CmdResponse::EXECUTION_ERROR);
}

void DpCatalog ::PROCESS_DP_FILE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg& fileName) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
Copy link
Copy Markdown

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

timcanham and others added 3 commits March 24, 2026 21:45
Extracted helper functions to reduce line count and improve code
organization:

- PROCESS_DP_FILE_cmdHandler: 101 → 60 lines
- changeDpPriorityHelper: 64 → 33 lines
- retransmitDpHelper: 207 → 56 lines

New helper functions:
- openAndValidateOpFile: Validates and opens DP operations files
- parseFileOperationRecord: Parses binary operation records
- readDpHeader: Reads DP file headers
- updateNodePriority: Updates priority of existing catalog nodes
- addDpToCatalog: Adds new DP files to catalog
- updateExistingDpForRetransmit: Handles retransmit priority updates

All functions now meet the 60-line limit requirement and maintain
proper assertions. All 43 unit tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
this->cmdResponse_out(opCode, cmdSeq, success ? Fw::CmdResponse::OK : Fw::CmdResponse::EXECUTION_ERROR);
}

void DpCatalog ::CHANGE_DP_PRIORITY_cmdHandler(FwOpcodeType opCode,

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
this->cmdResponse_out(opCode, cmdSeq, success ? Fw::CmdResponse::OK : Fw::CmdResponse::EXECUTION_ERROR);
}

void DpCatalog ::RETRANSMIT_DP_cmdHandler(FwOpcodeType opCode,

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
FW_ASSERT(desStat == Fw::FW_SERIALIZE_OK, desStat);
}

bool DpCatalog::readDpHeader(const Fw::FileNameString& dpFileName, Fw::DpContainer& container) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.

// Parse record fields
U8 operationCode;
U32 id, tSec, tSub, priority;

Check notice

Code scanning / CodeQL

Multiple variable declarations on one line Note

Multiple variable declarations on the same line.
U32 cmdSeq) {
// Open the operations file
Os::File::Status stat = opFile.open(fileName.toChar(), Os::File::OPEN_READ);
if (stat != Os::File::OP_OK) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
U32& tSub,
U32& priority) {
const FwSizeType DATA_SIZE = 17; // Size of data fields (excludes CRC32)
Fw::ExternalSerializeBuffer serialBuffer(const_cast<U8*>(recordBuf), DATA_SIZE);

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
U32 newPriority,
U32 oldPriority) {
// Copy the entry before removing from tree
DpStateEntry updatedEntry = node->entry;

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
// Read the DP header
U8 dpBuff[Fw::DpContainer::MIN_PACKET_SIZE];
Fw::Buffer hdrBuff(dpBuff, sizeof(dpBuff));
Fw::DpContainer container;

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
U32 tSub,
U32 priorityOverride) {
// Determine the new priority
U32 newPriority;

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
for (FwSizeType i = 0; i < dataSize; i++) {
readSize = 1;
Os::File::Status stat = opFile.read(&byteBuf, readSize);
if (stat != Os::File::OP_OK || readSize != 1) {

Check notice

Code scanning / CodeQL

Use of basic integral type Note

crc uses the basic integral type unsigned long rather than a typedef with size and signedness.
return;
}

// Check if product port is connected

Check notice

Code scanning / CodeQL

Function too long Note

SEND_CATALOG_DP_cmdHandler has too many lines (83, while 60 are allowed).
return;
}

// Check if product port is connected

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@LeStarch LeStarch added Deferred To Future Release This PR is marked as deferred until after the upcoming release. and removed Deferred To Future Release This PR is marked as deferred until after the upcoming release. labels Mar 30, 2026
foundDir = dir;
break;
}
}

Check notice

Code scanning / CodeQL

Function too long Note

deleteDpHelper has too many lines (76, while 60 are allowed).
foundDir = dir;
break;
}
}

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
this->log_WARNING_LO_DpPriorityXmitInProgress(id, tSec, tSub);
return false;
}

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
}

if (foundDir == DP_MAX_DIRECTORIES) {
this->log_WARNING_LO_DpNotFound(id, tSec, tSub);

Check notice

Code scanning / CodeQL

Function too long Note

retransmitDpHelper has too many lines (61, while 60 are allowed).
}

if (foundDir == DP_MAX_DIRECTORIES) {
this->log_WARNING_LO_DpNotFound(id, tSec, tSub);

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
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