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

configurable timeout and delay values #61

Merged
merged 8 commits into from
Jul 23, 2024
Merged

Conversation

gnarf
Copy link
Contributor

@gnarf gnarf commented Jul 15, 2024

Fixes #49

Posting this up to check on the approach / acceptability from @jugglinmike


@gnarf gnarf requested a review from jugglinmike July 15, 2024 19:04
Copy link
Contributor

@jugglinmike jugglinmike left a comment

Choose a reason for hiding this comment

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

This approach, while compact, offers only minimal documentation of a bespoke sub-syntax. I think we ought to treat each value like a first-class option. Doing so will significantly expand the size of the patch, but I'm trying to keep the spirit of the change in mind.

@gnarf
Copy link
Contributor Author

gnarf commented Jul 16, 2024

This approach, while compact, offers only minimal documentation of a bespoke sub-syntax. I think we ought to treat each value like a first-class option. Doing so will significantly expand the size of the patch, but I'm trying to keep the spirit of the change in mind.

The formatting of yargs "describe" was a true pain also, you can't really setup newlines/it breaks text willy nilly in the middle of words, etc. Each as it's own option would actually make for a better --help --show-hidden as well. I'll work on this.

@gnarf
Copy link
Contributor Author

gnarf commented Jul 17, 2024

  --time-after-nav            Timeout used after navigation to collect and disca
                              rd speech.                         [default: 1000]
  --time-after-keys           Timeout used to wait for speech to finish after pr
                              essing keys.                       [default: 5000]
  --time-test-setup           Timeout used after pressing test setup button to c
                              ollect and discard speech.         [default: 1000]
  --time-mode-switch          Timeout used after switching modes to check result
                              ing speech (NVDA).                  [default: 750]
  --time-doc-ready            Timeout used waiting for document ready (Safari).
                                                                 [default: 2000]

Comment on lines 23 to 32
/**
* Convert from 'afterNav' to 'time-after-nav'.
* @param {keyof AriaATCIShared.timesOption} optionName
* @returns string
*/
function makeSnakeCasedOption(optionName) {
const snakeCased = optionName.replace(/[A-Z]/g, cap => '-' + cap.toLowerCase());
const optionText = `time-${snakeCased}`;
return optionText;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I kinda have a thing for grep-able source code. I'd much rather maintain a bit of redundancy (e.g. an argument list like "afterNav", "time-after-nav") than an abstraction like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pushed this change in

Comment on lines 7 to 16
/**
* @type AriaATCIShared.timesOption
*/
export const timesOption = {
afterNav: 1000,
afterKeys: 5000,
testSetup: 1000,
modeSwitch: 750,
docReady: 2000,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Stateful modules are a source of tech debt in my experience. This clearly works for our current needs, but at some point in the future (e.g. when we go to write a new kind of test or re-use something), the timesOption singleton may make the change more involved than if we had explicitly passed the value around to begin with. Think we can treat these values a little more like the rest of the command-line arguments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's possible, the reason I was sort of avoiding it is this would necessitate passing these options into modules everywhere, I feel like the usability/dev experience of adding a timeout to it in the future might be pretty large. I'll do this as a separate commit to kind of weigh it out (not having done it yet, it might not be "that bad")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the end this didn't feel too terrible. ea8d351

Copy link
Contributor

@jugglinmike jugglinmike left a comment

Choose a reason for hiding this comment

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

This looks great, Corey! Just one typo and then I'll be happy to merge for ya.

/**
* Convert the times dictionary to an array of strings to pass back to args.
* @param {AriaATCIShared.timesOption} opts
* @returns [string]
Copy link
Contributor

Choose a reason for hiding this comment

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

[string] means "an array with exactly one string element"; what we want here is

Suggested change
* @returns [string]
* @returns {string[]}

(The compiler isn't flagging this right now, presumably due to the absence of curly braces. I guess it considers that "not JSDoc" rather than "invalid JSDoc".)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops! thanks! (still not super used to the jsdoc format)

@gnarf gnarf requested a review from jugglinmike July 23, 2024 17:25
Copy link
Contributor

@jugglinmike jugglinmike left a comment

Choose a reason for hiding this comment

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

Good going--thanks, @gnarf!

@jugglinmike jugglinmike merged commit 9ef800c into w3c:main Jul 23, 2024
4 checks passed
@jugglinmike jugglinmike deleted the times-option branch July 23, 2024 22:25
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.

Expose 'mode switch timeout' as a command-line argument
2 participants