Skip to content

refactor: check in other authorities' lexicons instead of fetching them at run time - #241

Merged
botandbang merged 9 commits into
mainfrom
bnb/vendored-lexicons
Oct 25, 2026
Merged

botandbang merged 9 commits into
mainfrom
bnb/vendored-lexicons

Conversation

@botandbang

@botandbang botandbang commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What and why

The website and locallibrary read other authorities' lexicons from their PDS while running. The website resolved community.lexicon.calendar.event and the location lexicons through LexResolver at startup (lexicons.ts#L132), and locallibrary fetched community.lexicon.location.address whenever it published a set with a location (mod.rs#L308-L349). Both now use copies checked in under lexicons/community/, and HappyView's bundle uploads the same copy.

Added:

  • lexicons/community/lexicon/location/{address,geo,fsq,hthree}.json and lexicons/community/lexicon/calendar/event.json, exactly as lexicon.community publishes them
  • lexicons/README.md: which folders are ours, where each copy came from (authority DID and record CID), and how to refresh them
  • tools/lexicons.sh pull, which re-fetches every lexicon outside lexicons/computer/

Changed:

  • tools/lexicons.sh lint and breaking only cover lexicons/computer/
  • The existing strongRef, discussion and space copies are re-pulled in goat's formatting (same content), so pull is idempotent
  • Website tests validate against the real documents instead of hand-written stand-ins

Removed:

  • From apps/web: the startup lexicon load and @atproto/lex-resolver
  • From locallibrary: fetch_lexicon, the $LOCALLIBRARY_LEXICONS override, the ref-depth guard only fetched documents needed, and hickory-resolver

How it was tested

  • apps/web: pnpm verify and pnpm test:coverage, with new tests that every referenced NSID is checked in and that a set's address validates against the real lexicon
  • locallibrary: fmt, clippy, rustdoc, cargo coverage, and the Hegel coverage run
  • tools/lexicons.sh lint and breaking, tools/policy.sh
  • Windows clippy only runs in CI

Checklist

  • Tests cover the change
  • For the website: Storybook stories cover any new UI states
  • For locallibrary: apps/locallibrary/CHANGELOG.md has a line under Unreleased, if people using it will notice
  • The READMEs, docs/ and --help still say what the code does

…ent lexicons, with a pull to refresh them

The web app and locallibrary resolved these from lexicon.community's PDS at run time. Checked-in copies, recorded with their authority DID and CID in lexicons/README.md, let both load them without a network read. tools/lexicons.sh pull re-fetches every lexicon outside computer/, and lint and breaking now cover only ours.
…d of resolving them at startup

Startup read the calendar event and location lexicons from lexicon.community's PDS through LexResolver. They now come from the checked-in copies, the hand-written test stand-ins go, and tests validate against the real documents. @atproto/lex-resolver is no longer a dependency of the app.
…tead of fetching it

Publishing a set with a location fetched community.lexicon.location.address from its authority's PDS. The checked-in copy is embedded instead, which removes the DNS lookup, the fetch, the $LOCALLIBRARY_LEXICONS override and the hickory-resolver dependency.
# Conflicts:
#	apps/web/package.json
#	apps/web/src/lib/server/app.ts
#	pnpm-lock.yaml
# Conflicts:
#	crates/locallibrary/Cargo.toml
@botandbang
botandbang requested a review from bnb as a code owner October 25, 2026 09:49
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Coverage Report for apps/web

Status Category Percentage Covered / Total
🟢 Lines 94.28% (🎯 93%)
⬇️ -0.03 pp
5825 / 6178
🟢 Statements 92.66% (🎯 91%)
🟰 ±0 pp
9014 / 9728
🟢 Functions 93.26% (🎯 92%)
⬆️ +0.01 pp
2286 / 2451
🟢 Branches 81.97% (🎯 80%)
🟰 ±0 pp
4158 / 5072
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/web/src/lib/server/app.ts 67.88%
⬇️ -0.46 pp
46.66%
🟰 ±0 pp
54.05%
🟰 ±0 pp
75.21%
⬇️ -0.42 pp
78, 110, 134, 136, 139, 194-207, 269, 279, 286, 289-290, 299, 305, 321-343, 347, 356-359, 369-374
apps/web/src/lib/server/atproto/lexicons.ts 100%
⬆️ +2.13 pp
91.66%
⬆️ +2.19 pp
100%
⬆️ +6.67 pp
100%
🟰 ±0 pp
apps/web/src/lib/server/happyview/bundle.ts 96.77%
🟰 ±0 pp
87.5%
🟰 ±0 pp
100%
🟰 ±0 pp
95.83%
🟰 ±0 pp
55
Generated in workflow #472 for commit f996a22 by the Vitest Coverage Report Action

Size

Compared with main. KiB are 1,024 bytes.

This pull request main Change
Client JavaScript 619.1 KiB 619.1 KiB 0 B (0%)
Client JavaScript, brotli 204.5 KiB 204.5 KiB 0 B (0%)
Client CSS 87.6 KiB 87.6 KiB 0 B (0%)
Client CSS, brotli 12.5 KiB 12.5 KiB 0 B (0%)

@github-actions github-actions Bot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file web The Local Network website (apps/web) locallibrary locallibrary and the loclib-* crates lexicons The computer.localnetwork.* lexicons web: bookings Booking inquiries and their threads web: server Spaces, sync, HappyView, the database and the server around them locallibrary: cli The locallibrary command line locallibrary: core The core crate, the data model and rekordbox's formats locallibrary: publishing The Atmosphere account, and the sets and profile published to it tests Tests, fixtures and test harnesses tooling Repo config, lint and build tooling, and GitHub settings labels Oct 25, 2026
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Coverage Report for apps/localtoolbox

Status Category Percentage Covered / Total
🟢 Lines 100% (🎯 100%)
🟰 ±0 pp
4284 / 4284
🟢 Statements 99.64% (🎯 95%)
🟰 ±0 pp
5839 / 5860
🟢 Functions 99.65% (🎯 95%)
🟰 ±0 pp
1713 / 1719
🟢 Branches 97.71% (🎯 50%)
🟰 ±0 pp
2774 / 2839
File CoverageNo changed files found.
Generated in workflow #456 for commit f996a22 by the Vitest Coverage Report Action

Size

Compared with main. KiB are 1,024 bytes.

This pull request main Change
Packaged (localtoolbox.zip) 360.6 KiB 360.6 KiB +19 B (+0%)
Unpacked (dist/) 836 KiB 836 KiB 0 B (0%)

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Rust coverage

From run 460. Both are held to the thresholds in .cargo/config.toml.

Tests Lines Functions Regions
All 97.48% (79520/81574) 96.67% (12680/13117) 95.79% (174713/182394)
Hegel property tests alone 95.42% (77834/81574) 93.9% (12317/13117) 93.46% (170465/182394)

bnb
bnb previously approved these changes Oct 25, 2026
@botandbang
botandbang merged commit cbe55f0 into main Oct 25, 2026
72 checks passed
@botandbang
botandbang deleted the bnb/vendored-lexicons branch October 25, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation lexicons The computer.localnetwork.* lexicons locallibrary: cli The locallibrary command line locallibrary: core The core crate, the data model and rekordbox's formats locallibrary: publishing The Atmosphere account, and the sets and profile published to it locallibrary locallibrary and the loclib-* crates tests Tests, fixtures and test harnesses tooling Repo config, lint and build tooling, and GitHub settings web: bookings Booking inquiries and their threads web: server Spaces, sync, HappyView, the database and the server around them web The Local Network website (apps/web)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants