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

Add versioning #692

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

SamCarlberg
Copy link
Member

@SamCarlberg SamCarlberg commented Oct 26, 2016

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

@SamCarlberg SamCarlberg added this to the v2.0.0 milestone Oct 26, 2016
@SamCarlberg SamCarlberg self-assigned this Oct 26, 2016
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
@codecov-io
Copy link

codecov-io commented Oct 26, 2016

Codecov Report

Merging #692 into master will increase coverage by 0.33%.
The diff coverage is 74.3%.

@@             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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0eb6ce4...51915a9. Read the comment docs.

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.
@JLLeitschuh
Copy link
Member

Does this really have to use inheritance to solve this problem?
I'm not really a fan of putting a AbstractPipelineEntry in the inheritance hierarchy of Step.
Let's chat about this.

@AustinShalit AustinShalit modified the milestones: v2.0.0, v1.5.0 Nov 7, 2016
@SamCarlberg SamCarlberg modified the milestones: Future, v1.5.0 Nov 8, 2016
@AustinShalit AustinShalit modified the milestones: v2.0.0, Future Dec 25, 2016
@@ -60,6 +64,7 @@
/**
* The Controller for the application window.
*/
@SuppressWarnings("PMD.GodClass") // temporary
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

@JLLeitschuh JLLeitschuh left a 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
Copy link
Member

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);
Copy link
Member

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");
}
Copy link
Member

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>> {
Copy link
Member

Choose a reason for hiding this comment

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

checkDuplicates(operationData, "socket IDs", sockets, Socket::getUid);
} finally {
operation.cleanUp();
}
Copy link
Member

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;
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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 {
Copy link
Member

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?

Copy link
Member

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>
Copy link
Member

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

Copy link
Member

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);
Copy link
Member

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>";
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants