Skip to content

Save and delete works cleanly#7434

Merged
orangewolf merged 1 commit intomainfrom
redirects/rescue-statement-invalid
May 8, 2026
Merged

Save and delete works cleanly#7434
orangewolf merged 1 commit intomainfrom
redirects/rescue-statement-invalid

Conversation

@laritakr
Copy link
Copy Markdown
Contributor

@laritakr laritakr commented May 6, 2026

Summary

Details

When a tenant has the redirects feature enabled but the migration that creates the redirects database table hasn't been run, the redirects sync/remove steps were letting the database error escape, producing a 500 — even though the work itself had already saved successfully. The user was left looking at a stack trace with no clear recovery path.

This change has the sync and remove steps catch that error, log it, and return a clean failure to the controller instead. Redirects are a sidecar to the work, not load-bearing for it, so a soft fail is the right outcome: the work save still succeeds, and only the redirect bookkeeping is skipped for that request.

The issue surfaced during early Hyku integration testing when the migration hadn't been installed yet.

The primary fixes are in:

  • remove_redirect_paths.rb
  • sync_redirect_paths.rb

The remainder of changes are in specs and documentation. As this change would have introduced several more locations of using either "ledger" and "redirects table" with the same meaning, it renames "ledger" terminology to "redirects table" throughout the related code and docs for clearer language.

Testing

  • In a Hyku tenant with the redirects feature enabled but the migration not run, saving a work produces a clean error rather than a 500.
  • Same scenario but on delete: deleting a work with the migration not run produces a clean error rather than a 500.

Previously, if the redirects feature was enabled but the redirects database
table couldn't be queried (most often because the migration hadn't been run
yet), saving or deleting a work produced a 500 — even though the work
itself had already been saved successfully.

This commit catches that error and surfaces it as a clean failure instead.
The work save still succeeds; only the redirect bookkeeping is skipped
for that request. Redirects are a sidecar to the work, not load-bearing
for it, so a soft fail is the right outcome.

Also renames "ledger" terminology to "redirects table" throughout the
related code and docs for clearer language.
@laritakr laritakr added the notes-minor Release Notes: Non-breaking features label May 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Test Results

    17 files  ±0      17 suites  ±0   3h 24m 16s ⏱️ - 5m 38s
 7 338 tests +2   7 032 ✅ +2  306 💤 ±0  0 ❌ ±0 
24 694 runs  +8  24 103 ✅ +8  591 💤 ±0  0 ❌ ±0 

Results for commit 0afeda8. ± Comparison against base commit cae6920.

This pull request removes 436 and adds 438 tests. Note that renamed tests count towards both.
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007efd87f90160>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f43517afc88>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f940c3e3d50>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fb14017d498>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007efd880cb2c8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f43517bc1e0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f940c403218>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fb14085e258>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 03bcd766-44a7-4c85-a114-cc0a95c5566b
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 7913a7b4-338a-4103-bd3e-5d961108ea33
…
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f01d7c46f50>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f409e61d498>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f4f291521e0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f7fea68fb48>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f01d7f73fc0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f409e3ae608>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f4f29199748>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f7fea69c1e0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 06ea84ae-9eee-4bac-a923-971eda63e7f0
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 05c1222f-6ceb-41fc-bdfd-d1db3db7ef5c
…

@laritakr laritakr requested a review from orangewolf May 6, 2026 21:35
@orangewolf orangewolf merged commit b7a1c55 into main May 8, 2026
20 checks passed
@orangewolf orangewolf deleted the redirects/rescue-statement-invalid branch May 8, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes-minor Release Notes: Non-breaking features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants