Development
DDEV
ddev startThe post-start hook installs everything, builds the assets, sets up the db and test databases and seeds them. The agent runs as a DDEV daemon on its simulated backend: there is no Bluetooth or Wi-Fi in a container.
- Site: https://boombox.ddev.site, log in as
owner/Password.1 - Backend: https://boombox.ddev.site/typo3,
admin/Password.1
Steering the simulated speaker
ddev boombox-sim phone_connect '{"name":"Pixel 9"}' # a paired phone connects and plays
ddev boombox-sim track '{"title":"Weird Fishes","artist":"Radiohead","duration":318000}'
ddev boombox-sim seek '{"position":120000}'
ddev boombox-sim pair_request '{"name":"iPhone"}' # only while pairing mode is on
ddev boombox-sim phone_disconnect
ddev boombox-sim phone_disconnect '{"away":true}' # out of range: connecting it fails
ddev boombox-sim wifi_networks '{"networks":[{"ssid":"Lab","signal":70,"security":"wpa-psk"}]}'
ddev boombox-sim wifi_drop # the setup AP opens after the fallback time
ddev boombox-sim ap_clients '{"count":1}'
ddev boombox-sim adapter '{"present":false}' # Bluetooth driver missing
ddev boombox-sim card_insert '{"uuid":"1A2B-3C4D","label":"PARTY"}' # an SD card is plugged in
ddev boombox-sim card_remove '{"uuid":"1A2B-3C4D"}'
ddev boombox-sim state # the whole simulated world
ddev boombox-sim reset
ddev boombox-agent client state.get # ask the agent anything
ddev boombox-agent restartIn the simulator, the Wi-Fi password wrongpass always fails and the network Unreachable never connects.
Frontend assets
ddev npm run build:production # what the device gets
ddev vite # dev server with hot reloadFrankenPHP's workers keep the Vite manifest in memory: after a build, restart them as described under Tests, or pages keep pointing at the old file names.
The page's colours are CSS custom properties (--boombox-*, in packages/boombox/Resources/Private/Assets/Css/app.css), with light and dark values. The elements read the same properties through their shadow DOM, so a token changes the site and the elements together. Tests/playwright/specs/design.spec.ts checks the layout; a11y.spec.ts runs axe on every page in both modes (see Accessibility).
The elements are Lit components in packages/boombox-speaker/Resources/Private/Assets/JavaScript/. They share one store (store.ts): it takes the session, follows the Mercure hub, and polls whenever push is not confirmed.
Icons are SVG files in packages/boombox-speaker/Resources/Private/Assets/Icons/, drawn in currentColor. Vite builds them into its manifest, and Configuration/Icons.php registers each as boombox-ui-<name> with the asset collector's SvgIconProvider, so Fluid renders them inline:
<core:icon identifier="boombox-ui-close" alternativeMarkupIdentifier="inline"/>The elements take the same files from icons.ts (icon('close')). A new icon goes into the folder, icons.ts and Icons.php; Tests/JavaScript/icons.test.ts checks that all three agree. npm test runs with Tests/JavaScript/vite-imports.ts, which resolves EXT: and ?raw imports as Vite does.
All scripts are TypeScript, strict: the pages and the backend modules, their tests, the Playwright specs and the configs. Nothing compiles it ahead: Vite bundles it, and Node strips the types when it runs the unit tests and the seed import. So the code keeps to what can be stripped (erasableSyntaxOnly: no enums, no parameter properties, no decorators; Lit's reactive properties are static properties with a declare field each), and imports name the .ts file. What the speaker sends is typed in Assets/JavaScript/types.ts: one type per store section and the result of each API route. ddev npm run typecheck (tsc --noEmit) checks it all; CI runs it too.
Tests
| Suite | Command | What it covers |
|---|---|---|
| PHP unit | ddev exec vendor/bin/phpunit --testsuite unit | Agent: protocol, validation, every service, the socket server, the Linux backends against fixtures, the process runner, resilience. Extension: guard, tokens, API middleware. |
| TypeScript | ddev npm test, ddev npm run typecheck | The store's push/poll switching, ordering and CSRF; formatting; the types of every script. |
| End to end | ddev playwright test | Login, API guard, captive portal, every element against the simulated speaker, live updates by push and by polling. Every spec runs on a desktop (1280 px); the specs about layout (LAYOUT_SPECS in playwright.config.ts) also on a tablet (820 px) and a phone (Pixel 7). --project=phone runs one size. layout.spec.ts checks sideways scrolling and 44 px touch targets, the a11y*.spec.ts specs check WCAG 2.2 AA: axe on every page and state, keyboard focus, names and announcements (Accessibility). |
| Home Assistant | packages/boombox-agent/tests/Interop/run.sh (on the host) | The ESPHome API against aioesphomeapi, Home Assistant's own client: adoption, keys, entities, announcements. See Home Assistant. |
| Static | ddev exec vendor/bin/phpstan analyse -c .phpstan.neon, ddev exec vendor/bin/php-cs-fixer fix --dry-run, shellcheck deploy/device/install.sh |
Playwright runs against an isolated test database (header X-Test-Run), and each spec resets the simulated speaker in beforeEach.
FrankenPHP runs TYPO3 in worker mode, which keeps the TCA and Vite's manifest in memory. After a frontend build or a TCA change, flush the caches and restart the worker (or run ddev restart), or pages still load the old files. The same goes for a changed PHP class or service: the workers and the compiled container keep the old one.
ddev npm run build:development
ddev typo3 cache:flush
ddev exec supervisorctl restart webextradaemons:frankenphpA new setting needs a description: a <p class="hint" id="…"> next to the control and aria-describedby on the control (toggle() takes it as describedBy). a11y.spec.ts fails otherwise. The other patterns a control follows are in Accessibility.
The Linux backend's fixtures in packages/boombox-agent/tests/Fixtures/linux follow the documented output of busctl, nmcli, /proc/asound/cards and iproute2. When the real board shows a difference, capture the real output there and adjust the parser.
Emulated device
ddev npm run build:production
deploy/device/test/emulate.sh # install, check, remove
deploy/device/test/emulate.sh --keep # leave it on http://localhost:8090This boots Debian trixie (arm64, systemd) in Docker, builds the package (make deb) and installs it with boombox-setup.sh, the hardware preseeded, as on a fresh speaker. Then it checks:
- the services, the socket permissions and the secrets;
- SQLite in WAL mode;
- the login and the restricted pages;
- the API guard, the captive portal redirects and the Mercure hub;
- a real login as
ownerwith the setup secret; - that a second install changes nothing;
- that an upgrade keeps the answers and moves to a new release, the web server with it; five releases are kept, all root's;
- that a
deployuser left from shippy is removed, its files passed to root.
There are no radios in the container, so it also proves the agent copes with a missing Bluetooth adapter. On an Apple silicon Mac it runs natively.
Debian package
make deb # dist/boombox_<last tag>+dev<time>_all.deb and dist/boombox-setup.sh
make deb VERSION=1.2.0 # dist/boombox_1.2.0_all.deb
make deb NPM=npm # the assets without DDEV
make deb NPM=: # the assets in public/_assets/vite as they are
make install HOSTS=root@boombox.local # build, copy and install (below)
make cleanIt builds the assets, then runs composer install --no-dev and deploy/package/build-deb.sh in the composer:2.8 image on a clean copy of the tree, as the pipeline does: the checkout keeps its dev packages. It needs Docker. The emulator's --package mode builds in dist/ too, so the two do not run at the same time.
Trying a build on the speaker
make install builds the assets and the package, copies it to each speaker and installs it there: as an upgrade where the package is installed, otherwise through boombox-setup.sh, which adds the PHP repository first. A user other than root needs sudo on the speaker.
make install HOSTS=root@boombox.local
make install HOSTS="root@kitchen.local pi@garden.local" # one after the otherWithout VERSION the build is the last tag plus the time (1.0.2+dev20261020153000): above the release the speaker runs, below the next one, which replaces it as an upgrade. A version of your own works the same way: 1.2.1~test1 sorts before 1.2.1.
By hand, the same steps:
make deb VERSION=1.2.1~test1
scp dist/boombox_1.2.1~test1_all.deb dist/boombox-setup.sh root@boombox.local:
# A fresh board: adds the PHP repository, then installs
ssh root@boombox.local 'bash boombox-setup.sh ./boombox_1.2.1~test1_all.deb'
# A board with the package already: an upgrade
ssh root@boombox.local 'apt install ./boombox_1.2.1~test1_all.deb'An upgrade asks only the hardware questions it has not seen; dpkg-reconfigure boombox asks them all again.
The pipeline builds it in package_deb for every tag, and wherever the packaging changes. For a tag, upload_deb then puts it and boombox-setup.sh in the generic package registry, under boombox/<tag without v>/, once every test passed. Then release creates the tag's GitLab release (Deploy → Releases) with both files and the package's page in the registry linked, and a changelog: the commits since the tag before, grouped by the type in their subject ([SECURITY], [FEATURE], [BUGFIX], [TASK], [DOCS]; others under "Other"), merge commits left out. To see it before tagging:
deploy/package/release-notes.sh HEADReleases are signed: CI signs each published file's checksum with the project's release key, and speakers install only what it signed. How the key is made, stored in GitLab, changed or given up: deploy/package/README.md.
The package asks for the hardware with debconf (deploy/package/templates, config); its postinst runs install.sh --package with the answers, which sets up the system and the release without calling apt: everything --system installs is in the package's Depends. PHP comes from pkg.henderkes.com, which boombox-setup.sh adds before the first install. To release, tag main:
git tag 1.0.3 && git push origin 1.0.3Repository layout
packages/boombox-agent/ agent library and daemon (bin/boombox-agent)
src/Protocol/ NDJSON codec, request, validation
src/Service/ policies: player, bluetooth, audio, wifi, system
src/Backend/Linux/ BlueZ, bluez-alsa, ALSA, NetworkManager, systemd
src/Backend/Simulated/ the simulated speaker
src/Daemon/ composition root, socket server, runner
packages/boombox-speaker/ EXT:boombox_speaker
Classes/Middleware/ /api/boombox/ and the captive portal
Classes/Security/ guard, CSRF, Mercure subscriber token
Resources/Private/Assets/ Lit elements
packages/boombox/ site package, and the backend's Boombox group
packages/insights/ EXT:insights, the Insights backend module
packages/model-viewer/ EXT:model_viewer, the Model viewer backend module
deploy/device/ install.sh, device files, emulated-device test
deploy/package/ the Debian package: build-deb.sh, postinst
Tests/playwright/ end-to-end specs and fixtures (the extensions' own: packages/*/Tests/Playwright)
Documentation/ this documentationDocumentation site
npm run docs:dev serves this folder as a site with VitePress (docs-site/), npm run docs:build builds it. On the default branch the pages job publishes it to GitLab Pages.
Pinned images and sources
The pipeline's images are pinned by digest beside their tag (composer:2.8@sha256:…), UxPlay's build checks the commit its tag names (UXPLAY_COMMIT), and the Armbian image is built from a commit (ARMBIAN_REF in deploy/image/build.sh). To move one on, look up the new digest with docker buildx imagetools inspect <image:tag>, or the commit with git ls-remote <repository> <ref>, and put it in its place.