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

Add Load and Activate Real Time Commands to SeqN #1543

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

goetzrrGit
Copy link
Contributor

@goetzrrGit goetzrrGit commented Nov 6, 2024

Summary
Added immediate_activate and immediate_load to SeqN.

@IMMEDIATE
ECHO "" 
@LOAD("seqA")

SeqJson

{
  "id": "SeqC",
  "metadata": {},
  "immediate_commands": [
    {
      "args": [
        {
          "type": "string",
          "value": "",
          "name": "echo_string"
        }
      ],
      "stem": "ECHO",
      "type": "command"
    },
    {
      "args": [],
      "sequence": "seqA",
      "type": "load"
    }
  ]
}

@goetzrrGit goetzrrGit requested a review from a team as a code owner November 6, 2024 20:55
@goetzrrGit goetzrrGit requested a review from cohansen November 6, 2024 20:55
@goetzrrGit goetzrrGit self-assigned this Nov 6, 2024
Copy link
Collaborator

@joswig joswig left a comment

Choose a reason for hiding this comment

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

Test cases and functionality are good.

My comment on the seq-json types is because distinct literal values help with control flow analysis. It also feels like we have a lot of type assertions.

type: stepNode.name === 'Load' ? 'load' : 'activate',
};
} as Activate | Load | ImmediateActivate | ImmediateLoad;
Copy link
Collaborator

@joswig joswig Nov 9, 2024

Choose a reason for hiding this comment

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

Can we use a different type attribute on Activate and ImmediateActivate in seq-json-schema? Same thing for Load and ImmediateLoad?

https://github.com/NASA-AMMOS/seq-json-schema/blob/04bc2f98b377cc0edb2ff06620605c0eca3a02f5/schema.json#L37

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still a little confused about you comment Did you want me to split this up like below

  if (stepNode.name === 'Activate') {
    return {
      args,
      description,
      engine,
      epoch,
      metadata,
      models,
      sequence,
      ...(!isRTC ? { time } : {}),
      type: 'activate',
    };
  }
  return {
    args,
    description,
    engine,
    epoch,
    metadata,
    models,
    sequence,
    ...(!isRTC ? { time } : {}),
    type: 'load',
  };

Or did you want to go to the schema and change ImmediateActivate's type to type: "immediate_activate" Similar with Load

Copy link
Contributor Author

@goetzrrGit goetzrrGit Nov 11, 2024

Choose a reason for hiding this comment

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

The current schema change was what @cartermak, Mike Schaffer, and I agreed on so we will have to go back to them and see if they are okay with changing this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we also split this up so it's clear what logic branch generated what type?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the slow reply -- I don't see an issue with amending the type attribute on the immediate activate and load steps to say immediate_load and immediate_activate, although it is redundant with those objects being in the immediate_commands array.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be consistent, I think you will need to change the ImmediateFswCommand object type as well to type: 'ImmediateFswCommand';

export interface ImmediateFswCommand {
  args: Args;
  description?: Description;
  metadata?: Metadata;
  /**
   * Command stem
   */
  stem: string;
  type?: 'command'; <----- Change to ImmediateFswCommand
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joswig new schema changes in place now. I am also using overloaded methods

src/utilities/sequence-editor/from-seq-json.ts Outdated Show resolved Hide resolved
src/utilities/sequence-editor/from-seq-json.ts Outdated Show resolved Hide resolved
src/utilities/sequence-editor/from-seq-json.ts Outdated Show resolved Hide resolved
type: stepNode.name === 'Load' ? 'load' : 'activate',
};
} as Activate | Load | ImmediateActivate | ImmediateLoad;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we also split this up so it's clear what logic branch generated what type?

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