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

simplifies transaction response parse, fixes path/nodes bug #249

Merged
merged 3 commits into from
Feb 3, 2016

Conversation

subvertallchris
Copy link
Contributor

This fixes neo4jrb/activegraph#1125 and, in the process, simplifies our handling of responses from transactions.

Neo4j Server provides different JSON formats. When returning data from the legacy Cypher endpoint, you get an arrays of data in what they call REST format, which contains everything we need: metadata (labels, type, id) and properties. When returning from the transactional endpoint, you get... I don't remember what the default is called, but it doesn't give us what we need, so we also tell it to include the REST format separately. The result is two keys, one containing the default transaction response, the other containing the more complete response.

What we were doing was complicated. We were looking for transaction responses and then keeping track of how far along we were in a loop through the default, insufficient data, and then supplementing it with data from the other, complete REST representation. This could lead to weird problems when things didn't map as expected, like when returning paths.

The solution is really simple: as soon as possible, figure out if you're dealing with a transaction. If so, just work entirely from the REST representation and ignore the weak transaction response entirely. It simplifies a lot of code and fixes the original problem.

@cheerfulstoic cheerfulstoic changed the title simplifies transaction response parse, fixes path/nodes bug simplifies transaction response parse, fixes path/nodes bug Jan 29, 2016
@subvertallchris
Copy link
Contributor Author

This makes changes to the public API of Neo4j::Server::CypherResponse but I don't see any possible situation where those methods could be used outside of the old procedure. They really could have been marked private. I think that the resultant bugfix is significant enough to warrant release in 6.1.x. What do you think? @cheerfulstoic

@cheerfulstoic
Copy link
Contributor

Agreed! I'd like to see it in 6.1.x as well. The only thing that I'd change is putting in a separate note in the CHANGELOG to have a Changed as well as the Fixed so that people can be aware of the change

@subvertallchris
Copy link
Contributor Author

Cool, all done. Once this passes, I'll do a release.

subvertallchris added a commit that referenced this pull request Feb 3, 2016
…sing

simplifies transaction response parse, fixes path/nodes bug
@subvertallchris subvertallchris merged commit 5cb3c9c into 6.1.x Feb 3, 2016
@subvertallchris subvertallchris deleted the simpler-transaction-response-parsing branch February 3, 2016 03:14
@subvertallchris subvertallchris restored the simpler-transaction-response-parsing branch February 3, 2016 03:26
@subvertallchris subvertallchris deleted the simpler-transaction-response-parsing branch February 5, 2016 02:56
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.

2 participants