Skip to content

Fix redirects form crash on non-flexible installs#7436

Merged
laritakr merged 3 commits intomainfrom
redirects/fix-non-flexible-form
May 8, 2026
Merged

Fix redirects form crash on non-flexible installs#7436
laritakr merged 3 commits intomainfrom
redirects/fix-non-flexible-form

Conversation

@laritakr
Copy link
Copy Markdown
Contributor

@laritakr laritakr commented May 7, 2026

Summary

  • Fix a crash on the work edit page when the redirects feature is enabled in a non-flexible install. The Aliases tab now renders cleanly instead of raising NoMethodError.

Details

The redirects feature adds a per-work alias list, exposed on the work edit form under an Aliases tab. Without this fix, opening that tab in a non-flexible install (HYRAX_FLEXIBLE=false) crashes the page: the form partial reads f.object.redirects, but the form class never had the redirects property registered.

In flexible mode the m3 schema loader populates form properties from the metadata profile, so redirects is on the form and the partial works. In non-flexible mode that path doesn't run, and the existing redirects field behavior only registered the virtual redirects_attributes (used for nested form params) — never the persisted redirects property the partial actually reads.

The fix loads redirects onto the form from config/metadata/redirects.yaml via Hyrax::FormFields(:redirects), the same mechanism every other YAML-backed form uses. The redirects.yaml form options were also corrected from primary: false (no effect on form display gating) to display: false, matching how the loader actually decides what to render.

Testing

  • On an install with HYRAX_REDIRECTS_ENABLED=true and HYRAX_FLEXIBLE=false, edit any work, click the Aliases tab — the tab renders without error and shows the redirects table.
  • On the same install, add an alias path, save the work — the alias persists and reappears when the form is re-opened.
  • Repeat the above with HYRAX_FLEXIBLE=true to confirm flexible mode still behaves correctly (no regression).
  • With HYRAX_REDIRECTS_ENABLED=false, edit a work — the Aliases tab is not present and the edit page renders normally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@laritakr laritakr added the notes-bugfix Release Notes: Fixed a bug label May 7, 2026
RedirectsFieldBehavior now loads the persisted redirects property
from redirects.yaml, so the form has it in non-flexible mode.
Update redirects.md and the field_behaviors.md exemplar to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@laritakr laritakr marked this pull request as ready for review May 7, 2026 21:55
@laritakr laritakr requested a review from orangewolf May 7, 2026 22:02
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Test Results

    17 files  ± 0      17 suites  ±0   3h 29m 30s ⏱️ + 9m 34s
 7 351 tests + 4   7 045 ✅ + 4  306 💤 ±0  0 ❌ ±0 
24 744 runs  +12  24 153 ✅ +12  591 💤 ±0  0 ❌ ±0 

Results for commit a7f1479. ± Comparison against base commit d4256c5.

This pull request removes 435 and adds 439 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:0x00007f0a148b6198>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f49b0021f60>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f4a7bef61a0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fc48234f8c0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f0a17551cc0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f49b00fcbd8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f4a7bf035d0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fc48235bf58>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: ff7ce46b-b0a2-41e3-9b95-24416c3afdba
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 10e0965d-1c76-4da9-bb8f-376a6454a295
…
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f0a8a276910>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f2120f76410>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f32d14662d8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fcfb16b21e0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f0a8a667588>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f2120fe7a98>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f32d1552598>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fcfb16d2300>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 90e63aa9-7a7c-40cd-b915-46e178253b35
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 31b23a12-0e03-437f-a9f2-b9f1e4565a2b
…

♻️ This comment has been updated with latest results.

@ShanaLMoore
Copy link
Copy Markdown
Contributor

Retested from Hyku with Flex true and false; this solution works now.

Base automatically changed from redirects/normalize-on-write to main May 8, 2026 16:24
@laritakr laritakr merged commit b26f82e into main May 8, 2026
20 checks passed
@laritakr laritakr deleted the redirects/fix-non-flexible-form branch May 8, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes-bugfix Release Notes: Fixed a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants