Federation Phase 1: registry engine + lokf registry CLI - #23
Merged
Conversation
The offline core of meta-lokf (SPEC §11): resolve a cross-bundle IRI to its owning bundle without a central database. lokf.registry: - Registry / RepoEntry / Resolution; load_registry() parses lokf-registry.yaml with plain YAML (no LinkML on the read path), tolerant of null/hand-edited fields. - owner(iri): longest-base_iri-prefix routing — the exact inverse of Bundle.iri() minting — with an explicit-id exact-match *fallback* (prefix always wins, so a stale id_index can't hijack a prefix owner). resolve() returns owner + Concept ID + source URL, all offline string math. - add() guards: base_iri must end in a separator (/ or #) so routing respects segment boundaries (…/team/ never captures …/team-archive/), may not capture the vocabulary namespace, and may not duplicate or nest another member. - entry_for_bundle(): derive base_iri/title from a local bundle, compute a VoID index (triple + per-type counts) and an id_index of explicit ids that diverge from base_iri + Concept ID; validate every concept IRI is routable. CLI `lokf registry` sub-app: init, add, list, resolve — each with clean "run init first" / parent-dir handling instead of tracebacks. Docs: register lokf.registry in the API-reference generator; sync SPEC §11's id_index to the map the code uses and tighten rule 2 (boundaries + vocab precedence). Hardened against an adversarial review pass (null-manifest crashes, prefix boundary mis-routing, id_index precedence, bogus namespace-root URLs). 21 registry tests (156 total); docs site builds.
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.
Second slice of meta-lokf (builds on #22, SPEC §11). The offline engine that resolves a cross-bundle IRI to its owning bundle — no central database, no network.
What ships
lokf.registryRegistry/RepoEntry/Resolution;load_registry()parseslokf-registry.yamlwith plain YAML (no LinkML on the read path).owner(iri)— longest-base_iri-prefix routing, the exact inverse ofBundle.iri()minting, with an explicit-idexact-match fallback (prefix always wins).resolve()returns owner + Concept ID + source URL as pure offline string math.add()guards —base_irimust end in a separator (/or#), may not capture the vocabulary namespace, and may not duplicate or nest another member.entry_for_bundle()— derivesbase_iri/titlefrom a local bundle, computes a VoID index (triple + per-type counts) and anid_indexof explicit ids that diverge frombase_iri+ Concept ID, and validates every concept IRI is routable.lokf registryCLI —init,add,list,resolve, all offline:Hardened by an adversarial review pass
Ran a multi-agent review over the diff; every CONFIRMED finding is fixed and regression-tested:
id_index:/void:/repos:left null) no longer crashes lookups;…/team/vs…/team-archive/) — enforced separator boundary;id_indexis a true fallback (a stale entry can't hijack a more-specific prefix owner);base_irino longer emits a bogus…/.mdURL;entry_for_bundletrimmed of unused params (YAGNI);_entry_dictis default-aware.Verification
test_registry.py, incl. the review regressions).init → add → list → resolveverified against the acme example; docs site builds and documentslokf.registryin the API reference.Next
Phase 2 (
fetch.py+read_documentoffline degrade chain) reads the source docs a resolution points at.