geobtaa / geoblacklight_admin

MIT License
4 stars 2 forks source link

Bulk action publication state changes in dev - lagging or stuck? #26

Closed karenmajewicz closed 8 months ago

karenmajewicz commented 9 months ago

Working in geodev/admin and finding I cannot change the publication state for some things via the bulk actions interface. This is working fine most of the time, but I sometimes come across a set of records that do not respond. Maybe I am seeing a lag between changing the publication state and what messages are shown in the interface?

To replicate:

  1. Search for items that are Is Part Of 02a-01 and published currently (link)
  2. Select some OR all and choose State - Unpublished
  3. The next screen shows 0 documents with a button to Revert the changes.
ewlarson commented 9 months ago

Debugging this issue now...

Turning GeoDev production.log level to :debug and I'm seeing a lot of these in the log: BULK ACTION BAD DOC: #<Document id: "c0edda7d-81d0-4ff2-8096-466b2aa8b653"...

These errors originate from the rescue clause here in the codebase: https://github.com/geobtaa/geoblacklight_admin/blob/6931a95953004013e9bf8dbdcc0e32168184fe09/app/models/bulk_action.rb#L76-L86

Testing one of those bad docs and I'm finding this doc.current_version method call errors: (irb):8:in `<main>': undefined method `index' for nil:NilClass (NoMethodError)

So! We have documents in the database that (for whatever reason?) have no PaperTrail version history. Without doc.current_version these docs fail to create BulkActionDocument objects and toss the error.

Working on a fix.

ewlarson commented 9 months ago

Okay! I have a branch running a bug fix on GeoDev. It's working as I expect now, but can you give things a try on your end and let me know how things look to you?

GeoDev is running:

karenmajewicz commented 9 months ago

The fix seems to work - I was able to unpublish that set of records just now. Maybe this happened because we copied the Solr database into Admin instead of ingesting via the interface?

ewlarson commented 9 months ago

Thanks for the feedback. Tomorrow, (Monday) I'll cut a release and push these changes into production.

This has me thinking that we might want to revisit how PaperTrail is configured in the application -- make sure we have sane defaults and limit the number of versions we store.

ewlarson commented 8 months ago

Closing. Fix is in v0.3.2