Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d225f922fb | ||
|
|
5e25e14994 | ||
|
|
94ccea185c | ||
|
|
d21b842d86 | ||
|
|
f79249dfba | ||
|
|
f8c8d374d1 | ||
|
|
ec4961ae50 | ||
|
|
a113b7bd62 | ||
|
|
b5bdba2f38 | ||
|
|
1c08d8db90 |
@@ -6,6 +6,22 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
|
||||
YellowJacket is a cross-platform desktop music player built with Go (backend) and TypeScript/Lit (frontend), using the Wails framework to bridge them. It supports MP3, FLAC, OGG Vorbis, and WAV playback.
|
||||
|
||||
**The three prose documents are split by reader, not by topic** (#50).
|
||||
`README.md` is the landing page and answers *a user's* questions only —
|
||||
what it does, which channel installs it on which platform, where its
|
||||
data lives — with three screenshots in `docs/images/`, captured from the
|
||||
fixture library (`make sandbox-seed NAME=default` → `make dev-headless
|
||||
SEED=default`) so they can be retaken by anyone. `CONTRIBUTING.md` holds
|
||||
what used to be the second half of that README — prerequisites, the
|
||||
system libraries, the build and codegen commands, which verification
|
||||
tier a change demands, the tracker workflow and the commit grammar. This
|
||||
file stays the deep reference both of them point at, and is the only one
|
||||
of the three that explains *why* a shape is what it is. A fact that
|
||||
belongs to a user goes in one place; the packaging channels keep their
|
||||
own documents (`packaging/*/README.md`, `docs/android-release.md`) and
|
||||
are linked rather than summarised, because a version-restart note copied
|
||||
into the README is a second copy to keep true.
|
||||
|
||||
## Issues
|
||||
|
||||
**The tracker is the source of truth for what is wanted and what is
|
||||
@@ -1854,6 +1870,21 @@ is not it.** A `placeholder` is an accname fallback, so an
|
||||
Explore's search box — the audit's own `a11y.26` — as clean. A sweep
|
||||
for *empty* names cannot see a *weak* one.
|
||||
|
||||
**`title` is the same trap one rung lower, and it defeats the obvious
|
||||
spec as well as the obvious sweep.** `queue-panel`'s Clear queue and
|
||||
Add queue to playlist were named by `title` alone, so
|
||||
`getByRole('button', { name: 'Clear queue' })` matched them **before**
|
||||
the fix as well as after — a `getByRole` assertion, which is what
|
||||
catches every other nameless control in this app, would have been
|
||||
green on the broken build. `title` is the *last* fallback in the
|
||||
accname order, so content put inside the button later silently
|
||||
outranks it, and it is the one name a phone cannot show, having no
|
||||
hover. The property is therefore asserted as *the name is not the
|
||||
tooltip*: `queue-overlay.spec.ts` removes the `title` attributes and
|
||||
asks again, which is 1 and 1 with `aria-label` and was measured at 0
|
||||
and 0 without it. The `title`s stay, because on a desktop they are
|
||||
also the tooltip for an icon-only control and that is a different job.
|
||||
|
||||
**The shell scrolls sideways and not down.** `body` is
|
||||
`overflow-x: auto; overflow-y: hidden`, and both halves are measured.
|
||||
Vertically there is nothing to fix: the middle grid row is `1fr` and
|
||||
@@ -3244,6 +3275,27 @@ its own duplicates apart) — and changing either is invisible against an
|
||||
existing `YJ_HOME`, whose `config.toml` already holds the old list, so
|
||||
`make sandbox-seed NAME=default` before believing the app.
|
||||
|
||||
**And the *valid* columns are declared twice too, which is the pair
|
||||
that drifted.** `tracklist.AllColumnIDs` is what the backend accepts;
|
||||
`COLUMN_DEFS` is what the frontend knows how to draw, and they are not
|
||||
the same set — `titleArtist` is a definition and not a choice, since it
|
||||
is the phone's stacked column and is picked by width in
|
||||
`PHONE_COLUMN_IDS`. Settings built its list from `Object.keys(
|
||||
COLUMN_DEFS)` and so offered it: **two rows both called "Track Name"**
|
||||
(#197), the second unselectable, because ticking it sends a column set
|
||||
Go rejects with `unknown track-list column ID` and `config-page`
|
||||
swallows that into a `console.error`. `CONFIGURABLE_COLUMN_IDS` is what
|
||||
the configurator reads now, derived from a `configurable` flag on the
|
||||
definition, and `settings-column-list.test.ts` reads Go's own list out
|
||||
of the source rather than writing it down a third time — the rule being
|
||||
about every column, so checking one checks nothing.
|
||||
|
||||
One thing it does **not** fix, because it is reachable from any invalid
|
||||
input rather than from that row: `SetTrackListColumns` assigns before it
|
||||
validates, so a rejected list stays in memory and `Save()` validates the
|
||||
whole config — one tick and **no setting saves for the rest of the
|
||||
session**, silently. That is #231.
|
||||
|
||||
**Event-driven communication**: Backend emits events via Wails runtime; frontend stores subscribe to them. Event names are constants in `backend/events/`.
|
||||
|
||||
`frontend/src/events.ts` is **generated** from `backend/events/events.go`
|
||||
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
# Contributing to YellowJacket
|
||||
|
||||
This is the contributor's half of the [README](README.md): how to build it, how
|
||||
to check a change, and how a change gets in. [`CLAUDE.md`](CLAUDE.md) is the
|
||||
deep reference — the architecture, and the reasons behind the shape of it —
|
||||
and is worth reading before a change of any size, because most of this
|
||||
codebase's traps are written down there and nowhere else.
|
||||
|
||||
## Building from source
|
||||
|
||||
YellowJacket is [Go](https://go.dev/) with a [Lit](https://lit.dev/)/TypeScript
|
||||
frontend, bridged by [Wails v3](https://wails.io/).
|
||||
|
||||
| Tool | Version |
|
||||
|------|---------|
|
||||
| Go | 1.25+ |
|
||||
| Node.js | 22+ |
|
||||
| pnpm | 10+ |
|
||||
| Wails CLI | v3 — vendored, no install needed (`go tool wails3`) |
|
||||
|
||||
The Wails v3 CLI resolves from the `tool` block in `go.mod`, so there is nothing
|
||||
to install globally; `make setup` fetches it with the rest of the tooling.
|
||||
|
||||
On Linux, install the system libraries Wails needs. v3 builds against GTK4 +
|
||||
WebKitGTK 6.0 by default:
|
||||
|
||||
```bash
|
||||
sudo apt-get install libasound2-dev libgtk-4-dev libwebkitgtk-6.0-dev # Debian/Ubuntu
|
||||
sudo pacman -S alsa-lib gtk4 webkitgtk-6.0 # Arch
|
||||
```
|
||||
|
||||
A machine without `webkitgtk-6.0` can still build with `-tags gtk3` against the
|
||||
older WebKit2GTK 4.1 stack, but that is an escape hatch, not what CI or a
|
||||
release builds. macOS and Windows need no extra system packages. Run
|
||||
`go tool wails3 doctor` to check your environment.
|
||||
|
||||
```bash
|
||||
make setup # install tooling, frontend packages and the git hooks
|
||||
make dev # run with hot-reload
|
||||
make build-dev # debug build with symbols
|
||||
make build-prod # production build (stripped and trimmed)
|
||||
make android # the arm64 APK, into bin/
|
||||
```
|
||||
|
||||
The `Makefile` is the front door and carries a one-line description against
|
||||
each target; `Taskfile.yml` and `build/<platform>/Taskfile.yml` are the build
|
||||
implementation behind it and are not called directly.
|
||||
|
||||
## Generated code
|
||||
|
||||
Two generators run from `go generate ./...`, which `make generate` wraps:
|
||||
**sqlc** turns `backend/database/sql/queries/` into Go in
|
||||
`backend/database/sql/sqlcgen/`, and **templ** turns `.templ` files into
|
||||
`*_templ.go` beside them. Never edit either output by hand — run
|
||||
`make generate` after touching a `.sql` or a `.templ` file.
|
||||
|
||||
The TypeScript bindings in `frontend/bindings/` are generated by `wails3`
|
||||
rather than by `go generate`, so they are a separate step: `make bindings`
|
||||
regenerates them and `make bindings-check` fails if they are stale.
|
||||
`frontend/src/events.ts` is generated too, from `backend/events/events.go`.
|
||||
|
||||
A pre-commit hook checks that all of this is fresh, so the usual way to meet it
|
||||
is a failing commit rather than a bug.
|
||||
|
||||
## Checking a change
|
||||
|
||||
Run the tier the change actually demands, not the cheapest one.
|
||||
|
||||
| Change | Command |
|
||||
|---|---|
|
||||
| Go | `make lint` and `make test` — both cover all three build configurations |
|
||||
| A frontend component or store | `make ui-test` (Vitest in a real Chromium, no backend) |
|
||||
| A user-visible flow | `make e2e`, against a running `make dev-headless` |
|
||||
| CSS | `make css-check` — see the Chrome 113 note below |
|
||||
| Anything cosmetic | look at a screenshot; several bugs here were invisible to every assertion and obvious in an image |
|
||||
|
||||
`make test` needs the fixture library, which is generated rather than
|
||||
committed — it runs `make testdata` itself (about a second).
|
||||
|
||||
The end-to-end tier drives the real app with no display at all: `make
|
||||
dev-headless` starts it in the background on `:34115` (add `SEED=<name>` for a
|
||||
seeded library, built by `make sandbox-seed NAME=<name>`), `make dev-logs` tails
|
||||
it and `make dev-stop` stops it. **Check the port before starting one** — if
|
||||
`:34115` is already answering, someone else's app is there, and a green result
|
||||
about their build is worse than no result.
|
||||
|
||||
Two smaller checks exist because the failure they catch is silent:
|
||||
`make bindings-check` (stale generated bindings) and `make css-check`, which is
|
||||
two passes — one fails on a `css` literal ended early by a backtick inside a
|
||||
comment, the other on a nested CSS rule that begins with a bare element
|
||||
selector. Chrome 113 is what the reference Android device renders with, and it
|
||||
drops such a rule without a word.
|
||||
|
||||
`make vulncheck` runs govulncheck over the module.
|
||||
|
||||
## The issue tracker is the source of truth
|
||||
|
||||
Work is described by issues before it is described by branches, and the tracker
|
||||
is shared with people who cannot see your terminal.
|
||||
|
||||
- **Search before starting**, closed issues included: `./scripts/issue.sh search
|
||||
<terms>`. "That was fixed three weeks ago" is the cheapest possible answer.
|
||||
- **Claim before the first edit**, not before the commit:
|
||||
`./scripts/issue.sh claim <n>` sets the assignee, applies `Status/In Progress`
|
||||
and comments with the branch, so the work is visibly taken *while it is being
|
||||
done*. It refuses if somebody else holds it — talk to them rather than working
|
||||
around it.
|
||||
- **If no issue covers the work, open one first** (`./scripts/issue.sh new`).
|
||||
- **Findings get filed.** A bug tripped over on the way to something else is an
|
||||
issue with a reproduction, not a wider diff and not a sentence in a chat log.
|
||||
- **#73 is the roadmap** and states the order the backlog should be worked in.
|
||||
|
||||
`scripts/issue.sh` is the whole interface (`list`, `mine`, `search`, `show`,
|
||||
`new`, `claim`, `unclaim`, `comment`, `close`, `label`, `depends`, `labels`) and
|
||||
wants a `GITEA_TOKEN` with `write:issue`. The labels are a taxonomy rather than
|
||||
tags: `Kind/*`, `Area/*`, `Priority/*`, `Platform/*`, plus `Reviewed/*` and
|
||||
`Status/*`, of which the last two are exclusive scopes.
|
||||
|
||||
## Commits and pull requests
|
||||
|
||||
`main` is protected, so a branch and a PR are the only way in. Branch from
|
||||
`origin/main`, and name the branch after the issue (`fix/140-…`, `feat/25-…`).
|
||||
|
||||
Commit subjects are [Conventional Commits](https://www.conventionalcommits.org/)
|
||||
— `type(scope): subject`, imperative, ≤72 characters — and are enforced by a
|
||||
`commit-msg` hook and by CI (`make commit-check`). This is load-bearing rather
|
||||
than decorative: semantic-release reads the **type** to decide the next version,
|
||||
so a CI-only change is `ci:` and never `fix(ci):`, which would ship a patch
|
||||
release. `make release-dry` prints what a release would cut right now.
|
||||
|
||||
**The closing keyword goes in the commit body**, one issue per line, because
|
||||
Gitea parses commit messages that reach `main` and does not parse the PR body:
|
||||
|
||||
```
|
||||
docs: rewrite the README as a landing page
|
||||
|
||||
<why>
|
||||
|
||||
Closes #50
|
||||
```
|
||||
|
||||
A PR body carries a commit-to-issue table, the verification you actually ran
|
||||
(with results), and a `Closes` list for whoever reads it.
|
||||
|
||||
## Style
|
||||
|
||||
- **Go** — golangci-lint v2, strict: `err113` (static errors), `nlreturn`,
|
||||
`wsl_v5`, `godot`, `sloglint`, `perfsprint`, and imports grouped stdlib →
|
||||
third-party → `yellowjacket/…` by gci.
|
||||
- **TypeScript** — strict mode, no implicit `any`, no unused locals or
|
||||
parameters.
|
||||
- Match the surrounding code. Where `CLAUDE.md` explains why something is shaped
|
||||
the way it is, that shape is load-bearing and there is usually a test pinning
|
||||
it.
|
||||
|
||||
Hooks do most of the enforcing (`lefthook.yml`, installed by `make setup`):
|
||||
pre-commit runs vet, lint, the codegen checks, the frontend typecheck and the
|
||||
two CSS checks in parallel; pre-push runs the Go suite and the UI tier,
|
||||
deliberately one after the other rather than together.
|
||||
|
||||
## Where the rest of the documentation is
|
||||
|
||||
- [`CLAUDE.md`](CLAUDE.md) — architecture and constraints, in depth.
|
||||
- [`docs/PROFILING.md`](docs/PROFILING.md) — Go pprof and frontend profiling.
|
||||
- [`docs/android-release.md`](docs/android-release.md) — the APK, its signing
|
||||
key, and what the release workflow checks.
|
||||
- [`docs/index-cache.md`](docs/index-cache.md) — the search-index build cache
|
||||
and why it has a snapshot.
|
||||
- [`packaging/arch/README.md`](packaging/arch/README.md),
|
||||
[`packaging/homebrew/README.md`](packaging/homebrew/README.md) — the two
|
||||
package channels.
|
||||
- `.planning/` — design documents and measured history, not a queue. The queue
|
||||
is the tracker.
|
||||
@@ -2,112 +2,139 @@
|
||||
|
||||
*Music how it was meant to bee.*
|
||||
|
||||
YellowJacket is a fast, cross-platform desktop music player for your local
|
||||
collection. It plays your files, keeps your library tidy, and helps you discover
|
||||
and organize your music — all in a clean, responsive interface. No accounts, no
|
||||
streaming, no telemetry: just your music on your machine.
|
||||
YellowJacket plays the music you already own. Point it at your folders and it
|
||||
scans them, reads the tags and the cover art, and gives you a library you can
|
||||
browse, search, queue and tidy up — on your own machine, with no account, no
|
||||
streaming service and no telemetry.
|
||||
|
||||
Runs on **Linux**, **macOS**, and **Windows**.
|
||||
It plays **MP3**, **FLAC**, **OGG Vorbis** and **WAV**, on **Linux** and
|
||||
**Android**, and builds from source on **macOS**.
|
||||
|
||||
## Features
|
||||

|
||||
|
||||
### Play your music
|
||||
- Plays **MP3, FLAC, OGG Vorbis, and WAV**
|
||||
- Play, pause, seek, and volume control with a mute toggle
|
||||
- Gapless, glitch-free seeking backed by a read-ahead buffer
|
||||
- A queue you can add to, reorder, and shuffle, with play-next support
|
||||
- Shuffle and repeat (off / all / one)
|
||||
- Picks up right where you left off — remembers your track, position, and volume between sessions
|
||||
- Media-key and MPRIS support on Linux, so your desktop's playback controls just work
|
||||
## What it does
|
||||
|
||||
### Keep your library organized
|
||||
- Point it at your music folders and it scans them automatically
|
||||
- Reads tags and embedded cover art, and de-duplicates artwork so it isn't stored twice
|
||||
- Incremental sync — only new or changed files get reprocessed, and deleted files are cleaned up
|
||||
- Browse by **album**, **artist**, or **genre**, or search across everything
|
||||
- Mark favorites and see what you've been listening to with play history
|
||||
- Edit track tags directly when something's off
|
||||
**Plays your files.** Play, pause, seek and volume with a mute toggle; a
|
||||
read-ahead buffer so seeking is instant rather than gappy; a queue you can add
|
||||
to, reorder and shuffle, with play-next; shuffle and repeat (off / all / one).
|
||||
It remembers the track, the position and the queue between sessions, and it
|
||||
answers your desktop's media keys — MPRIS on Linux, a media notification and
|
||||
lock-screen controls on Android.
|
||||
|
||||
### Playlists
|
||||
- Create playlists, drag tracks in, and reorder them
|
||||
- **Smart playlists** that build themselves from rules (by genre, rating, play count, and more)
|
||||
- Pin a default playlist and spot duplicate tracks at a glance
|
||||
**Keeps the library tidy.** It scans the folders you give it and rescans only
|
||||
what changed, so a big library costs its full scan once. It de-duplicates
|
||||
embedded cover art rather than storing the same image a hundred times, notices
|
||||
files that have gone away, and spots duplicate tracks. Browse by album, artist
|
||||
or genre, search across everything, mark favourites, and see what you have been
|
||||
playing.
|
||||
|
||||
### Discover and clean up (powered by MusicBrainz)
|
||||
- **Explore** — browse artists, releases, and genres from the MusicBrainz catalog, not just what's already in your library
|
||||
- **Auto-tag** — match your files against MusicBrainz to fill in correct artist, album, and track metadata, with a review step before anything is written
|
||||
- **Lyrics search** — find a track by a line you remember
|
||||
**Playlists, and playlists that write themselves.** Drag tracks in and reorder
|
||||
them, or describe what you want — genre, play count, how long since you played
|
||||
it — and let a smart playlist keep itself up to date.
|
||||
|
||||
**Explore and auto-tag, from the MusicBrainz catalog.** Explore browses artists,
|
||||
releases and genres from the catalog rather than only from what you own, so an
|
||||
album page can tell you that you have nine of its twelve tracks. Auto-tag
|
||||
matches your files against MusicBrainz and fills in the metadata that is
|
||||
missing, with a review step before anything is written to disk. Lyrics search
|
||||
finds a track from a line you remember.
|
||||
|
||||
Explore needs its catalog, which is a one-off ~0.6 GB download from
|
||||
**Settings → Search Index**. It asks first on a metered connection, and
|
||||
everything else in the app works without it.
|
||||
|
||||
## Install
|
||||
|
||||
Download the latest build for your platform from the
|
||||
Every download comes from the
|
||||
[releases page](https://git.ljones.me/yonlu/yellowjacket/releases).
|
||||
|
||||
| Platform | Download |
|
||||
|----------|----------|
|
||||
| Linux | `yellowjacket-linux-amd64` |
|
||||
| macOS | `yellowjacket-darwin-universal.app.zip` (Apple Silicon + Intel) |
|
||||
| Windows | `yellowjacket-windows-amd64.exe` |
|
||||
### Linux
|
||||
|
||||
Prefer to build it yourself? See [Building from source](#building-from-source).
|
||||
Download `yellowjacket-<version>-linux-amd64.tar.gz` from the latest release and
|
||||
unpack it. It holds the binary, a `.desktop` entry and an icon.
|
||||
|
||||
## Getting started
|
||||
On **Arch**, install it from the package registry instead and get updates with
|
||||
the rest of your system — the one-time key import and `pacman.conf` block are in
|
||||
[`packaging/arch/README.md`](packaging/arch/README.md):
|
||||
|
||||
```bash
|
||||
sudo pacman -Sy yellowjacket
|
||||
```
|
||||
|
||||
### Android
|
||||
|
||||
Install the APK from the release page, or from the URL below, which always
|
||||
points at the newest build:
|
||||
|
||||
```
|
||||
https://git.ljones.me/api/packages/yonlu/generic/yellowjacket-android/latest/yellowjacket.apk
|
||||
```
|
||||
|
||||
That URL needs no credentials, so [Obtainium](https://obtainium.imranr.dev/) can
|
||||
poll it directly and keep the app up to date. The build is `arm64-v8a` only, and
|
||||
[`docs/android-release.md`](docs/android-release.md) says why.
|
||||
|
||||
### macOS
|
||||
|
||||
Homebrew builds it from source on your own Mac — there is no prebuilt `.app`,
|
||||
because a signed macOS bundle needs a macOS machine to produce it and the
|
||||
release runner is a Linux container.
|
||||
|
||||
```bash
|
||||
brew install shadow-puppet/yellowjacket/yellowjacket
|
||||
```
|
||||
|
||||
See [`packaging/homebrew/README.md`](packaging/homebrew/README.md).
|
||||
|
||||
### Windows
|
||||
|
||||
Not published. It cross-compiles cleanly, but no Windows build of this app has
|
||||
ever been *run*, and nothing here can exercise one — so shipping it would be a
|
||||
promise that cannot be kept. You can still build it yourself: see
|
||||
[`CONTRIBUTING.md`](CONTRIBUTING.md).
|
||||
|
||||
### Coming from a 1.x install?
|
||||
|
||||
Versions restarted at **0.0.1** when releases became automatic, which every
|
||||
package manager reads as a downgrade. It costs one reinstall, once — the details
|
||||
are with each channel: [Homebrew](packaging/homebrew/README.md#upgrading-from-1x-needs-a-reinstall-once),
|
||||
[Android](docs/android-release.md#the-1x-installs-cannot-be-upgraded-to-00x).
|
||||
|
||||
## First run
|
||||
|
||||
1. Launch YellowJacket.
|
||||
2. Open **Settings** and add the folder(s) where your music lives.
|
||||
3. Let the initial scan finish — you'll see progress as it works.
|
||||
4. Browse by album, artist, or genre, queue something up, and press play.
|
||||
2. Add the folder your music lives in — the first-run wizard asks, and
|
||||
**Settings → Libraries** is where you add more later.
|
||||
3. Watch the scan finish. It reports progress, and you can browse while it runs.
|
||||
4. Queue something and press play.
|
||||
|
||||
Your library and settings are stored locally:
|
||||
Your library and settings stay on your machine:
|
||||
|
||||
| | Linux / macOS | Windows |
|
||||
|---|---|---|
|
||||
| Config | `~/.config/yellowjacket/` | `%LOCALAPPDATA%\yellowjacket\config` |
|
||||
| Library data | `~/.local/share/yellowjacket/` | `%LOCALAPPDATA%\yellowjacket\data` |
|
||||
|
||||
## Building from source
|
||||
Setting `YJ_HOME` moves both, which is how you keep a second library separate.
|
||||
|
||||
YellowJacket is built with [Go](https://go.dev/) and a
|
||||
[Lit](https://lit.dev/)/TypeScript frontend, bridged by the
|
||||
[Wails](https://wails.io/) framework.
|
||||
## More screenshots
|
||||
|
||||
**Prerequisites**
|
||||
An album page knows what you own, and says so:
|
||||
|
||||
| Tool | Version |
|
||||
|------|---------|
|
||||
| Go | 1.25+ |
|
||||
| Node.js | 22+ |
|
||||
| pnpm | 10+ |
|
||||
| Wails CLI | v3 — vendored, no install needed (`go tool wails3`) |
|
||||

|
||||
|
||||
The Wails v3 CLI resolves from the `tool` block in `go.mod`, so there is nothing
|
||||
to install globally; `make setup` fetches it with the rest of the tooling.
|
||||
The home page suggests somewhere to start rather than opening on a wall of
|
||||
everything:
|
||||
|
||||
On Linux, install the system libraries Wails needs. v3 builds against GTK4 +
|
||||
WebKitGTK 6.0 by default:
|
||||

|
||||
|
||||
```bash
|
||||
sudo apt-get install libasound2-dev libgtk-4-dev libwebkitgtk-6.0-dev # Debian/Ubuntu
|
||||
sudo pacman -S alsa-lib gtk4 webkitgtk-6.0 # Arch
|
||||
```
|
||||
## Contributing, and the rest of the documentation
|
||||
|
||||
A machine without `webkitgtk-6.0` can still build with `-tags gtk3` against the
|
||||
older WebKit2GTK 4.1 stack, but that is an escape hatch, not what CI or a
|
||||
release builds.
|
||||
|
||||
macOS and Windows need no extra system packages. Run `go tool wails3 doctor` to
|
||||
check your environment.
|
||||
|
||||
**Build**
|
||||
|
||||
```bash
|
||||
make setup # install tooling and git hooks
|
||||
make dev # run with hot-reload
|
||||
make build-prod # produce a release binary
|
||||
```
|
||||
|
||||
More detail for contributors lives in [`CLAUDE.md`](./CLAUDE.md) — the
|
||||
architecture, the conventions and the reasons behind them. What is
|
||||
being worked on is [the issue
|
||||
tracker](https://git.ljones.me/yonlu/yellowjacket/issues); #73 is the
|
||||
roadmap.
|
||||
- [`CONTRIBUTING.md`](CONTRIBUTING.md) — build it from source, run the tests,
|
||||
and how a change gets in.
|
||||
- [`CLAUDE.md`](CLAUDE.md) — the deep reference: the architecture and the reasons
|
||||
behind the shape of it.
|
||||
- [The issue tracker](https://git.ljones.me/yonlu/yellowjacket/issues) is what
|
||||
is wanted and what is being worked on; **#73** is the roadmap.
|
||||
- [Releases](https://git.ljones.me/yonlu/yellowjacket/releases) double as the
|
||||
changelog — every one is generated from the commits it contains.
|
||||
|
||||
@@ -63,12 +63,15 @@ func Parse(r io.Reader) ([]Chunk, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data := make([]byte, size)
|
||||
if _, err := io.ReadFull(r, data); err != nil {
|
||||
// Copied rather than allocated up front, as ID3Chunk does: the
|
||||
// size is four bytes off the file, so a truncated one is free to
|
||||
// declare a chunk larger than the whole of itself.
|
||||
var data bytes.Buffer
|
||||
if _, err := io.CopyN(&data, r, int64(size)); err != nil {
|
||||
return nil, fmt.Errorf("read chunk data for %q: %w", id, err)
|
||||
}
|
||||
|
||||
chunks = append(chunks, Chunk{ID: id, Data: data})
|
||||
chunks = append(chunks, Chunk{ID: id, Data: data.Bytes()})
|
||||
|
||||
// Odd-length chunks have a padding byte. Lenient: if the
|
||||
// read fails (e.g. EOF), just break rather than error.
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"yellowjacket/backend/riff"
|
||||
@@ -209,3 +210,45 @@ func TestParse_ReadsEveryChunkInOrder(t *testing.T) {
|
||||
t.Errorf("odd chunk data: got %q, want %q", chunks[1].Data, "INFOodd")
|
||||
}
|
||||
}
|
||||
|
||||
// A chunk size is four bytes read off the file, so a truncated or
|
||||
// malformed WAV is free to declare a chunk larger than the whole of
|
||||
// itself. Parse must grow with what arrives rather than with what was
|
||||
// claimed.
|
||||
//
|
||||
// This measures the allocation instead of the error because the error
|
||||
// is the same either way: a build sizing its buffer from the header
|
||||
// reports the truncation correctly, having asked the allocator for a
|
||||
// gigabyte on the way. Deliberately not parallel — TotalAlloc is
|
||||
// process-wide, and a test paused beside another one is measuring it
|
||||
// too.
|
||||
func TestParse_DoesNotAllocateWhatAChunkClaims(t *testing.T) {
|
||||
// Large enough that a header-sized buffer is unmistakable, in a
|
||||
// container of a few dozen bytes.
|
||||
const declared = 1 << 30
|
||||
|
||||
var raw bytes.Buffer
|
||||
|
||||
raw.WriteString("RIFF")
|
||||
_ = binary.Write(&raw, binary.LittleEndian, uint32(declared+12))
|
||||
raw.WriteString("WAVE")
|
||||
raw.WriteString("data")
|
||||
_ = binary.Write(&raw, binary.LittleEndian, uint32(declared))
|
||||
raw.WriteString("and then the file ends")
|
||||
|
||||
var before, after runtime.MemStats
|
||||
|
||||
runtime.GC()
|
||||
runtime.ReadMemStats(&before)
|
||||
|
||||
if _, err := riff.Parse(bytes.NewReader(raw.Bytes())); err == nil {
|
||||
t.Fatal("Parse: got nil error for a chunk larger than the file holding it")
|
||||
}
|
||||
|
||||
runtime.ReadMemStats(&after)
|
||||
|
||||
if grew := after.TotalAlloc - before.TotalAlloc; grew > 1<<20 {
|
||||
t.Errorf("Parse allocated %d bytes reading a %d-byte file whose chunk header claimed %d",
|
||||
grew, raw.Len(), declared)
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 285 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 128 KiB |
@@ -157,6 +157,62 @@ test.describe('an overlaid queue says it is over the content', () => {
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* #170 — the other two buttons in that same row.
|
||||
*
|
||||
* Clear queue and Add queue to playlist predate the close button and
|
||||
* were named by a `title` attribute and nothing else. Unlike the
|
||||
* sliders in `control-names.spec.ts`, that is not a *missing* name:
|
||||
* `title` is the last fallback in the accname order, so
|
||||
* `getByRole('button', { name: 'Clear queue' })` matched them before
|
||||
* this fix as well as after it — measured, 1 and 1. A sweep for empty
|
||||
* names cannot see a weak one, which is `a11y.26`'s complaint and the
|
||||
* reason this file could have grown a green test that proved nothing.
|
||||
*
|
||||
* So the name is asserted twice, and the second assertion is the one
|
||||
* that fails on the broken build. Taking the tooltip away and asking
|
||||
* again is the property in words: **the name is not the tooltip**. It
|
||||
* is what makes the button survive content being put inside it later,
|
||||
* and it is the only one of the two a phone has — there is no hover on
|
||||
* the surface #55 turned into a full screen. Measured on `main` before
|
||||
* the fix: 0 and 0.
|
||||
*
|
||||
* Both buttons are disabled here, because the queue starts empty and
|
||||
* naming is not enablement. A disabled button is still in the
|
||||
* accessibility tree, which is exactly where the complaint was.
|
||||
*/
|
||||
test.describe('the queue header says what its actions do', () => {
|
||||
const ACTIONS = ['Clear queue', 'Add queue to playlist'];
|
||||
|
||||
test('names both of the older actions', async ({ app }) => {
|
||||
await openQueue(app);
|
||||
|
||||
for (const name of ACTIONS) {
|
||||
await expect(
|
||||
app.getByRole('button', { name, exact: true }),
|
||||
).toHaveCount(1);
|
||||
}
|
||||
});
|
||||
|
||||
test('and the names do not come from the tooltip', async ({ app }) => {
|
||||
await openQueue(app);
|
||||
|
||||
await app.locator('#queue-panel').evaluate((el) => {
|
||||
for (const button of el.shadowRoot!.querySelectorAll(
|
||||
'.header-action-button',
|
||||
)) {
|
||||
button.removeAttribute('title');
|
||||
}
|
||||
});
|
||||
|
||||
for (const name of ACTIONS) {
|
||||
await expect(
|
||||
app.getByRole('button', { name, exact: true }),
|
||||
).toHaveCount(1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* The inline panel is the mode that already worked, and the one every
|
||||
* other queue spec is written against. It keeps its resize handle and
|
||||
|
||||
@@ -103,12 +103,17 @@ async function queueSixAndOpen(app: Page): Promise<void> {
|
||||
*
|
||||
* `explore-link` routes a track name to its *album's* page, so a
|
||||
* track with no album renders a name that navigates nowhere — and
|
||||
* the fixture library deliberately contains two (`01 Tone A`,
|
||||
* `02 Tone B`). Which tracks arrive first is `audio_files.id`
|
||||
* order, i.e. the order the **scan** inserted them, which depends
|
||||
* on concurrency and directory traversal: locally the first eight
|
||||
* all had albums and the spec passed twice over, and CI rebuilds
|
||||
* its seed with a real scan and got a different eight.
|
||||
* the fixture library deliberately contains two,
|
||||
* `unsorted/no-tags-at-all.mp3` and `unsorted/title-only.mp3`.
|
||||
* (It contained four until #104: the two WAVs under `Field
|
||||
* Recordings/Test Tones` had been tagged on disk all along and
|
||||
* scan in with their album now, so they are ordinary tracks and
|
||||
* not examples of this.) Which tracks arrive first is
|
||||
* `audio_files.id` order, i.e. the order the **scan** inserted
|
||||
* them, which depends on concurrency and directory traversal:
|
||||
* locally the first eight all had albums and the spec passed twice
|
||||
* over, and CI rebuilds its seed with a real scan and got a
|
||||
* different eight.
|
||||
*
|
||||
* Asking for what the test needs is the fix. It is not a
|
||||
* narrowing: every assertion here wants an ordinary track, and
|
||||
|
||||
@@ -51,7 +51,7 @@ import type { BackgroundShade } from '@store/theme-store';
|
||||
import type { IconStyle } from '@store/favorites-store';
|
||||
import {
|
||||
COLUMN_DEFS,
|
||||
ALL_COLUMN_IDS,
|
||||
CONFIGURABLE_COLUMN_IDS,
|
||||
} from '@components/track-list/columns';
|
||||
|
||||
import './config-field';
|
||||
@@ -1640,7 +1640,7 @@ export class ConfigPage extends ViewLifecycleMixin(LitElement) {
|
||||
...this.trackListCtrl.columnIds,
|
||||
];
|
||||
|
||||
const disabledIds = ALL_COLUMN_IDS.filter(
|
||||
const disabledIds = CONFIGURABLE_COLUMN_IDS.filter(
|
||||
(id) => !enabledIds.includes(id),
|
||||
);
|
||||
|
||||
|
||||
@@ -2201,11 +2201,25 @@ export class QueuePanel
|
||||
`
|
||||
: nothing}
|
||||
</div>
|
||||
<!-- **Every action here is named by aria-label**, like
|
||||
the close button #24 added beside them (#170). A
|
||||
title alone *is* a name, which is why a sweep for
|
||||
empty names reports these clean and why an
|
||||
assertion by role and name is green either way --
|
||||
but it is the weakest one: title is the last
|
||||
fallback in the accname order, so any content put
|
||||
inside the button later silently outranks it, and
|
||||
a phone has no hover to show it as a tooltip.
|
||||
|
||||
The titles stay. On a desktop they are the tooltip
|
||||
for an icon-only control, which is a different job
|
||||
from naming it, and aria-label does not do it. -->
|
||||
<div class="header-actions">
|
||||
<button
|
||||
class="header-action-button"
|
||||
@click=${() => void this.handleClearQueue()}
|
||||
?disabled=${tracks.length === 0}
|
||||
aria-label="Clear queue"
|
||||
title="Clear queue"
|
||||
>
|
||||
<wa-icon
|
||||
@@ -2216,6 +2230,7 @@ export class QueuePanel
|
||||
class="header-action-button add-to-playlist-button"
|
||||
@click=${this.handleAddToPlaylist}
|
||||
?disabled=${tracks.length === 0}
|
||||
aria-label="Add queue to playlist"
|
||||
title="Add queue to playlist"
|
||||
>
|
||||
<wa-icon
|
||||
|
||||
@@ -32,6 +32,18 @@ export interface ColumnDef {
|
||||
id: string;
|
||||
/** Human-readable header label. */
|
||||
label: string;
|
||||
/**
|
||||
* Whether Settings may offer this column. Defaults to true.
|
||||
*
|
||||
* A definition is not the same thing as a *choice*. `titleArtist`
|
||||
* is the phone's stacked column, picked by width in
|
||||
* `PHONE_COLUMN_IDS`, and `tracklist.AllColumnIDs` in Go does not
|
||||
* list it — so a tick in the configurator sends a column set the
|
||||
* backend rejects with `unknown track-list column ID`, the tick
|
||||
* reverts on the next render, and the only trace is a
|
||||
* `console.error` (#197).
|
||||
*/
|
||||
configurable?: boolean;
|
||||
/** Extracts the display value from a track. */
|
||||
accessor: (track: library.Track) => string;
|
||||
/** Default CSS width (used when no saved width exists). */
|
||||
@@ -98,11 +110,16 @@ export const COLUMN_DEFS: Record<string, ColumnDef> = {
|
||||
},
|
||||
titleArtist: {
|
||||
id: 'titleArtist',
|
||||
// Named for what it sorts by, since that is the only place the
|
||||
// label is user-visible: the phone has no column headers, and
|
||||
// the page header's sort list is built from the *configured*
|
||||
// columns rather than the drawn ones.
|
||||
// Named for what it sorts by. That label is drawn nowhere
|
||||
// today: the phone has no column headers, and the page header's
|
||||
// sort list is built from the *configured* columns, which this
|
||||
// one can never be — see `configurable` below.
|
||||
label: 'Track Name',
|
||||
// Chosen by width, never by the user, and rejected by the
|
||||
// backend if it ever were. #197: Settings listed it anyway, so
|
||||
// there were two rows called "Track Name" and the second one
|
||||
// could not be selected.
|
||||
configurable: false,
|
||||
accessor: (t) => t.TrackName,
|
||||
defaultWidth: '1fr',
|
||||
comparator: (a, b) => compareStr(a.TrackName, b.TrackName),
|
||||
@@ -266,10 +283,15 @@ export const COLUMN_DEFS: Record<string, ColumnDef> = {
|
||||
};
|
||||
|
||||
/**
|
||||
* All column IDs in default display order.
|
||||
* Used by the settings UI to list available columns.
|
||||
* The column IDs Settings may offer, in default display order.
|
||||
*
|
||||
* Not every definition is one: a column the user cannot choose has no
|
||||
* row in the configurator, because a checkbox that cannot change
|
||||
* anything is worse than an absent one — see `ColumnDef.configurable`.
|
||||
*/
|
||||
export const ALL_COLUMN_IDS: string[] = Object.keys(COLUMN_DEFS);
|
||||
export const CONFIGURABLE_COLUMN_IDS: string[] = Object.keys(
|
||||
COLUMN_DEFS,
|
||||
).filter((id) => COLUMN_DEFS[id]?.configurable !== false);
|
||||
|
||||
/**
|
||||
* Column IDs that are always searched regardless of visibility.
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
/**
|
||||
* Settings offers the columns the backend will accept, and no others.
|
||||
*
|
||||
* The list is built from `COLUMN_DEFS`, which is the *drawing* table:
|
||||
* every definition the track list knows how to render, including
|
||||
* `titleArtist` — the phone's stacked column, chosen by width in
|
||||
* `PHONE_COLUMN_IDS` and never by a person. `tracklist.AllColumnIDs` in
|
||||
* Go does not list that id, so the configurator offered a nineteenth
|
||||
* row that could not be ticked:
|
||||
*
|
||||
* ```
|
||||
* validate = unknown track-list column ID: "titleArtist"
|
||||
* titleArtist valid = false
|
||||
* ```
|
||||
*
|
||||
* What a user saw was **two rows both called "Track Name"** (#197), one
|
||||
* of which did nothing — and a screen reader heard "Show the Track Name
|
||||
* column" twice with nothing to tell them apart, which is `a11y.32`'s
|
||||
* complaint inside the list that was fixed for exactly that.
|
||||
*
|
||||
* It is worse than an inert control, which is why the duplicate name
|
||||
* was not the thing to fix. `SetTrackListColumns` assigns before it
|
||||
* validates, so a rejected list stays in memory and `Save()` validates
|
||||
* the whole config:
|
||||
*
|
||||
* ```
|
||||
* later, unrelated SetThemeAccentColor = could not save config: invalid
|
||||
* config: ... unknown track-list column ID: "titleArtist"
|
||||
* ```
|
||||
*
|
||||
* — one tick and no setting saves for the rest of the session. That
|
||||
* half is filed separately; this file keeps the row from being offered.
|
||||
*
|
||||
* The last test is the one that would have caught it when the column
|
||||
* was added: the two lists are in different languages, so nothing but a
|
||||
* sweep can hold them together.
|
||||
*/
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
import '@components/config-page/config-page';
|
||||
|
||||
import {
|
||||
COLUMN_DEFS,
|
||||
CONFIGURABLE_COLUMN_IDS,
|
||||
} from '@components/track-list/columns';
|
||||
import { flush, stub } from '@test/support/harness';
|
||||
import { fixture, shadowAll } from '@test/support/render';
|
||||
|
||||
/** Go's own list of column ids, as text. */
|
||||
const GO_CONFIG = Object.values(
|
||||
import.meta.glob<string>('../../../backend/tracklist/config.go', {
|
||||
eager: true,
|
||||
query: '?raw',
|
||||
import: 'default',
|
||||
}),
|
||||
)[0];
|
||||
|
||||
/**
|
||||
* The ids `tracklist.AllColumnIDs` actually contains.
|
||||
*
|
||||
* Read out of the source rather than written down here, because a
|
||||
* third copy of this list is a third thing to forget — which is the
|
||||
* defect, one copy earlier.
|
||||
*/
|
||||
function goColumnIDs(source: string): string[] {
|
||||
const constants = new Map<string, string>();
|
||||
const constBlock = /const \(([\s\S]*?)\n\)/.exec(source)?.[1] ?? '';
|
||||
|
||||
for (const [, name, id] of constBlock.matchAll(
|
||||
/(\w+)\s+ColumnID\s*=\s*"([^"]+)"/g,
|
||||
)) {
|
||||
constants.set(name!, id!);
|
||||
}
|
||||
|
||||
const listBlock =
|
||||
/var AllColumnIDs = \[\]ColumnID\{([\s\S]*?)\n\}/.exec(source)?.[1] ?? '';
|
||||
|
||||
return [...listBlock.matchAll(/(\w+),/g)]
|
||||
.map(([, name]) => constants.get(name!))
|
||||
.filter((id): id is string => id !== undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* The column rows, and only those.
|
||||
*
|
||||
* Settings’ view-visibility list (#25) is drawn with the same two
|
||||
* classes, so a bare `.column-label` sweeps 29 rows across two
|
||||
* sections — and "Albums" the destination sitting beside "Album" the
|
||||
* column is not the fault this file is about. The `for`/`id` prefix is
|
||||
* what tells them apart.
|
||||
*/
|
||||
const COLUMN_ROW_LABEL = 'label.column-label[for^="column-"]';
|
||||
const COLUMN_ROW_BOX = 'input.column-toggle[id^="column-"]';
|
||||
|
||||
/** The rows the configurator draws, by their visible name. */
|
||||
async function columnRowNames(): Promise<string[]> {
|
||||
const page = await fixture('config-page');
|
||||
|
||||
await flush();
|
||||
await page.updateComplete;
|
||||
|
||||
// Every section renders collapsed, and a collapsed body is `hidden`.
|
||||
for (const section of shadowAll<HTMLElement>(page, 'config-section')) {
|
||||
section.shadowRoot
|
||||
?.querySelector<HTMLButtonElement>('button[aria-expanded="false"]')
|
||||
?.click();
|
||||
}
|
||||
|
||||
await flush();
|
||||
await page.updateComplete;
|
||||
|
||||
return shadowAll<HTMLElement>(page, COLUMN_ROW_LABEL).map(
|
||||
(label) => label.textContent?.trim() ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
describe('the Settings column list', () => {
|
||||
beforeEach(() => {
|
||||
for (const path of [
|
||||
'library.Library.GetAllLibrariesWithTrackCounts',
|
||||
'jobs.Service.GetJobs',
|
||||
'download.Service.ListProviders',
|
||||
'download.Service.ProviderKinds',
|
||||
]) {
|
||||
stub(path, []);
|
||||
}
|
||||
|
||||
stub('config.Config.GetShortcuts', {});
|
||||
stub('config.Config.GetDownloadPreferences', {});
|
||||
stub('config.Config.GetThemeAccentColor', '#ffd43b');
|
||||
stub('config.Config.GetThemeBackgroundShade', 'dark');
|
||||
});
|
||||
|
||||
it('names each row once', async () => {
|
||||
const names = await columnRowNames();
|
||||
|
||||
// A sweep over nothing passes.
|
||||
expect(names.length, 'the page draws column rows').toBeGreaterThan(5);
|
||||
|
||||
const seen = new Set<string>();
|
||||
const duplicated = names.filter((name) => !seen.add(name));
|
||||
|
||||
expect(duplicated).toEqual([]);
|
||||
expect(names.filter((n) => n === 'Track Name')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('gives each checkbox a name that identifies it', async () => {
|
||||
// The visible half above is what was reported; this is the half a
|
||||
// screen reader gets, and it is the one `config-page` computes
|
||||
// from the same string.
|
||||
const page = await fixture('config-page');
|
||||
|
||||
await flush();
|
||||
await page.updateComplete;
|
||||
|
||||
const labels = shadowAll<HTMLInputElement>(page, COLUMN_ROW_BOX).map(
|
||||
(box) => box.getAttribute('aria-label') ?? '',
|
||||
);
|
||||
|
||||
expect(labels.length, 'the page draws column checkboxes').toBeGreaterThan(5);
|
||||
expect(new Set(labels).size).toBe(labels.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the column table', () => {
|
||||
it('offers no column the backend would reject', async () => {
|
||||
const accepted = goColumnIDs(GO_CONFIG ?? '');
|
||||
|
||||
// Two non-vacuity guards: a glob that stopped matching, and a
|
||||
// parse that stopped finding the list it names.
|
||||
expect(GO_CONFIG, 'backend/tracklist/config.go is readable').toBeTruthy();
|
||||
expect(accepted.length, 'AllColumnIDs was parsed').toBeGreaterThan(10);
|
||||
|
||||
expect(
|
||||
CONFIGURABLE_COLUMN_IDS.filter((id) => !accepted.includes(id)),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it('still knows how to draw every column it offers', async () => {
|
||||
// The filter must not have taken a column *out* of the drawing
|
||||
// table: `configurable` says what Settings may list, not what the
|
||||
// list may render.
|
||||
expect(
|
||||
CONFIGURABLE_COLUMN_IDS.filter((id) => COLUMN_DEFS[id] === undefined),
|
||||
).toEqual([]);
|
||||
expect(CONFIGURABLE_COLUMN_IDS).not.toContain('titleArtist');
|
||||
expect(COLUMN_DEFS['titleArtist'], 'the phone still has its column')
|
||||
.toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user