Keep admin seed alive across root-definition supersession (#110)#111
Merged
Conversation
…ssion (#110) The admin-tier seed gated the `npa:hasRootAdmin` seed on the root definition's own invalidation (`invalidationFilter("defNp")`). Since `SpacesExtractor` emits `hasRootAdmin` only for the own-root definition, updating a space publishes a continuation revision that re-roots to the original root (no `hasRootAdmin` of its own) and `npx:supersedes` the prior root. After any update every `hasRootAdmin`-bearing definition is invalidated, the seed empties, and the whole admin closure — plus everything cascading from it — produces nothing. So any space whose definition had ever been updated lost all materialized role state. Fix: gate the seed on the space ref still being alive (some non-invalidated definition of the same ref) via the new `spaceRefAliveFilter()`, instead of on the seed definition's own invalidation. The seed is anchored to the immutable root NPID (the space-ref identity), so it survives supersession of the root nanopub by a live continuation; a fully-retracted ref (every definition invalidated) still drops it. Escalation-safe: the candidate admin RI's `npa:pubkeyHash` must still resolve to the seeded root admin. Verified end-to-end on a freshly-synced instance: knowledgepixels (0 admin RIs on all three live instances) now materializes its admin set; genuinely-retracted spaces stay correctly empty; no regressions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version 1.14.3 🎉 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 #110.
Root cause
The admin-tier seed in
AuthorityResolver.adminTierUpdategated thenpa:hasRootAdminseed on the root definition's own invalidation (invalidationFilter("defNp")).SpacesExtractoremitshasRootAdminonly for the own-root definition, so updating a space publishes a continuation revision that re-roots to the original root viagen:hasRootDefinition(carrying nohasRootAdminof its own) andnpx:supersedesthe prior root. Over a chain of edits, everyhasRootAdmin-bearing definition ends up invalidated while the only live definition has no seed — the seed branch empties, the admin closure produces nothing, and (since attachments / maintainer / member / observer / sub-space all cascade from the admin set) the space loses all materialized role state. This is the clean all-or-nothing correlation in the issue.knowledgepixelsis the live instance: rootRAOOz…(which carrieshasRootAdmin) was superseded byRAvJcz…(a non-root continuation), so all three live query instances materialize 0 admin RIs for it and its space page shows no views.Fix
Gate the seed on the space ref still being alive — i.e. some non-invalidated
SpaceDefinitionof the same ref exists — via the newspaceRefAliveFilter(), instead of on the seed definition's own invalidation. The seed is anchored to the immutable root NPID (the space-ref identity), so it survives supersession of the root nanopub by a live continuation. A fully-retracted ref (every definition invalidated) has no live definition, so theFILTER EXISTSfails and the seed correctly disappears.Escalation-safe: the candidate admin RI's
npa:pubkeyHashmust still resolve to the seeded root admin, so a superseding party can only re-affirm the founding admin, not seed themselves.Scope note on the issue's "33 broken"
The issue's reproduction query #2 counts a space if any definition — even an invalidated one — asserts
gen:hasAdmininline, so it sweeps in deleted spaces. Verified breakdown of the 33:knowledgepixels(superseded-but-alive). This PR fixes it, and protects every future space-definition update from the same regression.npx:retracts, no live successor — e.g.beetles,knowledgepixels/news). Correctly empty; unaffected by this PR.test/john-doe-test-group(signing key not trust-approved) andfair2adapt-cs4(malformed admin IRIhttps://orcid.org/https://orcid.org/…). Not addressed (correct).Verification
adminTierUpdate_seedSurvivesRootSupersession_issue110.knowledgepixelsnow materializes its 4 admin agents (each resolving to pubkey hashes), genuinely-retracted spaces stay empty, and no space shows admin RIs without a live definition. Net: 95 → 96 working spaces, exactly one space flipped, no regressions.Out of scope (separate issue worth filing)
The materializer's invalidation filter honors any
npx:invalidates/retracts/supersedesedge with no authorship/admin check. Base-nanopub same-key semantics aren't applied here (and arguably shouldn't be for spaces, where admin co-management is legitimate), but neither is an admin-scoped authority check — so a validly-signed nanopub from any agent can invalidate a space definition. This PR narrows rather than widens that exposure, but the gap is pre-existing and orthogonal.🤖 Generated with Claude Code