fix(spaces): honor owl:sameAs space aliases in /repo/spaces materializer (#113)#115
Merged
Conversation
…zer (#113) A role/member attached to a space's owl:sameAs alias was silently dropped. The materializer keys assignments on the alias IRI, which has no admin closure (its definition was superseded when the canonical space was created), so the attachment never validated — admins live only on the canonical IRI. A sub-space-style "admin of both sides" gate would not fix this, since the alias has no admins; authority must flow canonical->alias. Honor owl:sameAs via authority-expansion (no row rewrite): - Extract embedded owl:sameAs from gen:Space nanopubs as npa:SpaceAliasDeclaration. - New aliasAdmitUpdate tier validates an alias edge iff the declaration's publisher is a validated admin of the canonical space AND admins(alias) is a subset of admins(canonical) (anti-hijack: blocks <evil> owl:sameAs <activeSpace>); emits <alias> npa:sameAsSpace <canonical>. - Admin-authority lookups (attachment, PUBLISHER_IS_ADMIN, publisherIsTieredRole) gain a UNION accepting admin of a canonical the space is an alias of. - Alias-declaration invalidation is structural (flips needsFullRebuild). Assignments stay keyed on the alias IRI; the canonical view resolves via the alt-ids Nanodash forwards from the space's owl:sameAs. Verified on a local full sync: get-space-roles returns the previously-dropped member role for carabid-beetles/beetles, the 4 members are admitted, and total RoleAssignments go 138->139 (the single predicted recovery, no over-admission). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version 1.14.4 🎉 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 #113.
Problem
A role/member nanopub attached to a space's
owl:sameAsalias IRI is silently dropped by the/repo/spacesmaterializer. The materializer keys assignments on the alias IRI, but admins live only on the canonical IRI, so the attachment never validates and the role — with all its members — vanishes from the materialized state with no error.The subtle part: the alias (e.g.
beetles) typically has no live admin closure — itsgen:Spacedefinition was superseded when the canonical space (carabid-beetles) was created. So a sub-space-style "publisher must be admin of both sides" gate would not fix this (there are no alias admins to match). Authority has to flow canonical→alias.Approach — honor
owl:sameAsvia authority-expansionExtraction — embedded
<canonical> owl:sameAs <alias>triples ingen:Spacenanopubs are emitted asnpa:SpaceAliasDeclaration(with provenance). Self-aliases rejected.Materialization — a new
aliasAdmitUpdatetier (runs after the admin closure, before attachment; also in the late-arrival sweep) validates an alias edge iff both:admins(alias) ⊆ admins(canonical)— the defunct-alias case (∅) passes;<evil> owl:sameAs <activeSpace>is rejected because the active space has admins not in evil's set.It emits
<alias> npa:sameAsSpace <canonical>into the state graph.Authority lookups —
attachmentValidationUpdate,PUBLISHER_IS_ADMIN, andpublisherIsTieredRolegain aUNIONaccepting admin of a canonical the space is asameAsSpacealias of.Invalidation — alias-declaration invalidation is structural (flips
needsFullRebuild); thesameAsSpaceedge is sticky until the next periodic rebuild (same policy as sub-space declarations).Keying is authority-expansion, no row rewrite: assignments stay keyed on the alias IRI (so
?space=<alias>queries work directly); the canonical view resolves via the alt-ids Nanodash forwards from the space'sowl:sameAs. Single alias hop; standaloneowl:sameAsnanopubs out of scope.Design write-up: new "Space aliases (
owl:sameAs)" section indoc/design-space-repositories.md.Verification
SPARQLParser.get-space-roles?space=carabid-beetles&space=beetlesnow returns thememberrole (was 0 rows).<beetles> npa:sameAsSpace <carabid-beetles>materialized; the 4 P463 members admitted.🤖 Generated with Claude Code