Skip to content

Conversation

@sgithens
Copy link
Member

@sgithens sgithens commented Dec 13, 2019

Removal of invariant path information from a settings capabilities transforms. Removes the need for cludgy windows workarounds when snapshotting and reading settings. Also makes more sense.

This PR should be considered a prerequisite for GPII-228 (snapshotting) as it fixes the crashes from missing SPI settings data.

@sgithens sgithens changed the title Gpii 3119 part2 GPII-3119 SPI Settings Refactor for Lookup Paths Dec 13, 2019
@sgithens sgithens requested review from amb26, cindyli and stegru December 13, 2019 01:59
@gpii-bot
Copy link

CI job failed: https://ci.gpii.net/job/universal-tests/2047/

@cindyli
Copy link
Contributor

cindyli commented Dec 13, 2019

@sgithens, thanks for solving this long pending issue. Please fix the failing browser tests.

@gpii-bot
Copy link

CI job passed: https://ci.gpii.net/job/universal-tests/2048/

@cindyli
Copy link
Contributor

cindyli commented Dec 16, 2019

This pull request looks good to me.

@amb26, @stegru, what do you think?

Its accompanying windows repo pull request is GPII/windows#289.

@sgithens
Copy link
Member Author

sgithens commented Jan 8, 2020

@cindyli @stegru @amb26 Any more thoughts on this one? I think it should be a fairly clean fix, albiet with a lot of json updates.

@amb26
Copy link
Member

amb26 commented Jan 8, 2020

I don't understand why the path went into supportedSettings rather than options. It is not actually a supported setting at all. Also, the stray "undefined" mouse droppings in the test cases should be cleaned up.

@sgithens
Copy link
Member Author

sgithens commented Jan 8, 2020

The options area contains the configuration for the entire instance of the particular settings handler entry. This path information is specific to each of the supported settings for the configuration, so it seems like the natural place for it to go, rather than creating another hash of supported settings keys inside the options block. Also, it happens to work out very smoothly because the transforms put the information in supported settings in to the same location where the get and set implementation methods where previously expecting the path information.

For the undefined entries in the test cases, they oddly needed to be left in, because there are a few (well at least one) methods in the lifecycle handler that are documented in their jsdoc to change their output with undefined as a valid input, which is what the test cases were expecting for their output.

I don't understand why the path went into supportedSettings rather than options. It is not actually a supported setting at all. Also, the stray "undefined" mouse droppings in the test cases should be cleaned up.

@amb26
Copy link
Member

amb26 commented Jan 8, 2020

OK, sorry I misread the nesting structure of the "supportedSettings" block. The "undefined" business still seems cabberwonky though, there are indeed places in the LM where we are sensitive to undefined vs no key, but this shouldn't be one of them. We should either i) fix up the site in the LM where we do the assignment so that it doesn't create the mouse dropping (preferred), or ii) fix up the tests so that they use some mechanism such as jqUnit.assertLeftHand or jqUnit.assertCanoniseEqual so that they are insensitive to the dropping.

@sgithens
Copy link
Member Author

sgithens commented Jan 8, 2020

Cool, I will take a look at the usage of that method in the unit tests.

Also, I hope this thread is indexed by search indexes for usage of the term cabberwonky

@gpii-bot
Copy link

gpii-bot commented Jan 9, 2020

CI job passed: https://ci.gpii.net/job/universal-tests/2071/

@sgithens
Copy link
Member Author

sgithens commented Jan 9, 2020

@amb26 Ok, I cleaned up the undefined supportedSettings and this should be ready for another review.

@gpii-bot
Copy link

CI job passed: https://ci.gpii.net/job/universal-tests/2073/

@sgithens
Copy link
Member Author

@amb26 @cindyli @stegru Any additional thoughts on this? If possible I'd like it to go in soon before anyone makes changes to solutions with SPI settings or adds new ones.

@cindyli
Copy link
Contributor

cindyli commented Jan 21, 2020

This pull request looks good to me.

@amb26, @stegru what do you think?

Fixed merge conflict in gpii/node_modules/transformer/test/TransformerTests.js
@gpii-bot
Copy link

CI job passed: https://ci.gpii.net/job/universal-tests/2090/

@sgithens
Copy link
Member Author

Updated and fixed merge conflict

@gpii-bot
Copy link

CI job passed: https://ci.gpii.net/job/universal-tests/2106/

@sgithens
Copy link
Member Author

@amb26 @cindyli Do we think this is ready to be merged now, along with it's sister PR in gpii-windows? GPII/windows#289

@amb26 amb26 merged commit 957c992 into GPII:master Jan 29, 2020
@amb26
Copy link
Member

amb26 commented Jan 29, 2020

Hi, I merged this by accident, until I thought properly - we can't commit this yet because it makes a backwards-incompatible change to the structure of the solutions registry. Before we can do this, we need a robust solution to what we do when an old client requests SR entries from the cloud and ends up with this one, which implies that we need to add a version field into the SR, as well as one into each client matchmaking request, and implement a facility to translate modern SR entries back into arbitrarily ancient ones using some kind of "transforming chain". Without this, such an update will BREAK THE WORLD ...

@amb26
Copy link
Member

amb26 commented Jan 29, 2020

I've filed the blocking issue as https://issues.gpii.net/browse/GPII-4329 - please reopen this PR

"properties": {
"schema": { "$ref": "gss-v7-full#", "required": true }
"schema": { "$ref": "gss-v7-full#", "required": true },
"path": {
Copy link
Member

Choose a reason for hiding this comment

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

This seems like an inappropriate place to put this. As it stands you're basically saying that any setting might have a path, and that it has to be either a string or object. The individual settings should define the fact that they use the path.

I'd also argue that you could be a lot more specific than just accepting an object. I assume we know what properties such an object would have, i. e. we can only accept get and set, and it must have both of them to be a usable object. I realise that this results in a lot of repeated boilerplate, but this will go away with the LSR work, where we can have a grade for all SPI settings where we express this once.

}
}
},
"path": "pvParam"
Copy link
Member

Choose a reason for hiding this comment

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

We should maybe discuss this in our next meeting, I think with a little work this could be a very positive change. Right now, the schema still allows path, but you'd in essence ignore that and clobber it with whatever was defined as an "option" outside of the schema. That seems a bit dishonest, we should not advertise path as anything the user can control if we're gonna ignore them.

I'd argue that if you're gonna do this, you should go ahead collapse the value property as well, so that the transforms can either be removed or just become a simple map of (legacy) user-facing settings to settings-handler-facing settings.

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.

5 participants