-
Notifications
You must be signed in to change notification settings - Fork 59
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
WIP Update for jsonapi-resources v0.10 #131
Conversation
Wow thanks! I don't have time right now to dive into these changes but hopefully will in the near future. Thanks for describing what has changed inside JR and how it affects this gem, I bet it's gonna be useful |
I tried checking out this PR for a few minutes, but the gemspec changes done to development dependencies cause my local development environment to bail out as I am not running bundler 2 yet. |
@valscion Sorry about that. I'll try to get that changed soon, along with moving the join tracking to a JR branch we can reference to stop the monkey patching. |
Thanks. Would also be useful to be able to see the test failures you mention in CI — right now, the development dependency bumps are causing CI to bail out before having a chance of running the specs at all. |
@valscion I've moved the join option tracking to a JR branch, which is referenced in the gemfile, and restored the bundler version. |
I did some changes to the CI infrastructure so that we get proper CI test runs now here Seems like there's indeed some test failures that need addressing, especially in the included resources specs. You can run a specific test file locally like so:
And if you want to run it with some specific combination the CI runs, you can add
The list of available versions can be found with
Note that Ruby 2.3 is required to run the Rails 4.2 tests — other versions should run properly with newer Rubies. |
Ok now it should be easier to also debug test failures after #134 was done |
Note this will break with earlier versions of JR
* Run CI against Rails 6 * Use ruby 2.5 * Dummy app updates for rails 6 * Run all but Rails 4.2 tests with Ruby 2.5 * Add empty asset manifest to appease Rails Co-authored-by: Vesa Laakso <[email protected]>
* Add better debuggability to be_X test failures This way test failures will show what the HTTP status code actually was when test fails as well as output the entire response body. The response body will most likely contain vital debugging information to help figure out why the test failed * Output last request information on spec failures
I don't know why the GitHub checks isn't visible correctly in this PR, but the failing Travis build is here: https://travis-ci.com/venuu/jsonapi-authorization/builds/144045618 |
any progress on this branch?? |
Is there any status on this PR? We are closely coupled to this gem on several projects and now it appears it could be a blocker to possibly using Ruby 3 in the near future. Are there any items that could we help with? I'm happy to get some eyes on it, but just want to avoid duplicated effort. |
Thanks @cloke & @Koen03 for posting here. I too am blocked from some library upgrades (Rails-6.1 & JSONAPI-Resources-0.10) that might be alleviated if we can get this PR passing tests. I would love to help ... I've grabbed a fork and am taking a look at the failing tests. |
Thanks for people offering to take a new stab at this 😊. I'd be happy to see a PR that gets this gem compatible with JR 0.10. |
If there are people also willing to convert the CI from Travis to GitHub actions, it'd be useful, too |
I added pr #137 for GitHub actions. It introduces a different issue that I am unsure how to address, but the action definitely works in my fork. |
Ok we've got GitHub actions working now, thanks to @cloke and @encounter 🎉 Now we'd need help from any interested parties in creating another pull request that updates |
Any updates on this branch - would love to have v0.10 support with this gem. |
Does not seem like it. A new pull request would be much appreciated to try to tackle v0.10 support again |
Sounds good to me, thanks @marcelolx! It would take quite some time for me to understand the changes done in |
@marcelolx - any progress on this? |
Hi @harbirg, not much. I didn't have time enough to work on this (I would like to have). I'll try take a time to work on this but I'm not sure when and how much time it will take. If someone else wants to work on it, go ahead. |
We have a branch that is slowly reducing the number of failing tests. https://github.com/crunchybananas/jsonapi-authorization/tree/v0_10 Something that needs clarity is the branch |
@cloke Awesome thanks for your work on this!! There's a small write up on that branch here: cerebris/jsonapi-resources#1307 |
I am working on a project that uses this branch because we need features from JR 0.10.x. I am encountering the following error on some routes:
Relevant code is here:
From what I can tell, Edit: As I dig into this more, I realize what I've given above probably isn't enough to diagnose the problem. I'm brand new to ruby and naively thought it might be as easy as declaring a variable and initializing it correctly. I'm starting to think there's more going on here that won't be solved by such an easy fix. |
Yup most likely the fix required is more work. Contributing a compatibility update to this project is still appreciated and the contribution opportunity is open for anyone to grab right now |
Looks like this has now been merged in a separate PR! |
Cool! I'm not sure if that merged PR has yet been incorporated to any jsonapi-resources release. Can anyone confirm whether that's the case? |
We never managed to finish this pull request to the standards we had for an authorization tool. In the end, we decided to no longer support this gem. Discussion here: |
@valscion This is an early stage proof of concept to work with v0.10 and fix #64
Many specs are failing because the changes in the processor are now calling Resource.records, which applies the scopes and raises the
NotImplementedError
. The processor changes are using the new resource replacement for the autogenerated methods that were created in earlier versions. This might be desirable as the scope is being applied to even the source records, however it's not compatible with the tests.JR v0.10 replaced the
records_for
method and applies joins against the source resource. Since the ActiveRelation still is based on the Source, even when getting related resources Pundit will detect and use the source's scope. To get around this I'm overridingapply_joins
and for everyPunditScopedResource
joined in I'm adding a subquery that applies the appropriate scope and filters the result set.In the
PunditScopedResource
there's a large monkey patch to the JoinManager to add some additional tracking info for the joins. This should go in a future JR version and not added to this gem.