Skip to content

feat(views): let a view display open its part pages to parts defined by anyone - #934

Merged
tkuhn merged 3 commits into
masterfrom
feat/part-definition-tier-on-displays
Nov 18, 2026
Merged

tkuhn merged 3 commits into
masterfrom
feat/part-definition-tier-on-displays

Conversation

@tkuhn

@tkuhn tkuhn commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A part page takes a part's classes, title and …Np parameter from its defining nanopublication, and accepts only one signed by a role-holder of the owning space (at the space's gen:hasPartDefinitionTier, every role-holder by default). So a part-level view can never render for a contribution by someone without a role in that space, whatever it targets.

On top of that, the Explore page read the classes off the nanopub that minted the IRI, whoever signed it, so it forwarded such contributions to a part page that then found no definition and showed nothing. This is live on nanodash.knowledgepixels.com today. Two schema:Questions in the iosp/2026 context, which has question part views:

  • one asked by a role-holder → part page shows ❓ About this question and 💬 Answers;
  • one asked by someone without a role there → Explore forwards to the part page, which renders no views.

The motivating case is a 🧵 Thread part view for discussion threads (Nanoarguments pilot): it should show on the page of every contribution, including those by people who hold no role in the space.

Change

  • gen:hasPartDefinitionTier on a view display. It lowers the space's rule for that display alone, as page size, position and title overrides do. The display then also renders for a part whose definition was signed at that tier or above. A display can only lower the bar: a tier at or above the space's has no effect. A display declaring none requires the space's own tier, so existing displays behave exactly as before; those that apply to a part whatever its definition says (explicit target, namespace, an agent) keep rendering on a part another display opens up.
  • gen:EveryoneRole means anyone, as for gen:isVisibleTo (TierRanks.ANYONE, below every role-holder). For an IRI minted inside a nanopublication (carrying its artifact code), that nanopublication defines it, in its latest same-key version (get-latest-thing-nanopub). It is never a third party's nanopub, so nobody can redefine someone else's part, and nothing changes for external IRIs such as DOIs. In a space's root definition gen:EveryoneRole used to rank as "every role-holder", the same as declaring nothing; no space declares it (checked on the live network: only DataSciNP declares a tier, gen:MemberRole).
  • PartDefinition, one resolution behind the part page, its breadcrumb's ancestors, its About tab (the Info view gets the keys the definition was found among, or the minting nanopub's signing key), document export, RDF download and Explore's forwarding:
    1. The space's own rule, unchanged.
    2. Only if that finds nothing: the lower tiers its displays declare, most restrictive first. A definition found that way is taken only if a display accepting its signer's rank actually applies to the part, so opening one view does not present everybody's nanopubs as the space's parts elsewhere (heading, About tab).
    3. A space declaring gen:EveryoneRole itself opens all its part views this way.
    4. A lookup is never run with an empty key list, which get-term-definitions would read as no restriction.
    5. The displays it resolves among are the resource's loaded ones (asked for, with a brief wait for the cache seed), or ones the caller fetched itself (export, RDF download); a part page built before they arrived resolves again when its panels are built.
  • Post-publish refresh clears every lookup the resolution may go through (PartDefinition.lookupRefs), so a contributor's new version of their own contribution shows on return.
  • Explore forwards to the part page only where a display would render (the dct:isPartOf/isVersionOf/inScheme membership forwarding is unchanged).
  • TierRanks holds the rank constants and mapping, free of SpaceMemberRole's class initialisation (which builds the admin role from template data). SpaceMemberRole.tierRank delegates to it.
  • Docs: docs/role-specific-views.md, new subsection under gen:hasPartDefinitionTier.

Tests

  • New: PartDefinitionTest (14) and ViewDisplayPartDefinitionTierTest (5), with three fixtures.
    • The space's rule wins.
    • Nothing opens up without an applicable open display.
    • An open display lets the minting nanopub define the part, but not for parts it doesn't apply to.
    • A retracted minting nanopub defines nothing, and external IRIs have no minting nanopub.
    • A space open to everyone needs no display.
    • Signer ranks, including the owner on a user page.
    • Tier parsing on displays, acceptance, and the rank filter in getPartLevelViewDisplays.
    • No keys means no lookup; forked latest versions; the lookups a publication invalidates; resolution among fetched displays; a display tier at or above the space's; displays applying whatever the definition says.
  • Full suite: 1911 tests, 0 failures after the review follow-up (1905 before it). Two tests erred on the first run: NanodashPageMetadataTest (view not loaded) and PreviewPageTemplateFormTest (provenance template null). Both pass on rerun, on this branch and on master alike.
  • Run locally on port 37374 against live data (iosp/2026):
    • A role-holder's question still forwards from Explore, and its part page still shows both views.
    • The other question now stays on Explore instead of forwarding to an empty part page.
    • After the review follow-up: the same two checks again, plus the About and Download tabs, and the document export and RDF download of the question match production; a person's part page shows the same view as production, and its export now lists that view too (it was empty).

Templates (nanopubs, signed, not yet published)

  • "Displaying a view for the parts of a resource": new version with an optional (advanced) gen:hasPartDefinitionTier statement, offering anyone / observers / members / maintainers / admins, its label saying that only a tier below the space's has an effect (supersedes RAnxyaWo…).
  • "Defining an open-ended Space" and "Defining a time-limited Space": gen:EveryoneRole ("anyone") added to their tier choices (supersede RA0t4bKm… and RA8liS89…).

