Supersede terms re-submitted under their current thing URI (fixes #10) - #11
Merged
GertjanBisschop merged 1 commit intoJul 9, 2026
Merged
Conversation
Fixes eu-parc#10: publish_incremental keyed its new/unchanged/ drifted decision on the id-map's old_id alone, so re-submitting a term under its current trusty thing URI minted a duplicate term (new identity, no npx:supersedes) instead of superseding. IdMap.resolve() now matches either identifier, and all bookkeeping is canonicalized to entry.old_id so a term keeps a single id-map row and a linear supersedes chain whichever form was submitted. Also fixes a latent companion bug on the supersede path: references given as thing URIs were dropped as dangling by resolve_references (its map was keyed by old_id only); IdMap.resolution_map now accepts both identifier forms. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GertjanBisschop
approved these changes
Jul 9, 2026
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 #10.
Problem
publish_incrementalkeyed its new/unchanged/drifted decision on the id-map'sold_idalone. As @GertjanBisschop reports in #10, re-submitting an existing term under its current identifier (its trusty thing URI,…/biochementities/RA…) therefore missed the lookup and fell into the "new" branch: a duplicate term was minted with a fresh identity and nonpx:supersedeslink. A supersede only happened when the term was submitted under its old temporary id.While fixing this, a latent companion bug surfaced on the supersede path:
resolve_referencesdrops namespaced object URIs it can't find in itsthing_urismap as "dangling" — and that map was keyed by old ids only. So a re-submitted assertion whose cross-references used thing URIs would have those links silently dropped from the superseding nanopub.Fix
IdMap.resolve(term_id)— returns the entry whoseold_idorthing_urimatches (thing URIs are unique across entries, so this is well-defined);Nonemeans genuinely new.IdMap.resolution_map— superset ofthing_uri_mapin which each thing URI also maps to itself; used on the supersede path so references in either identifier form resolve instead of being dropped.publish_incremental— usesresolve()for the three-way decision and canonicalizes all bookkeeping (backfill, skip list, superseded id-map row,MintedSupersession.term_id) toentry.old_id. Whichever form was submitted, a term keeps exactly one id-map row keyed by its original old id — stable redirect table, linear supersedes chain. A match via thing URI is logged.Tests
Five new tests: the exact #10 scenario both ways (resubmit under thing URI, unchanged → skipped / drifted → superseded with no duplicate mint and a single id-map row), thing-URI reference preservation on supersede, and
resolve/resolution_mapunits. Full suite: 127 passed.Deliberately out of scope
The drift fingerprint is computed over the assertion's references as given. A source that switches its cross-references from old ids to thing URIs will fingerprint differently and trigger one semantically-empty supersede (a harmless one-time re-issue, not an identity fork). Normalizing references before fingerprinting changes the fingerprint domain and needs an
FP_SCHEMEbump plus a baseline-migration story — better handled as a separate issue if it matters in practice.🤖 Generated with Claude Code