feat(data): follow corpus refs across accounts and fix $type decoding when reading from a PDS#5
Merged
Conversation
…xes in the lexical extra
… by stripping $type
e04051a to
54291d0
Compare
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.
Summary
Make reading a dataset from a PDS actually work, and follow its references across accounts. Surfaced while verifying the discovery/TUI commands against the live
repo.layers.pub:lairs pullreported "0 records" andmaterializewrote empty Parquet even though the accounts held data. Two things:$typefailed model validation).Changes
$type._decode_envelope(lairs/data/corpus.py) andpull(lairs/author/publish.py) validated each record with the$typefield the generated models do not declare, so every real PDS record raisedValidationErrorand was skipped. Both now go through the shareddecodehelper, which strips$type(and normalizes blob refs) first. This is the same$typebug fixed in_latest_published_versionsin 0.2.0; these two read paths still had it, and the existing tests missed it because their fixtures omitted$type.load_corpusnow walks every AT-URI a loaded record references, transitively and across account boundaries, fetching each referenced record by exact AT-URI (the PDS resolves handle or DID authorities). A dataset's expressions and the records those reference are pulled into the pool even though they live in separate accounts; only the records the corpus actually cites are fetched, not whole shared accounts. A dangling reference is skipped gracefully.follow_refscontrol. Newfollow_refsparameter onload_corpus(defaultTrue), exposed on the CLI aslairs materialize --follow-refs/--no-follow-refs(and the same onlairs inspect), for reading only the corpus's own account when the components are already materialized.$typeis stripped on decode (corpus and pull), the ref helpers, cross-account follow on and off, transitive following two hops out, and dangling-ref skip. Live integration: a cross-account materialize across two real accounts on the dockerized PDS, plus a strengthened corpus-load live test that now asserts the$type-bearing record decodes.0.3.0->0.4.0.Verified live against
repo.layers.pub:materialize <UD_Nayini> --follow-refspulls its 10 cross-account expressions (was 0);--no-follow-refsreads only the corpus account;pullof a corpus account now pulls 12 records (was 0).Type of change
Checklist
uv run ruff format --check lairs testspassesuv run ruff check lairs testspasses (includingANN401; noAnyin annotations)uv run ty check --error-on-warningpassesuv run pytestpasses (1087 passed, 72 skipped)uv run pytest --run-integration -m integrationpasses against the Docker test PDS (72 passed)uv run --group docs mkdocs build --strictpassestests/CHANGELOG.mdupdated (a new## [0.4.0]section with Added and Fixed)@dataclass,pydantic,Any, orobjectannotation introduced; no em-dashesRelated
No tracked issue. Found during live verification of the discovery/TUI commands against
repo.layers.pub.Note
This branch also carries one pre-existing dependency commit that was on its base,
build: require glazing 0.2.3 for the WordNet and FrameNet fidelity fixes in the lexical extra(a one-linepyproject.tomlbump), riding along tomain.