Skip to content

fix(iid): skip a Wikidata rung without an active slug in the declarative engine, as the reference does (P16i) - #43

Merged
kamescg merged 2 commits into
codex/p16d-classifications-parityfrom
codex/p16i-engine-slugless-wd-skip
Oct 20, 2026
Merged

kamescg merged 2 commits into
codex/p16d-classifications-parityfrom
codex/p16i-engine-slugless-wd-skip

Conversation

@jonathanprozzi

@jonathanprozzi jonathanprozzi commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Important

@kamescg — review ready. Stacked on #39 (codex/p16d-classifications-parity); review after #39 and retarget as #39 and #36 land.

To ratify here: the declarative engine no longer mints a bare int:wd:Q… on a Wikidata rung that has no active slug. The reference engine skips such a rung and tries the next one; the train minted on it under design notes D-P16-1 and D-P16-5, which this PR withdraws. Identity-affecting in the safe direction: brand, event, local-business, location, music-group and thing stop producing bare Wikidata identifiers that the reference never produced.

Coordination: the engine change is confined to packages/iid/src/derive.ts; iid-ladder (the provider ladder, allowPlainWd) is untouched. Independent of #40, #41 and #42 apart from one primitives test expectation.

Receipt: 39 ledger entries retired (ladder proof 451 agreements / 3 divergences; harness 804 / 31); harness 1027 pass / 0 fail; iid 318 tests.

Child PR of the v1.1.0-alpha umbrella (#15). Part of the parity series: each PR in the series makes a train package behave exactly as the reference implementation's in-tree copy does today, so the published packages can replace those copies without a behaviour change.

Current (train)

The declarative identity engine in @0xintuition/iid minted a bare Wikidata identifier (int:wd:Q…) on a wd rung that has no slug, under the "legacy bare minting" design notes D-P16-1 and D-P16-5. The reference engine skips such a rung (and any rung whose slug names no active binding) and tries the next one. Six classifications carry slugless Wikidata rungs: brand, event, local-business, location, music-group and thing. For them, an input with only a Wikidata id produced an identifier on the train and none (or the next rung's) on the reference; the conformance ledger carried 39 entries for exactly this.

Need

The engine's rung-skip condition equal to the reference's, the design notes withdrawn, and the ledger moved to match.

Reconciliation

  • src/derive.ts: the wd scheme-rung branch skips when wdSlug is undefined or names no active binding, ported from the reference's condition. Active slugs still prefix bare QIDs and retain matching typed values; conflicting or invalid typed values are still skipped. The provider ladder in iid-ladder is untouched.
  • The behaviour table in the file's doc comment and both READMEs (iid, classifications) drop the legacy-minting row and record the withdrawal of D-P16-1 and D-P16-5.
  • Tests: 42 red-first regressions in src/__tests__/slugless-wd-cases.ts cover the six classifications × seven input shapes (bare QID URL in sameAs, bare QID string, lowercase entity path, two values forward and reversed, set minimum, no fallback data), each expected output reproduced offline from the reference engine and the reference ladders. Three existing bare-minting tests now assert the skip; the two synthetic film-rung tests declare an active slug so they keep testing set-minimum selection. Restoring the bare-minting branch in memory turns all 42 red. One primitives expectation changes: the brand bare-P0 case now fails with "No identity rung fired" because the slugless rung never reaches the profile check.
  • Conformance ledger: the 39 ladder:* entries for brand, event, local-business, location, music-group and thing (a bare scheme:wd rung) now agree with the unchanged oracle and are retired; no expected fingerprint, vector or oracle expectation changed; 31 entries remain. The README enumeration is regenerated: 804 agreements / 31 divergences across the five proof files; ladder proof 451 / 3.

Parity

Matches the reference implementation's engine (derive.ts, the Wikidata rung branch) on every harness vector for the six classifications. The identity-affecting consequence is in the safe direction: the published engine stops minting bare Wikidata identifiers where the reference never did.

Held out

  • No version bump; the release PR freezes versions for the whole family at once.

Evidence

  • iid: typecheck, 318 tests, biome, build. classifications 257, iid-ladder 139, iid-registry 49, primitives 140 tests, each with typecheck and biome.
  • Root: bun test conformance 1027 pass / 0 fail (the README-accounting integrity test passes); biome on conformance; registry:check 14 packages; guard:supply-chain; pack:dry-run.
  • Independent review: a conformance pass and an adversarial pass both found every item of this diff conforming (the ported guard equals the reference's verbatim; restoring the old guard turns 45 tests red and a dormant-slug-allowed mutant turns 2 red; 163 of 171 differential inputs agree). The 8 differing inputs are BOM- and NBSP-wrapped QIDs on active rungs, where the train's Wikidata canonicalizer keeps its ratified Unicode trim() and the reference trims ASCII whitespace only. That difference predates this change, is unchanged by it, and is a standing ruling of the typed-Wikidata work, so it stays as documented.

Review notes

@kamescg
kamescg merged commit 343a58e into codex/p16d-classifications-parity Oct 20, 2026
1 check passed
kamescg added a commit that referenced this pull request Oct 20, 2026
…to PR #15

# Conflicts:
#	conformance/README.md
#	conformance/known-divergences.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants