From 9708d355ccd386eccacb9f108b7ec2144ab94a36 Mon Sep 17 00:00:00 2001 From: Barry Prendergast Date: Sat, 21 Nov 2026 01:21:34 +0000 Subject: [PATCH] docs: list the lexicon DNS records the schemas actually need (#165) The README's table predated #132. It missed _lexicon.media.lanyards.app for app.lanyards.media.item, and listed two records whose lexicons were retired. scripts/lexiconDns.test.ts now derives the records from lexicons/lanyards/ and checks the table matches. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PSPB1cH898qV61BH1NiFKL --- web/README.md | 18 +++++++++------ web/scripts/lexiconDns.test.ts | 42 ++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 web/scripts/lexiconDns.test.ts diff --git a/web/README.md b/web/README.md index cdd2174..8033f97 100644 --- a/web/README.md +++ b/web/README.md @@ -104,13 +104,17 @@ Lanyards' lexicons are published from the `@lanyards.app` account value `did=did:plc:ua3d6biqepazbq6mw4ysotfo`. Resolvers never walk up the hierarchy, so each group needs its own record: - | Name | Covers | - | --------------------------------------- | ----------------------------------------- | - | `_lexicon.lanyards.app` | `app.lanyards.authFull` | - | `_lexicon.actor.lanyards.app` | `app.lanyards.actor.lanyard` | - | `_lexicon.biography.actor.lanyards.app` | `app.lanyards.actor.biography.honorific` | - | `_lexicon.link.lanyards.app` | `app.lanyards.link.web` | - | `_lexicon.media.link.lanyards.app` | `app.lanyards.link.media.audio`, `.video` | + | Name | Covers | + | ---------------------------------- | ----------------------------------------- | + | `_lexicon.lanyards.app` | `app.lanyards.authFull` | + | `_lexicon.actor.lanyards.app` | `app.lanyards.actor.lanyard` | + | `_lexicon.media.lanyards.app` | `app.lanyards.media.item` | + | `_lexicon.media.link.lanyards.app` | `app.lanyards.link.media.audio`, `.video` | + + `scripts/lexiconDns.test.ts` keeps this table in step with + `lexicons/lanyards/`. Records for retired lexicons + (`_lexicon.biography.actor.lanyards.app`, `_lexicon.link.lanyards.app`) + can be deleted. 5. From `web/`, publish: `GOAT_USERNAME=lanyards.app GOAT_PASSWORD= goat lex publish --lexicons-dir lexicons/lanyards`. diff --git a/web/scripts/lexiconDns.test.ts b/web/scripts/lexiconDns.test.ts new file mode 100644 index 0000000..8809940 --- /dev/null +++ b/web/scripts/lexiconDns.test.ts @@ -0,0 +1,42 @@ +import { readdirSync, readFileSync } from 'node:fs'; +import { join, resolve } from 'node:path'; + +import { describe, expect, it } from 'vitest'; + +const ROOT = resolve(process.cwd(), 'lexicons/lanyards'); + +function lexiconIds(dir: string): string[] { + return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => + entry.isDirectory() + ? lexiconIds(join(dir, entry.name)) + : entry.name.endsWith('.json') + ? [ + ( + JSON.parse(readFileSync(join(dir, entry.name), 'utf8')) as { + id: string; + } + ).id, + ] + : [] + ); +} + +/** + * The TXT record an NSID resolves through: its authority (the NSID less + * its name, reversed) under _lexicon. Resolvers never walk up the tree. + */ +const record = (nsid: string) => + `_lexicon.${nsid.split('.').slice(0, -1).reverse().join('.')}`; + +// The README's publishing steps list the records to create in DNS (#165). +describe('the README’s lexicon DNS records', () => { + it('are exactly the ones the lexicons we publish need', () => { + const needed = [...new Set(lexiconIds(ROOT).map(record))].sort(); + const readme = readFileSync(resolve(process.cwd(), 'README.md'), 'utf8'); + const listed = [ + ...readme.matchAll(/^\s*\|\s*`(_lexicon\.[a-z.]+)`\s*\|/gm), + ].map((match) => match[1]); + expect(listed.sort()).toEqual(needed); + expect(needed).toContain('_lexicon.media.lanyards.app'); + }); +});