fix: keep optional introduced placeholders fillable on supersede#550
Merged
Conversation
An introduced-resource placeholder was unconditionally pinned read-only in supersede/override mode. That is right when the superseded nanopub introduces an IRI to keep stable across versions (e.g. a template kind), but when the placeholder's optional statement was absent, the field was read-only AND empty -- so the identifier could never be added on a later version (e.g. adding a kind to an existing template, the half-way governance migration move). The read-only pinning is now conditional on the fill source actually declaring npx:introduces; with nothing to pin, the field stays an editable local-URI textfield. The publish path handles both outcomes: a typed name mints under the new nanopub, an existing full IRI passes through verbatim. Verified against the issue's repro (superseding the template meta-template): the kind field now renders as an empty editable input. Known limitation: the check is source-global, so with several introduced placeholders of which the old nanopub declares only some, the absent ones are still pinned (per-placeholder matching would need unification-time knowledge, deferred). Fixes #549 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 5.5.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Fixes #549: introduced-resource placeholders in optional statements couldn't be filled in when superseding — the field rendered read-only and empty, so an identifier (e.g. a template kind) could never be added to an existing nanopub via a later version. This blocked exactly the "half-way" governance migration move (adding
dct:isVersionOf+ a kind to an existing template at supersede time), as hit on the updated template meta-template's self-supersede.Root cause & fix
ValueItempinned introduced-resource placeholders asReadonlyItemunconditionally in SUPERSEDE/OVERRIDE mode. The pinning exists for identity stability — an introduced IRI (like a template kind) must keep its original full IRI across versions — but that only makes sense when the superseded nanopub has such an IRI.The pinning is now conditional on the fill source actually declaring
npx:introduces(strictlyintroduces, not theembeds/describessiblings). With nothing to pin, the field stays a normal editable local-URI textfield. The publish path (TemplateContext.processValue) handles both outcomes as before: a typed local name mints under the new nanopub; an existing full IRI passes through verbatim.The check reads
getFillSource()at component construction, which works becausePublishFormpropagates the fill source beforeinitStatements()— the new regression tests mirror that ordering.Verification
MetaTemplateNodePlaceholderTest(extended with the meta-template's optional-kind shape): the kind field is editable when the superseded nanopub introduces nothing, and pinned read-only with the original full IRI when it introduces the kind. The editable/read-only distinction is asserted via the context's component registry (editable items register their form field there;ReadonlyItemregisters only a model).class="nanopub-textfield short introduced").Known limitation
The check is source-global: if a template has several introduced placeholders and the superseded nanopub introduces only some of them, the absent ones are still pinned. Per-placeholder matching would need unification-time knowledge (the component type is decided at construction); no current template has that shape, so this is deferred — noted in a code comment.
🤖 Generated with Claude Code