Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/empty seq #3025

Merged
merged 5 commits into from
Nov 18, 2024
Merged

Bugfix/empty seq #3025

merged 5 commits into from
Nov 18, 2024

Conversation

jsilveira1409
Copy link
Contributor

Related Issue(s) #3005
Has Unit Tests (y/n) n
Documentation Included (y/n) n

Change Description

Implemented FileEmpty warning for the Svc::CmdDispatcher Component, which is called when deserializing the next record returns an empty buffer.

Rationale

The Flight Software should raise a warning on empty command sequence files instead of crashing.

Testing/Review Recommendations

Future Work

Copy link
Collaborator

@LeStarch LeStarch left a comment

Choose a reason for hiding this comment

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

A few minor changes and questions.

severity warning high \
id 25 \
format "Sequence file is empty. Ignoring."
#format "Sequence file {} is empty. Ignoring."
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to clean-out the commented out code. Preferably we'd include the sequence name.

What scenario would this hit? Doesn't the sequence validation catch this (e.g. the CRC)?

Additionally, can this code be hit while a sequence is running? (e.g. the sequence file wasn't fully uplinked).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad for the comment, forgot about them!

cmdSeq.CS_VALIDATE does validate empty command sequences:

image

So actually the CS_VALIDATE would also need to trigger an empty command sequence event.

Copy link
Contributor Author

@jsilveira1409 jsilveira1409 Nov 15, 2024

Choose a reason for hiding this comment

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

So actually, to encompass both cases, a more elegant solution could be to simply verify the number of records when loading the sequence file at FPrimeSequence level, and return false if the number of records is zero, which would trigger the following events:

image

This would be the minor change:

bool CmdSequencerComponentImpl::FPrimeSequence ::
    validateRecords()
  {
    Fw::SerializeBufferBase& buffer = this->m_buffer;
    const U32 numRecords = this->m_header.m_numRecords;
    Sequence::Record record;

    if (numRecords == 0)
    {
      return false;
    }

( ... )

}

Copy link
Collaborator

@zimri-leisher zimri-leisher Nov 15, 2024

Choose a reason for hiding this comment

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

I think the FileEmpty solution may be technically inaccurate as the file still contains a sequence header and so is not literally empty. If we're going to use an event, maybe we'd better call it SeqEmpty or NoRecords, and make it clear in the error message that there specifically weren't any commands in the sequence. I like the second solution better, if this is the direction we choose to go.

@LeStarch
Copy link
Collaborator

@timcanham and @zimri-leisher I'd appreciate your thoughts on this PR.

@zimri-leisher
Copy link
Collaborator

zimri-leisher commented Nov 15, 2024

I would add/modify a unit test to check this behavior.

EDIT--On second thought, instead of EXECUTION_ERRORing, should we just allow the user to run empty sequences? My team intentionally did this and thought it would work (we were using the seq as a placeholder). In general tools should allow as much valid input as possible to make the fewest decisions for users. Maybe we could still raise a warning just in case it was a mistake.

@jsilveira1409
Copy link
Contributor Author

@zimri-leisher @LeStarch how about this event logs:

image

@zimri-leisher
Copy link
Collaborator

In my opinion this could be a low warning, but otherwise the event looks good! I assume it's the same for CS_VALIDATE.

@jsilveira1409
Copy link
Contributor Author

@zimri-leisher yeah makes sense to make it low warning, here is the full logs with CS_VALIDATE too :
image

@zimri-leisher
Copy link
Collaborator

Looks good, just missing a unit test.

Copy link
Collaborator

@timcanham timcanham left a comment

Choose a reason for hiding this comment

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

LGTM!

@LeStarch
Copy link
Collaborator

Looks good to me! I added a commit to allow the improperly flagged misspellings. Thanks for working this through! @zimri-leisher thanks for the review!

@LeStarch LeStarch merged commit 442e57a into nasa:devel Nov 18, 2024
35 checks passed
@jsilveira1409 jsilveira1409 deleted the bugfix/empty-seq branch November 23, 2024 14:31
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.

4 participants