Skip to content

RSDK-12536: Jobs CLI Parity#5731

Open
allisonschiang wants to merge 14 commits intoviamrobotics:mainfrom
allisonschiang:RSDK-12536
Open

RSDK-12536: Jobs CLI Parity#5731
allisonschiang wants to merge 14 commits intoviamrobotics:mainfrom
allisonschiang:RSDK-12536

Conversation

@allisonschiang
Copy link
Member

@allisonschiang allisonschiang commented Feb 10, 2026

testing (I tested to make sure it worked by looking at app, used AI to test individual validations):

add-job

Validated (rejected with error):

  • viam machines part add-job --part= --attributes '{}' → missing name
  • viam machines part add-job --part= --attributes '{"name":""}' → empty name
  • viam machines part add-job --part= --attributes '{"name":"t"}' → missing schedule
  • viam machines part add-job --part= --attributes '{"name":"t","schedule":"5s"}' → missing resource
  • viam machines part add-job --part= --attributes '{"name":"t","schedule":"5s","resource":"x"}' → missing method
  • viam machines part add-job --part= --attributes '{"name":"t","schedule":"abc","resource":"x","method":"DoCommand"}' → invalid schedule (garbage)
  • viam machines part add-job --part= --attributes '{"name":"t","schedule":"a b c d e","resource":"x","method":"DoCommand"}' → invalid schedule (bad cron)
  • viam machines part add-job --part= --attributes '{"name":"t","schedule":"5s","resource":"","method":"DoCommand"}' → empty resource
  • viam machines part add-job --part= --attributes '{"name":"t","schedule":"5s","resource":"x","method":""}' → empty method
  • viam machines part add-job --part= --attributes '{"name":"t","schedule":"5s","resource":"x","method":"DoCommand","command":"bad"}' → command not a JSON
    object
  • viam machines part add-job --part= --attributes
    '{"name":"t","schedule":"5s","resource":"x","method":"DoCommand","log_configuration":{"level":"verbose"}}' → invalid log level
  • viam machines part add-job --part= --attributes '{"name":"t-loglevel","schedule":"5s","resource":"x","method":"DoCommand"}' (when t-loglevel already
    exists) → duplicate name
  • viam machines part add-job --part= --attributes 'not json at all' → invalid JSON

Working (created successfully):

  • viam machines part add-job --part= --attributes '{"name":"t-continuous","schedule":"continuous","resource":"x","method":"DoCommand"}'
  • viam machines part add-job --part= --attributes '{"name":"t-duration","schedule":"1h30m","resource":"x","method":"DoCommand"}'
  • viam machines part add-job --part= --attributes '{"name":"t-cron5","schedule":"0 0 * * *","resource":"x","method":"DoCommand"}'
  • viam machines part add-job --part= --attributes '{"name":"t-cron6","schedule":"*/5 * * * * *","resource":"x","method":"DoCommand"}'
  • viam machines part add-job --part= --attributes
    '{"name":"t-loglevel","schedule":"5s","resource":"x","method":"DoCommand","log_configuration":{"level":"debug"}}'

update-job

Validated (rejected with error):

  • viam machines part update-job --part= --name=nonexistent --attributes '{"schedule":"10s"}' → job not found
  • viam machines part update-job --part= --name=update-test --attributes '{"schedule":"garbage"}' → invalid schedule
  • viam machines part update-job --part= --name=update-test --attributes '{"resource":""}' → empty resource
  • viam machines part update-job --part= --name=update-test --attributes '{"method":""}' → empty method
  • viam machines part update-job --part= --name=update-test --attributes '{"command":"bad"}' → command not a JSON object
  • viam machines part update-job --part= --name=update-test --attributes '{"log_configuration":{"level":"verbose"}}' → invalid log level

Warned (updated with warning):

  • viam machines part update-job --part= --name=update-test --attributes '{"resource":"fake-sensor"}' → resource not found in config
  • viam machines part update-job --part= --name=update-test --attributes '{"method":"docommand"}' → method not PascalCase

Working (updated successfully):

  • viam machines part update-job --part= --name=update-test --attributes '{"schedule":"10s"}'
  • viam machines part update-job --part= --name=update-test --attributes '{"log_configuration":{"level":"warn"}}'

delete-job

Validated (rejected with error):

  • viam machines part delete-job --part= --name=nonexistent → job not found

Working (deleted successfully):

  • viam machines part delete-job --part= --name=update-test

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Feb 10, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 11, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 11, 2026
@allisonschiang allisonschiang marked this pull request as ready for review February 11, 2026 05:37
@allisonschiang allisonschiang requested a review from a team as a code owner February 11, 2026 05:37
@allisonschiang allisonschiang marked this pull request as draft February 12, 2026 17:20
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 23, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 23, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 23, 2026
Name: generalFlagPart,
Aliases: []string{generalFlagPartID, generalFlagPartName},
Required: true,
// partFlags builds the standard part/org/location/machine flag set.
Copy link
Member Author

Choose a reason for hiding this comment

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

if we want users to be able to input part id within the interactive huh form, we need to create a wrapper around the commonPartFlags so it can take part-id as an optional input (and won't instantly reject add-job if there's no part-id)

}

// parseJSONOrFile tries to read input as a file, falls back to parsing as inline JSON
func parseJSONOrFile(input string) (map[string]any, error) {
Copy link
Member Author

@allisonschiang allisonschiang Feb 23, 2026

Choose a reason for hiding this comment

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

will use the updated enable/disable resource parseJSONOrFile here (with the updated error msg)

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 23, 2026
Usage: "add a scheduled job to a machine part",
Description: `Add a scheduled job that runs a method on a resource at a given interval.

With --attributes, pass a single JSON object (inline or path to a JSON file) with:
Copy link
Member Author

Choose a reason for hiding this comment

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

should I delete the description for using the -attributes tag if we want to encourage the interactive flow? viam module generate doesn't advertise the flag path

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 23, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 24, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 24, 2026
@allisonschiang allisonschiang marked this pull request as ready for review February 24, 2026 16:24
@allisonschiang allisonschiang requested a review from a team as a code owner February 24, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test This pull request is marked safe to test from a trusted zone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants