-
-
Notifications
You must be signed in to change notification settings - Fork 556
Meta: adding new keys to the schema #1496
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
Comments
Perhaps to address the first point it would be useful to know which tracks have generators that would stop working when solely adding keys (without changing the existing ones). Wouldn't break:
Would break: Unsure (from #1411):
(feel free to edit my comment to move tracks around in the list) |
@SaschaMann Great suggestion! |
Pharo (Smalltalk) has a reasonably comprehensive (although slightly hacked) generator that wouldn’t break by addition. I’ve been trying to normalise inconsistent specs where I’ve encountered my generated exercises weren’t great (and am curious how the current generators handled them - allergies and etl were recent ones). I’d love some extra flags to use as hints. I currently treat exceptions specially - I have to look for an expected map with a single key of ‘error’ and then generate an exception check instead of an equality one. I didn’t manage to handle clock very well with its instance equality comparison (I badly generated an isEqual(dict1,dict2) type call against the model instead of: assertEquals(clock1, clock2). I also name test cases by concatenating subsequent levels of case descriptions - which works ok, but some cases are very long and often repetitive. Fortunately Pharo doesn’t mind 100+ char method names ;) Some of the input variable names are not ideal , and some conventions around what would be a Boolean sounding property are not great. I’m 25 exercises in - spot checked ~20 more but the others might well reveal more useful flags. Sent with GitHawk |
@sshine You've responded in #1225 that you prefer comments because of what @coriolinus , which seems to be "because it's ambitious and might break current generators". Does this mean you have a generator that breaks? |
@SleeplessByte: I should have been more clear: Because property based test frameworks [...] have a programmatic interface. |
👍 @sshine So is that instead of adding new flags, or on top of new flags. |
I'm a little confused as to the status of this issue. @sshine is it correct to say that you are not in favor of adding new flags/keys to the schema? |
I, personally, would be in favor of adding new flags/keys to the schema, as it seems the only way to support the kind of flexibility that we require at the track level (individual tracks want to include/exclude selectively). While this would potentially break some generators, I am of the firm opinion that generators should be able to handle new keys by ignoring them, and if we're breaking because of that, it's worth fixing. |
Thanks for chipping in with your thoughts @kytrinyx! If I look at the comments in this issue, it seems like most people don't mind adding new keys to the schema. I'd really like to move forward with this issue, as there are other issues that depend on its resolution. @sshine you seem to be the person most hesitant to add new fields. Is that correct? |
As people have had ample time to respond, the general consensus (including @kytrinyx) is that adding new fields is a good thing, when done judiciously. As such, I believe this issue can be closed. If you feel otherwise, feel free to re-open. |
There's a 2nd step in the first comment of the issue, so I think it should stay open:
|
Ah right! Thanks for catching that. My preference would be to add the |
Bump. Are there other keys that people want to add to the schema? |
Is this flags for the whole exercise or individual tests? For individual tests, an “exception” tag and “equality” tag would disambiguate (the latter - Clock is an example where I believe you want to compare the object and not it’s string output on some tests). Tests with exceptions gives a hint to catch vs equal. |
I'm not sure I understand this. Could you give an example? |
All the linked issues in the top post are about individual tests, but I don't see a reason why adding something to the exercise as a whole would be different.
Errors are already marked in a distinct way: "expected": {
"error": "You should never bar a number"
} |
Not sure about the best practices for this case. Is it better to have one branch that all changes are pushed to that will then be merged? Multiple branches that will be merged at the same time to master? |
I think this is the preferred way to go. |
@ErikSchierboom, @SleeplessByte: Sorry I didn't get back to you, personal matters came in the way. I think you and @SaschaMann have picked an excellent candidate from the discussion and I look forward to seeing #1518 merged. Reading back, it seems that the lack of my response was keeping this issue open. If I read @macta's comments, they seem to come with examples where the proposed key of #1518 would be compatible. |
No worries!
I've added you as a secondary reviewer of #1518. If you don't feel like it, feel free to ignore this. |
This was my intention, or at least in close succession.
We all have lives! Don't worry about it. I just wasn't sure if you were in favour, against or something else :) |
To address the last suggested key in the first post (it doesn't have its own issue, if it gets too cluttered we can open one, tho):
I'm wondering if there are any exercises that contain both multiline strings and arrays of strings. If not, I don't think an extra property would be necessary, but I'm not opposed to it if it means that some generators require less adjustments for specific exercises. |
I currently search If we don't want to add a property, that's fine :) |
How many of those exercises are there? |
And then there is |
|
Alright, that makes 8 exercises. Maybe an additional keys would be useful then. Any suggestions? |
Tournament is already an issue currently as its comment is distinct from the others. I don't have great suggestion for the key :p |
|
@SleeplessByte Do you have any suggestions? |
Another key type you might consider is "constructor input" - but not sure how to easily shoe-horn this in... I'm specifically thinking about problems like "Matrix" - where the data looks like:
and also a column version
So in fact the In the examples, its not always clear (without intervention) if both inputs are related to the provided property, or if one of them is actually a property of an object... as sometimes they do relate to the property. e.g. Do we expect a test like (different languages presented):
or
As it stands, its harder to work out at a more generic level that I'm sure most languages can work at without having to specifically customize generation on an problem by problem basis. |
I think my comment above is somewhat related to CircularBuffer - which tries to address a similar problem by defining a subset of operations. For matrix above, the row or column specifications are "operations" in circular buffer parlance. Things outside of the operations, are attributes of an object or struct? |
I think this is the key issue here, as many (functional) languages don't usually work with constructors. I'm a bit hesistant to split up the input into two parts: regular input, and constructor input. In the C# generators, I just manually define which properties are to be constructor properties. This works fine, although it is dependent on the property names not changing, but I've not found this to be an issue. |
I agree with @ErikSchierboom -- this is probably something a generator should ask. But perhaps we can be smart about naming? |
This is definitely an option. It might also be an option to group those "constructor" properties in a separate object. This is supported by the spec. Getting back to this issue, we now have two proposed new keys:
Is that correct? |
That's the multiline string thing right? I think that's correct! Maybe we should think about things that are interesting across languages which is encoding for string and size for numbers... We've declined quite a few PRs because we didn't want to add these to the problem description in favor of having specific exercises dealing with them, but languages with correct codepoint support or bigint by default would be able to have these test cases. |
We can model these using the |
Is there something we need to discuss before It covers |
I think you're referring to #1518, right? If so, I'm fine with merging that PR and then opening new PR's for any other fields. |
As long as we merge them in close succession (field proposals), we reduce the burden on generator maintainers. |
But have I understood correctly that the multi-line problem does not have a proposal yet? |
I think that is correct.
Is it that much of a burden though? I assume that most generators use a JSON library that will happily ignore added fields, so adding them one by one does then not impose more maintenance than adding them in rapid succession. |
Except that we allocate time in our day/week/month to work on this and a context switch is not free, nor cheap. (I agree with both of you on the rest tho :) ) Let's just set a date. I want this all to move forward. It seems we have a few great new additions and proposals. I would like us to check out #1473 and just merge as much as possible in batches. |
Fine by me! |
I've changed the title to be a meta discussion, so that we don't have the same discussion in multiple issues:
f(inputs) = output
. What of other types of tests? #1225It seems there really is a lot of ask for new fields and there also seems to be a notion that we don't want to break the current generators.
Personally, I am currently parsing the comments for special behaviour and this means that my generators will all break when someone decides the comments should be a special format. I can derive no special meaning from the english in these comments. I don't think this is the right place to hold special cases, but it is for things not covered in the current scheme.
I know that you (@pgaspar @ErikSchierboom @coriolinus @sshine @SaschaMann and @NobbZ) are all involved with writing and maintaining the generators, or at least the discussions on GitHub:
Original issue about multiline.
There is canonical data such as
food-chain
andtwelve-days
that correctly comment:Okay, that's great! But in this case I think it would be great if we'd add a meta property (and keep a list of those, as there are more like these (such as a property preferably being a constant or at least immutable) so that we can automate generation of these exercises.
The text was updated successfully, but these errors were encountered: