-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add versioning #692
base: master
Are you sure you want to change the base?
Add versioning #692
Conversation
If a save file cannot be loaded, no changes happen to the pipeline and the user is notified. This will happen for any save file, pre-versioning or otherwise. When saving a loaded project, the original version string will be changed to the version of GRIP that saved it. Pre-versioning save files will also be upgraded to the versioned format and have the current version of GRIP
80a6f26
to
f3a0f53
Compare
Codecov Report
@@ Coverage Diff @@
## master #692 +/- ##
============================================
+ Coverage 52.35% 52.68% +0.33%
- Complexity 1134 1173 +39
============================================
Files 240 249 +9
Lines 7724 7909 +185
Branches 526 540 +14
============================================
+ Hits 4044 4167 +123
- Misses 3494 3545 +51
- Partials 186 197 +11 Continue to review full report at Codecov.
|
e.g. trying to generate code with operations that don't support it Post a WarningEvent to the eventbus and an alert dialog will appear. The alert supports markdown formatting for the body text.
Loading a file (.grip or otherwise) should never throw a fatal exception now
JavaFX webview is a mess.
Put the version as an attribute of the project rather than an XML entry.
Does this really have to use inheritance to solve this problem? |
This class does need a serious refactor, though
@@ -60,6 +64,7 @@ | |||
/** | |||
* The Controller for the application window. | |||
*/ | |||
@SuppressWarnings("PMD.GodClass") // temporary |
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.
Add an issue to track this or make sure that this isn't in the final version you want to merge.
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.
There's already an issue open for this
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.
Just adding some comments. I don't know what state this is in but I figured I'd provide some feedback for while you are working on it.
@Override | ||
@SuppressWarnings("PMD") | ||
protected void cleanUp() { | ||
// Default to NOP |
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.
Why not make this a default method?
baseRequest.setHandled(true); | ||
} catch (InvalidSaveException e) { | ||
// 406 - Not Acceptable if given an invalid save | ||
response.setStatus(HttpServletResponse.SC_NOT_ACCEPTABLE); |
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.
Maybe attach a header that contains the message from the exception?
if (!inDeserialization) { | ||
throw new IllegalStateException( | ||
"This method may only be called during project deserialization"); | ||
} |
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.
Why not just make this package private? Or hide it in some other way?
* Pool of used IDs. | ||
*/ | ||
@VisibleForTesting | ||
static class IdPool extends HashMap<Class<? extends PipelineEntry>, Set<String>> { |
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.
Guava has a type for this:
https://github.com/google/guava/wiki/NewCollectionTypesExplained#implementations
checkDuplicates(operationData, "socket IDs", sockets, Socket::getUid); | ||
} finally { | ||
operation.cleanUp(); | ||
} |
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.
Not a huge fan of creating an operation when the user hasn't asked the UUID to create one.
Perhaps put this into a test that loads every operation?
* | ||
* @throws NoSuchElementException if there is no socket with the given UID, | ||
*/ | ||
Socket getSocketByUid(String uid) throws NoSuchElementException; |
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.
Perhaps using the UUID type would be nice.
Never mind. I understand now.
Is there some sort of launch time guarantee of being unique?
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.
Part of the contract is that the socket ID has to be unique within its parent
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.
Can you add a unit test that guarantees this contract for all operations?
@@ -24,7 +24,7 @@ | |||
* sockets, and it runs the operation whenever one of the input sockets changes. | |||
*/ | |||
@XStreamAlias(value = "grip:Step") | |||
public class Step { | |||
public class Step extends AbstractPipelineEntry { |
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.
Why not use composition instead of inheritance?
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, view, or even the type changes, the UID has to be constant in order for projects | ||
* saved from different versions of GRIP to be compatible. | ||
* | ||
* @implSpec <strong>This value MAY NOT change</strong> |
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.
This value MUST NOT EVER change
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.
Why is this on the socket and not the socket hint?
@@ -87,10 +85,10 @@ | |||
GripServer server, | |||
ContextStore store, | |||
@Assisted String path) { | |||
super(exceptionWitnessFactory); | |||
super(makeId(HttpSource.class), exceptionWitnessFactory); |
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.
Why do you need this duplicate code in every source?
Why not just have the super constructor pull this information?
+ " <connections/>\n" | ||
+ " <settings/>\n" | ||
+ " </grip:Pipeline>" | ||
+ "</grip:Project>"; |
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.
This makes me wish for kotlin multiline strings:
https://kotlinlang.org/docs/reference/basic-types.html#string-literals
If a save file cannot be loaded, no changes happen to the pipeline and the user is notified. This will happen for any save file, pre-versioning or otherwise.
When saving a loaded project, the original version string will be changed to the version of GRIP that saved it. Pre-versioning save files will also be upgraded to the versioned format and have the current version of GRIP
This depends on #693 for user alerts