Older instances ignore the new display property (the display then keeps the space's rule), so publishing them is harmless before this is deployed.

🤖 Generated with Claude Code

tkuhn and others added 3 commits November 18, 2026 15:30
…by anyone

A part page takes a part's classes, title and Np parameter from its defining
nanopublication, and only accepts one signed by a role-holder of the owning
space (at its gen:hasPartDefinitionTier). So a part-level view could never
render for a contribution by someone without a role there, and the Explore
page, which read the classes off the nanopub that minted the IRI, forwarded
such contributions to a part page that then showed nothing.

- gen:hasPartDefinitionTier can now also be declared on a view display,
  overriding the space's rule for that display alone (as page size or
  position overrides do). A display renders for a part only when the part's
  definition was signed at that tier or above; displays declaring none keep
  the space's tier, so existing displays behave as before.
- gen:EveryoneRole now means anyone, as for gen:isVisibleTo (TierRanks.ANYONE,
  below every role-holder). For an IRI minted inside a nanopublication, that
  nanopublication defines it, in its latest same-key version; never a third
  party's nanopub, and nothing changes for external IRIs. It used to rank as
  "every role-holder", the same as declaring nothing; no space declared it.
- PartDefinition is the one resolution behind the part page, its About tab,
  document export, RDF download and Explore's forwarding. The space's own rule
  comes first; lower tiers that displays declare are tried only when it finds
  nothing, and taken only if a display accepting the signer's rank applies to
  the part, so opening one view does not present everybody's nanopubs as the
  space's parts elsewhere.
- Explore now forwards to the part page only where a display would render.
- The tier ranks move to TierRanks, free of SpaceMemberRole's class
  initialisation, which loads template data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up to the per-display gen:hasPartDefinitionTier (PR #934).

- The displays a part is resolved among are no longer read off a resource
  that has not loaded them yet. PartDefinition.resolve asks for them and
  waits briefly for the seed from the cache; the export and the RDF download
  resolve among displays they fetch themselves; a part page built before the
  displays arrived resolves again when its panels are built.
- The breadcrumb's ancestors go through the same resolution as the page's
  own part, so a parent defined by someone without a role is an ancestor too.
- A display can only lower the bar: a tier at or above the owning resource's
  counts as none. It used to filter on the newest role-holder definition, so
  an observer could take such a display off a part's page by publishing a
  newer description of it.
- The definitions lookup is never run with an empty key list, which it takes
  as no restriction: the owning resource's own lookup is skipped then, and
  every query built from a key list restricts to a key matching nothing.
- A publication redefining the part being viewed invalidates every lookup
  its resolution may go through (PartDefinition.lookupRefs), not only the
  one among the owning resource's keys.
- Displays without a tier that apply to a part whatever its definition says
  (explicit target, namespace, an agent) keep rendering once another display
  opens the part to a lower tier, as they do for a part with no definition.
- Of forked latest versions of a minting nanopublication, the most recently
  created counts; one whose key cannot be read defines nothing.
- The export and the download read a part's classes as the part page does,
  an agent's included, so a person's part exports the views its page shows.
- Explore resolves the definition once and only when needed, and the lookup
  among the owning resource's keys is not repeated for a tier adding none.
- Removes the resolvers left without callers (ViewDataFetcher.resolvePart*,
  the two-argument appliesTo), and the tests no longer ask the registries
  for their fixture ids while stubbing them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A display can only lower the space's rule; the minting nanopublication has
to introduce or describe the part; nothing but the page's context ties a
part opened to anyone to the space; displays applying to a part whatever
its definition says keep rendering; and how resolution deals with displays
that are not loaded yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@tkuhn
tkuhn merged commit 9b2e85f into master Nov 18, 2026
8 checks passed
@tkuhn
tkuhn deleted the feat/part-definition-tier-on-displays branch November 18, 2026 15:29
github-actions Bot pushed a commit that referenced this pull request Nov 18, 2026
## [5.23.0](nanodash-5.22.3...nanodash-5.23.0) (2026-11-18)

### Features

* **home:** add a jump-to bar and a login button to the home page ([7bd0990](7bd0990))
* **home:** leave the first group of views out of the jump-to bar ([3ad6614](3ad6614))
* **views:** label template links with the template's own label ([719df70](719df70))
* **views:** let a view display open its part pages to parts defined by anyone ([e501afd](e501afd))

### Dependency updates

* **core-deps:** update dependency io.github.openhtmltopdf:openhtmltopdf-pdfbox to v1.1.114 ([0d7b4c5](0d7b4c5))
* **core-deps:** update nanopub to 1.96.0, wicket to 10.12.0 and two more ([0e34a43](0e34a43))
* **deps:** update dependency maven to v3.10.1 ([9f2ec99](9f2ec99))

### Bug Fixes

* **api-cache:** wait as long as a refusing query server asks ([#889](#889)) ([16e8bca](16e8bca))
* handle query responses the service didn't answer ([#916](#916)) ([1b07819](1b07819))
* **publish:** say which template could not be loaded instead of failing ([7ff6cd9](7ff6cd9))
* **views:** close the gaps in part-definition resolution found in review ([4a0972b](4a0972b)), closes [#934](#934)

### Documentation

* **views:** state the limits of a display's part-definition tier ([e2e5012](e2e5012))

### Build and continuous integration

* **deps:** update dependency semantic-release-preconfigured-conventional-commits to v1.1.159 ([bce66d7](bce66d7))

### General maintenance

* setting next snapshot version [skip ci] ([8c0863c](8c0863c))
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.23.0 🎉

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.

1 participant