-
Notifications
You must be signed in to change notification settings - Fork 75
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
Warn about <2024.1 entities spec and update tests #1272
base: master
Are you sure you want to change the base?
Conversation
I do think that we'll want to translate it. I think we translate other workflow warnings. In general, we want to translate most warnings or errors that a user could trigger by user error. (There's getodk/central#489 to do more of that for errors.) |
let warnings; | ||
if (semverSatisfies(version.get(), '<2024.1.x')) | ||
warnings = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's nice to avoid a let
where possible. How about const
+ a ternary?
const warnings = semverSatisfies(version.get(), '>=2024.1.x')
? null
: {
type: 'oldEntityVersion',
// ...
};
let warnings; | ||
if (semverSatisfies(version.get(), '<2024.1.x')) | ||
warnings = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name warnings
in the plural makes me think that it should be an array. Just a thought, I also wouldn't mind leaving it as-is until we have a second warning.
|
||
if (dataset.isDefined() && dataset.get().warnings != null) { | ||
if (!context.transitoryData.has('workflowWarnings')) context.transitoryData.set('workflowWarnings', []); | ||
context.transitoryData.get('workflowWarnings').push(dataset.get().warnings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make warnings
an array:
context.transitoryData.get('workflowWarnings').push(dataset.get().warnings); | |
context.transitoryData.get('workflowWarnings').push(...dataset.get().warnings); |
@@ -134,6 +134,7 @@ const createNew = (partial, project) => async ({ Actees, Datasets, FormAttachmen | |||
|
|||
// Check for xmlFormId collisions with previously deleted forms | |||
await Forms.checkDeletedForms(partial.xmlFormId, project.id); | |||
await Forms.checkDatasetWarnings(parsedDataset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that the lines above and below this one use await
, but if Forms.checkDatasetWarnings()
doesn't need to be async and return a promise, I think it'd be nice to remove the await
. I think code is often clearer when things can be done sync.
Closes getodk/central#730
I updated the versions in
testData.forms.simpleEntity
andtestData.forms.updateEntity
so the tests didn't have to change, but for any test that expected the older version, I also made test formstestData.forms.simpleEntity2022
andtestData.forms.updateEntity2023
and used those (along with?ignoreWarnings=true
) where appropriate.I need to take a closer look at how frontend expects warnings. I wrote the nice text "Entities specification version [2023.1.0] is not compatible with Offline Entities. Please use version 2024.1.0 or later.'" in the warning but it's probably not in a place frontend can find it, and we might want to translate it anyway.
What has been done to verify that this works as intended?
Why is this the best possible solution? Were any other approaches considered?
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.
Before submitting this PR, please make sure you have:
make test
and confirmed all checks still pass OR confirm CircleCI build passes