From 40b553016c065abe84ef01c8cfe19156cf39d091 Mon Sep 17 00:00:00 2001 From: Worph Date: Sun, 13 Sep 2026 14:36:50 +0200 Subject: [PATCH] cid vector --- internal/cid/cid-rank-vectors.json | 6 ++++++ internal/cid/rank.go | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/internal/cid/cid-rank-vectors.json b/internal/cid/cid-rank-vectors.json index 977e5e8..9ab02d3 100644 --- a/internal/cid/cid-rank-vectors.json +++ b/internal/cid/cid-rank-vectors.json @@ -128,6 +128,12 @@ "rank": 5, "note": "codec 0x1009 + IDENTITY multihash 0x00, digest = the verbatim UTF-8 URL. WIRE-IDENTICAL to url (0x1006) apart from the codec, and that difference is the entire contract: 0x1006 means 'fetch these bytes once and seed them', 0x1009 means 'open this in a browser, there are no bytes for us'. A decoder that matched on SHAPE rather than on the codec slot would see an identity multihash wrapping an http(s) URL, take the 0x1006 path, fetch a watch/Bandcamp page, chunk it, seed the HTML and link that content CID onto the record AS THE FILE — the MSR1 poisoning shape, except permanent and replicated. Same tier/reasoning as the rest of the locator family." }, + { + "name": "provider-file-locator", + "cid": "bagfcaaa2bvxxazloon2we5djorwgk43gnfwgkorxga3dcobtgq", + "rank": 5, + "note": "codec 0x100A + IDENTITY multihash 0x00, digest = varint(len(source)) || source || id - here (\"opensubtitles\",\"file:7061834\"). The GENERIC fetchable locator: one codec for every provider whose bytes are fetched the same way; the provider is inside the digest. Framing byte-identical to card (0x1007), but the byte path RESOLVES it (via source's fetch tier) instead of 404ing. Same codec-slot rule as the rest of the family: match on the CODEC, never the mh (identity 0x00 would fall through and score 0). Tier 5: once the fetched bytes' sha2-256 is linked onto the record it wins the canonical election with no addressing change." + }, { "name": "sha1", "cid": "baeircff3eqvxxaqqot2lt242stkdtk3gq4c2vra", diff --git a/internal/cid/rank.go b/internal/cid/rank.go index c09a601..88d5fa4 100644 --- a/internal/cid/rank.go +++ b/internal/cid/rank.go @@ -75,6 +75,14 @@ const ( CodeYtVideo = 0x1008 // custom — identity-multihash CID wrapping a YouTube (kind, id) CodeExtPlay = 0x1009 // custom — identity-multihash CID wrapping a URL to OPEN, never fetch + // CodeProviderFile is the FETCHABLE twin of CodeExtPlay: a provider-held + // file addressed as varint(len(source))‖source‖id — ("opensubtitles", + // "file:7061834"). Framing is byte-identical to CodeCard; only the byte + // path differs (it redeems the id through that source's feeder instead of + // 404ing). Same codec-slot rule and same tier: once the fetched bytes' + // sha2-256 is linked onto the record it wins with no addressing change. + CodeProviderFile = 0x100A // custom — identity-multihash CID wrapping a (source, id) provider file + // CodeNzbPosting is the INVERSE trap of the two above: its multihash is a // REAL sha2-256 digest (over the normalised, sorted article Message-ID // set of a Usenet posting we scanned ourselves — never a locator, no @@ -183,7 +191,7 @@ func Rank(cidStr string) int { // Opaque locators. Codec-only: their multihash is identity (0x00), so // there is nothing to match on the mh side. if codec == CodeNzbRelease || codec == CodeURL || codec == CodeCard || - codec == CodeYtVideo || codec == CodeExtPlay { + codec == CodeYtVideo || codec == CodeExtPlay || codec == CodeProviderFile { return RankLocator } // nzb-posting: codec-only, checked BEFORE the mh switch below — its