oxidecomputer / oxidecomputer/humility

humility flash could have an idempotent mode

Open
#410 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
584
Forks
63
Avg merge
3h
Merged PRs (30d)
2

Description

As noted in #408, during manufacturing we are doing something suboptimal:

if ! humility flash --check; then
        printf 'contents incorrect; programming...\n'
        if ! humility flash --verify; then
                printf 'programming failed!\n'
                exit 1
        fi
fi
printf 'ok\n'

In the event that the flash contents are already correct, flash --check will return success and we drive on.

In the event that the flash contents are not already correct, the check fails and we move on to flash --verify which then performs the same check again before eventually programming.

The reason we use this sequenced is that (as far as I can tell) flash --verify, like flash, will fail execution if the flash contents is already correct and we didn't have to do any work. This strict execution makes sense under some conditions; I can definitely imagine cases where I believed I was replacing the flash contents with something new, but it turns out I was mistaken. For manufacturing, though, what we really want is:

if ! humility flash --idempotent; then
        printf 'problems!\n'
        exit 1
fi

This would still include all of the checks that --check and --verify already perform today (i.e., the flash contents, not just the image ID, are verified) but it would exit successfully after the initial check if the contents are already as they should be.

If we don't want to use --idempotent, then perhaps a verb like --ensure would also capture the intent.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the humility flash command and compare the existing --check and --verify paths. Implement the requested idempotent behavior so an already-correct flash succeeds without programming while retaining the existing content checks; done means the documented humility flash --idempotent flow reports success in that case and failure on problems.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.