Skip to content

🐛 [i2925] - Fix flexible form to use resource contexts for schema field inclusion#7347

Merged
ShanaLMoore merged 5 commits intomainfrom
i2925-fix-m3-contexts-bug
Feb 12, 2026
Merged

🐛 [i2925] - Fix flexible form to use resource contexts for schema field inclusion#7347
ShanaLMoore merged 5 commits intomainfrom
i2925-fix-m3-contexts-bug

Conversation

@ShanaLMoore
Copy link
Contributor

@ShanaLMoore ShanaLMoore commented Feb 12, 2026

Fixes

Summary

Bug: With HYRAX_FLEXIBLE=true, context-specific properties from the metadata profile (e.g. “dimensions” for special_context) do not appear on the work form even when the work’s admin set has that context assigned.

Cause: In Hyrax::Forms::ResourceForm#initialize, the form uses r.context (singular) to pass to form_definitions_for; the resource only has r.contexts (plural), so contexts is always nil and M3SchemaLoader omits all context-restricted properties.

PS. 5.0-flexible has it as a plural reference as well

Changes proposed in this pull request:

Fix: In resource_form.rb, use the resource’s contexts (plural) when calling form_definitions_for (e.g. context = r.respond_to?(:contexts) ? r.contexts : nil and pass it as contexts: context), so the form includes properties for the work’s context(s), e.g. “dimensions” for admin sets with “special context.”

@samvera/hyrax-code-reviewers

image image

metadata-profile-v.7 (1).yml

BEFORE

dimensions was missing from an ImageResource work created from the 'special context' admin set image

AFTER

image

Pass resource.contexts (plural) into form_definitions_for so context-specific
metadata profile properties (e.g. dimensions for special_context) appear on
the work form when the admin set has that context assigned.
@ShanaLMoore ShanaLMoore requested review from orangewolf and removed request for orangewolf February 12, 2026 19:09
@github-actions
Copy link

github-actions bot commented Feb 12, 2026

Test Results

    13 files  ± 0      13 suites  ±0   2h 51m 20s ⏱️ - 1m 49s
 7 053 tests + 4   6 747 ✅ + 4  306 💤 ±0  0 ❌ ±0 
18 805 runs  +12  18 304 ✅ +12  501 💤 ±0  0 ❌ ±0 

Results for commit 28e5a75. ± Comparison against base commit 56a94e3.

This pull request removes 358 and adds 362 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:0x00007efd5a0b7300>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f1b8bdd03d0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f9342fc3fc8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007efd5a0cba58>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f1b8bdd4ed0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f9342f87d20>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: d0c328e2-5c18-492a-82cc-d390be3b28d4
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 4e7abd94-369b-49c1-9ce4-1b022e6733b2
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 93a4082e-cb04-4016-954c-dffd570bf6a1
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: cb932ec5-308e-4d28-a04b-57dbf1c92154
…
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f3efe454888>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f8d6dd00640>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f8e66833348>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f3efe4aa008>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f8d6dd9de90>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f8e6683dac8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 528455fd-3c0f-4ca3-9abf-c640655afaff
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 2ba5b8b8-6935-4b9d-b096-87d07ca1cde6
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: e745c735-14ac-4814-97b0-c45dd7720531
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 1c4acd3f-b336-47c7-96a5-0f7db30c6c92
…

♻️ This comment has been updated with latest results.

@ShanaLMoore ShanaLMoore changed the title I2925 fix m3 contexts bug 🐛 [i2925] - Fix flexible form to use resource contexts for schema field inclusion Feb 12, 2026
@ShanaLMoore ShanaLMoore requested a review from laritakr February 12, 2026 21:13
@ShanaLMoore ShanaLMoore marked this pull request as ready for review February 12, 2026 21:20
Copy link
Contributor

@kirkkwang kirkkwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, glad it was just a typo

@ShanaLMoore ShanaLMoore merged commit 18f4997 into main Feb 12, 2026
17 checks passed
@ShanaLMoore ShanaLMoore deleted the i2925-fix-m3-contexts-bug branch February 12, 2026 22:12
ShanaLMoore added a commit to samvera/hyku that referenced this pull request Feb 12, 2026
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