Skip to content

feat(web): read DJ records and press kits from HappyView instead of PDSes - #253

Merged
botandbang merged 9 commits into
mainfrom
bnb/happyview-record-api
Oct 25, 2026
Merged

botandbang merged 9 commits into
mainfrom
bnb/happyview-record-api

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

What and why

Project pages read each manager's DJ stats and sets, and press kits read and listed computer.localnetwork.epk records, straight from each account's PDS through PublicRepo. They now read HappyView.

Added:

  • Two directory queries, computer.localnetwork.directory.getRecords (up to 25 URIs) and listRecords (one account's records of one collection, with a cursor), returning each record's URI, CID and value as its record script stored it
  • IndexedRepo (happyview/indexed.ts), which reads through them with PublicRepo's call shape. A HappyView outage reads as nothing for display, and strict reads (the ones a write depends on) fail with the directory-offline 503 instead
  • Record scripts that index dj.profile, epk (the root's own press kits, and legacy ones by a manager of the project they name) and locallibrary.settings
  • A per-script-version re-read of the root's and every manager's DJ records and press kits (happyview/refresh.ts), generalized from the one dj.set had, plus a re-read when a project gains a manager

Changed:

  • Record lexicons are collected from the record scripts under lua/, so indexing a collection is one new file
  • dj/set.lua keeps every author's sets, with the tracklist as written (tempo, keys, transitions); the queries narrow to managers of the root's projects, as before
  • The press kit form carries the published record's CID. A draft saved from a form opened on an older version is refused with a reload message before anything is written, instead of recording others' published edits as this manager's changes, so publishing can't revert them; publishing swaps on the version HappyView serves
  • Press kit reads the shared-kit code added (the root's own kits, legacy kits, the 20-kit cap, member sync for their spaces) go through HappyView, and epk.lua keeps the root's own press kits
  • The charts and artist queries take each set's named tracks once instead of re-parsing whole set records per play, which had made getArtist take minutes on a large seed

How it was tested

  • Unit tests for the queries, gates, IndexedRepo batching and strict reads, the re-reads, and the press kit swap
  • pnpm test:integration against a real PDS and HappyView 2.16: DJ stats and sets with tracklists, and a press kit draft saved, published, edited elsewhere while its form is open (refused), and saved again
  • pnpm verify and pnpm test:coverage

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

…DSes

Project pages read each manager's DJ profile and sets, and press kits read and listed epk records, straight from each account's PDS. HappyView now indexes dj.profile, epk and locallibrary.settings, keeps dj.set's full tracklists, and answers two generic queries, getRecords and listRecords, that an IndexedRepo reads through. Saving a press kit swaps on the CID HappyView served, so an edit made elsewhere since asks the owner to reload. Record lexicons are collected from the record scripts under lua/, and the per-version re-read covers every manager collection.
# Conflicts:
#	apps/web/src/lib/server/app.ts
#	apps/web/src/lib/server/happyview/bundle.ts
…t's whole record

Since stored sets keep their full tracklist, the charts and artist queries went back to each set record for every play, and SQLite parsed the whole record, tracklist included, each time. The plays query now takes namedTracks out of each set once and carries each play's track with it, so getCharts and getArtist stop joining back to the set.
The edit form carries the press kit record's CID, and a save is refused with a reload message when HappyView serves a different version, before anything is written. The PDS write swaps on that CID too, so a change HappyView hasn't seen yet is refused the same way.
# Conflicts:
#	apps/web/README.md
#	apps/web/src/routes/epk/[did]/[rkey]/edit/+page.server.ts
# Conflicts:
#	apps/web/README.md
#	apps/web/src/lib/epk.ts
#	apps/web/src/lib/server/db/migrations.ts
#	apps/web/src/lib/server/epk-page.test.ts
#	apps/web/src/lib/server/epk-page.ts
#	apps/web/src/lib/server/forms/epk.test.ts
#	apps/web/src/lib/server/forms/epk.ts
#	apps/web/src/lib/server/services/epk.test.ts
#	apps/web/src/lib/server/services/epk.ts
#	apps/web/src/routes/dashboard/projects/[slug]/press-kits/[did]/[rkey]/+page.server.ts
#	apps/web/src/routes/projects/[slug]/press-kits/page.svelte.test.ts
@botandbang
botandbang requested a review from bnb as a code owner October 25, 2026 19:41
@github-actions github-actions Bot added documentation Improvements or additions to documentation web The Local Network website (apps/web) lexicons The computer.localnetwork.* lexicons web: directory Directory search, the show matcher, genres and places web: projects Project profiles, claims, and the DJ stats and sets on them web: epk Press kits and who can see them web: server Spaces, sync, HappyView, the database and the server around them web: ui Shared components, design tokens, layout and the static pages tests Tests, fixtures and test harnesses labels Oct 25, 2026
@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.34% (🎯 93%)
⬆️ +0.06 pp
5885 / 6238
🟢 Statements 92.7% (🎯 91%)
⬆️ +0.04 pp
9089 / 9804
🟢 Functions 93.34% (🎯 92%)
⬆️ +0.08 pp
2313 / 2478
🟢 Branches 82.1% (🎯 80%)
⬆️ +0.13 pp
4194 / 5108
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/web/src/lib/dj-schema.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
apps/web/src/lib/dj.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
apps/web/src/lib/epk.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
apps/web/src/lib/nsid.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
apps/web/src/lib/components/epk/EpkForm.svelte 97.71%
⬆️ +0.03 pp
72%
🟰 ±0 pp
93.47%
🟰 ±0 pp
94.73%
⬆️ +0.07 pp
122, 54-58
apps/web/src/lib/server/app.ts 68.79%
⬆️ +0.91 pp
46.66%
🟰 ±0 pp
55.26%
⬆️ +1.21 pp
76.22%
⬆️ +1.01 pp
76, 108, 132, 134, 137, 197-210, 272, 283, 290, 293-294, 304, 320, 337-359, 363, 372-375, 385-390
apps/web/src/lib/server/epk-page.ts 95.16%
🟰 ±0 pp
88.88%
🟰 ±0 pp
94.73%
🟰 ±0 pp
94%
🟰 ±0 pp
78-79, 183
apps/web/src/lib/server/atproto/lexicons.ts 100%
🟰 ±0 pp
91.66%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
apps/web/src/lib/server/db/migrations.ts 95.23%
⬆️ +0.23 pp
50%
🟰 ±0 pp
100%
🟰 ±0 pp
93.75%
⬆️ +0.42 pp
261-263
apps/web/src/lib/server/forms/epk.ts 90.84%
⬆️ +0.18 pp
82.35%
⬆️ +0.60 pp
93.54%
🟰 ±0 pp
93.91%
⬆️ +0.11 pp
86, 115-120, 152, 180, 228, 233, 250, 258, 261, 279, 303, 305, 307, 324
apps/web/src/lib/server/forms/project.ts 98.91%
🟰 ±0 pp
91.09%
🟰 ±0 pp
100%
🟰 ±0 pp
99.51%
🟰 ±0 pp
322, 407, 454
apps/web/src/lib/server/happyview/bundle.ts 95.45%
⬇️ -1.32 pp
86.66%
⬇️ -0.84 pp
100%
🟰 ±0 pp
97.14%
⬆️ +1.31 pp
50, 88
apps/web/src/lib/server/happyview/client.ts 100%
🟰 ±0 pp
93.54%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
apps/web/src/lib/server/happyview/indexed.ts 97.91%
⬆️ +12.20 pp
100%
⬆️ +16.67 pp
93.75%
⬆️ +27.09 pp
100%
🟰 ±0 pp
29
apps/web/src/lib/server/happyview/refresh.ts 100% 100% 100% 100%
apps/web/src/lib/server/services/dj.ts 95.74%
⬆️ +0.87 pp
88%
⬆️ +2.29 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
86, 98
apps/web/src/lib/server/services/epk-drafts.ts 96.33%
⬆️ +0.12 pp
92.89%
⬆️ +0.16 pp
94.28%
⬆️ +0.17 pp
98.72%
⬆️ +0.67 pp
284, 325, 336-338, 504, 512
apps/web/src/lib/server/services/epk-legacy.ts 98.94%
⬆️ +0.02 pp
90.9%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
264
apps/web/src/lib/server/services/epk.ts 93.61%
⬇️ -0.09 pp
85.78%
⬆️ +0.66 pp
95.58%
🟰 ±0 pp
95.49%
⬇️ -0.08 pp
147, 182, 186, 200-209, 593, 728-730, 751-752
apps/web/src/lib/server/services/follows.ts 97.29%
🟰 ±0 pp
84.61%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
85
apps/web/src/lib/server/services/manager-spaces.ts 99%
🟰 ±0 pp
97.56%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
62
apps/web/src/lib/server/services/projects.ts 96.47%
⬆️ +0.10 pp
92.38%
🟰 ±0 pp
100%
🟰 ±0 pp
98.3%
⬆️ +0.04 pp
177, 273, 297, 350, 434
apps/web/src/lib/server/services/sets.ts 93.05%
⬇️ -1.68 pp
87.5%
⬇️ -1.63 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
47, 62, 73, 110, 147
apps/web/src/lib/server/services/shows.ts 93.1%
🟰 ±0 pp
78.94%
🟰 ±0 pp
100%
🟰 ±0 pp
94.16%
🟰 ±0 pp
95-96, 104-105, 132, 204, 407-409
apps/web/src/lib/server/testing/core.ts 94.91%
⬆️ +0.09 pp
80%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
68, 77, 84
apps/web/src/lib/server/testing/press-kits.ts 95%
⬆️ +0.27 pp
72.72%
⬆️ +6.06 pp
90.9%
⬆️ +0.90 pp
97.22%
⬆️ +0.17 pp
78
Generated in workflow #475 for commit 3d22fe4 by the Vitest Coverage Report Action

Size

Compared with main. KiB are 1,024 bytes.

This pull request main Change
Client JavaScript 619.2 KiB 619.1 KiB +72 B (+0%)
Client JavaScript, brotli 204.5 KiB 204.5 KiB -9 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

Copy link
Copy Markdown

Rust coverage

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

Tests Lines Functions Regions
All 97.49% (79308/81353) 96.67% (12647/13083) 95.79% (174223/181886)
Hegel property tests alone 95.44% (77640/81353) 93.93% (12289/13083) 93.49% (170050/181886)

@botandbang
botandbang merged commit a2e4629 into main Oct 25, 2026
66 checks passed
@botandbang
botandbang deleted the bnb/happyview-record-api branch October 25, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation lexicons The computer.localnetwork.* lexicons tests Tests, fixtures and test harnesses web: directory Directory search, the show matcher, genres and places web: epk Press kits and who can see them web: projects Project profiles, claims, and the DJ stats and sets on them web: server Spaces, sync, HappyView, the database and the server around them web: ui Shared components, design tokens, layout and the static pages web The Local Network website (apps/web)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants