Skip to content

fix: keep optional introduced placeholders fillable on supersede#550

Merged
tkuhn merged 1 commit into
masterfrom
fix/optional-introduced-fillable-on-supersede
Jul 9, 2026
Merged

fix: keep optional introduced placeholders fillable on supersede#550
tkuhn merged 1 commit into
masterfrom
fix/optional-introduced-fillable-on-supersede

Conversation

@tkuhn

@tkuhn tkuhn commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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

ValueItem pinned introduced-resource placeholders as ReadonlyItem unconditionally 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 (strictly introduces, not the embeds/describes siblings). 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 because PublishForm propagates the fill source before initStatements() — the new regression tests mirror that ordering.

Verification

  • Two regression tests in 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; ReadonlyItem registers only a model).
  • The issue's repro URL against a dev instance with the fix: the meta-template's self-supersede form now renders the kind field as an empty editable input (class="nanopub-textfield short introduced").
  • Full suite: 756 tests, 0 failures.

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

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>
@tkuhn tkuhn merged commit 5d3d39d into master Jul 9, 2026
8 checks passed
@tkuhn tkuhn deleted the fix/optional-introduced-fillable-on-supersede branch July 9, 2026 09:17
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optional introduced placeholders can't be filled in upon superseding

1 participant