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

Update commands.json file to commandsV1.js #936

Closed
wants to merge 3 commits into from

Conversation

Paul-Clue
Copy link
Collaborator

@Paul-Clue Paul-Clue commented Feb 26, 2024

see issue #868

This PR updates all of the commands.json files to commandV1.json in order to make it clear what version of commands are being used.


Copy link
Contributor

@alflennik alflennik left a comment

Choose a reason for hiding this comment

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

Hey, great job Paul with this large-scale refactor (!!), I see you were able to figure out which command-related variables needed to change and which were irrelevant, which is absolutely not obvious and goes way beyond a find-replace. Big props for that.

I was able to import tests, run them, and see the test result summaries. Looks like the changed systems are all working.

I do have a few thoughts scattered around, nothing too big, but nice to see you coming through with a big PR like this.

@@ -327,7 +327,7 @@ const updateJsons = async () => {
JSON.stringify(flattenObject(commandsV2Parsed), null, 4)
);
} catch (error) {
console.error('commands.json for v2 test format may not exist');
console.error('commandsV1.json for v2 test format may not exist');
Copy link
Contributor

Choose a reason for hiding this comment

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

This message doesn't really make sense!

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, it could (should?) say commandsV2.json does not exist instead or some variation of that.

"id": "Z",
"text": "Z"
}
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the commands.json file? It is unused and liable to cause confusion

@@ -92,7 +92,7 @@ export class commandsAPI {
command = keys[command];
if (typeof command === 'undefined') {
throw new Error(
`Key instruction identifier "${c}" for AT "${assistiveTech.name}", mode "${mode}", task "${task}" is not an available identifier. Update your commands.json file to the correct identifier or add your identifier to resources/keys.mjs.`
`Key instruction identifier "${c}" for AT "${assistiveTech.name}", mode "${mode}", task "${task}" is not an available identifier. Update your commandsV1.json file to the correct identifier or add your identifier to resources/keys.mjs.`
Copy link
Contributor

Choose a reason for hiding this comment

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

@howard-e correct me if I'm wrong but this is not definitively a v1 only issue, so this message should say "commandsV1.json or commandsV2.json" right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well the tests/commands.json is for controlling the defining keys used in v2 while tests/resources/keys.mjs is where the v1 key commands are defined (and then translated later on to some json).

So unless we're renaming the commands.json to commandsV2.json to make things clearer, this message can stay as is.

If that does get updated though, I think it would be preferred to have a context aware error message depending on the version, to avoid that general statement.

@@ -111,7 +111,7 @@ export class commandsAPI {
const commandKVs = this.findValuesByKeys([commandId]);
if (!commandKVs.length) {
throw new Error(
`Key instruction identifier "${commandId}" for AT "${assistiveTech.name}", mode "${mode}", task "${task}" is not an available identifier. Update your commands.json file to the correct identifier or add your identifier to tests/commands.json.`
`Key instruction identifier "${commandId}" for AT "${assistiveTech.name}", mode "${mode}", task "${task}" is not an available identifier. Update your commandsV1.json file to the correct identifier or add your identifier to tests/commandsV1.json.`
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

@@ -1,4 +1,4 @@
const commands = require('../../resources/commands.json');
const commands = require('../../resources/commandsV1.json');
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you call this commandsV1 to be symmetrical with commandsV2?

@@ -126,8 +126,8 @@ export async function loadCollectedTestAsync(testRoot, testFileName) {
const collectedTestResponse = await fetch(`${testRoot}/${testFileName}`);
const collectedTestJson = await collectedTestResponse.json();

// v2 commands.json
const commandsJsonResponse = await fetch('../commands.json');
// v2 commandsV1.json
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this comment makes much sense. Is this a hint that there might be an issue with this particular change? Maybe you can explain to me what's happening here?

@@ -126,8 +126,8 @@ export async function loadCollectedTestAsync(testRoot, testFileName) {
const collectedTestResponse = await fetch(`${testRoot}/${testFileName}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

An important note is that any changes to the aria-at-harness.mjs and any other files in this folder will also need a corresponding PR over on the aria-at repo. So go ahead and open a PR over there as well, and feel free to reach out if I can clarify how that works.

@@ -309,14 +309,14 @@ const updateJsons = async () => {

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you rename commands on line 306 to commandsV1Parsed to make it clear that this variable is equivalent to the variable below called commandsV2Parsed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed

@Paul-Clue
Copy link
Collaborator Author

I reverted all changes made to any of the .mjs files. As I understand it, changes won't be necessary there.

Copy link
Contributor

@howard-e howard-e left a comment

Choose a reason for hiding this comment

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

There's still some changes here that would require creating a separate PR on w3c/aria-at. That is everything that is any change inside client/resources/*

@@ -17,7 +17,7 @@ import {
} from '../../../resources/aria-at-test-io-format.mjs';
import { TestWindow } from '../../../resources/aria-at-test-window.mjs';
import { evaluateAtNameKey } from '../../../utils/aria.js';
import commandsJson from '../../../resources/commands.json';
import commandsJson from '../../../resources/commandsV1.json';
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a v2 commands file. Files that look like the following is v2

@@ -25,7 +25,7 @@ import OutputTextArea from './OutputTextArea';
import AssertionsFieldset from './AssertionsFieldset';
import UnexpectedBehaviorsFieldset from './UnexpectedBehaviorsFieldset';
import supportJson from '../../resources/support.json';
import commandsJson from '../../resources/commands.json';
import commandsJson from '../../resources/commandsV1.json';
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a v2 commands file

);

try {
// Commands path info for v2 format
const commandsV2Path = pathToFileURL(
path.join(testsDirectory, 'commands.json')
path.join(testsDirectory, 'commandsV1.json')
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be commandsV2.json. But for this change to be valid, a PR on aria-at must also move aria-at/tests/commands.json to aria-at/tests/commandsV2.json, otherwise this path is invalid and subsequent imports would be wrong.

@@ -327,7 +327,7 @@ const updateJsons = async () => {
JSON.stringify(flattenObject(commandsV2Parsed), null, 4)
);
} catch (error) {
console.error('commands.json for v2 test format may not exist');
console.error('commandsV1.json for v2 test format may not exist');
Copy link
Contributor

Choose a reason for hiding this comment

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

Right, it could (should?) say commandsV2.json does not exist instead or some variation of that.

@howard-e howard-e changed the base branch from main to development April 4, 2024 22:25
@howard-e
Copy link
Contributor

Overwritten by changes in #1064

@howard-e howard-e closed this May 20, 2024
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.

3 participants