🚧 Rework yaml structure for compound metadata#7483
Merged
laritakr merged 14 commits intoJun 6, 2026
Conversation
…ing wings require
Dassie flexible fixes
rework wings loading order
Compound (hierarchical) metadata now calls its nested members "subproperties" instead of "subfields" — the YAML key is `subproperties:`, and the supporting classes, methods, i18n keys, and CSS classes follow the same name. This is a vocabulary rename only; the declaration structure, the normalized internal shape, indexing, rendering, and validation are unchanged. It sets up a later change that expresses subproperties as composable, first-class properties.
A compound's members are now declared as separate top-level properties
that point back to the parent with `subproperty_of: <parent>`, rather
than nested in a `subproperties:` block. Each subproperty carries its
own group membership (`group:`) and form placement (`form: { cols: }`),
and a parent's `groups:` block names the groups. Subproperties are not
standalone resource attributes — the schema loaders fold them into the
parent, so storage, indexing, and rendering are unchanged.
This is the foundation for deeper nesting and for subproperties that
carry their own form/display options. The previous nested `subproperties:`
format is replaced (not kept for back-compat); both flex modes use the
same flat declaration.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Flexible (m3 profile) compound subproperties may omit `display_label`, `available_on`, and `range`: the profile JSON schema exempts entries declaring `subproperty_of`, and a subproperty inherits its parent compound's class scope. The flexible schema model no longer requires a `range` (keeping the declared `type:` when absent) and skips registering subproperties as standalone class attributes. Without this, a profile using the flat compound format fails validation and the app raises on boot building attributes for a subproperty. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A `work_or_url` subproperty now resolves an internal id to the right show page — a work to its work page, a collection to its collection page — instead of the model-agnostic catalog route, using the document's Wings-aware model resolution. The picker search also returns collections alongside works, so a related item can be either. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A compound now renders in the form's primary section when it declares
`form: { primary: true }`, and in "Additional fields" otherwise —
matching how scalar terms split. The work and collection forms render
`primary_compound_terms` up top and `secondary_compound_terms` in the
collapsible section. The shipped samples demonstrate both: participants
and relationships are primary; identifiers and compound_rights are
additional.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The m3 schema loader could call `attributes_for` on a nil schema: `find_by(id: version)` misses on an unknown version and `create_default_schema` returns nil when a row already exists, so on a fresh database or early boot the loader raised `NoMethodError`. It now falls back to the latest schema and, failing that, the default attribute set.
Test Results 17 files ± 0 17 suites ±0 3h 35m 51s ⏱️ + 5m 3s Results for commit d2f95a7. ± Comparison against base commit edb0db3. This pull request removes 451 and adds 615 tests. Note that renamed tests count towards both. |
The redirects and compound form populators read their submitted nested-attributes fragment through a shared Hyrax::CompoundRowPlumbing module rather than each defining its own identical fragment-coercion helpers. Each populator keeps its own row-drop rule and value normalization; only the shape coercion (unwrapping ActionController::Parameters) is shared, so form behavior is unchanged in both flex modes.
The compound and field-behavior docs now live at documentation/ (no longer under forms/) and spell out when to declare a compound versus hand-write a field behavior: redirects and based_near stay field behaviors because moving them onto the compound machinery would change persisted shape or behavior, not refactor it. References to the two docs areupdated to the new paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A bunch of rework to #7479