fix(stats): harden server lifecycle and verify compiled runtime (#261)

This commit is contained in:
2026-09-20 23:19:03 -07:00
committed by GitHub
parent f9c4e892dc
commit 383aed8bad
37 changed files with 1381 additions and 323 deletions
+28 -3
View File
@@ -22,9 +22,15 @@ Read when: selecting the right verification lane for a change
pull requests, stable tags, and prerelease tags. Keep common quality steps
there instead of copying them into caller workflows.
- The reusable gate installs Lua and runs `bun run test:env`, so the shipped mpv
plugin tests run for every pull request and tagged release.
plugin tests and launcher smoke run for every pull request and tagged release.
Lua installation uses only the runner's Ubuntu package sources so unrelated
third-party repository failures do not block the gate.
- In the reusable gate, `test:coverage:src` is also the blocking execution of the
discovered `src/**` test lane. The coverage runner returns the failing test's
status, so CI does not rerun that lane through `test:fast`. Launcher unit and
script tests still run separately because they are outside the coverage lane.
- Launcher smoke artifacts are uploaded after `test:env` fails. CI does not rerun
launcher smoke solely to collect the same artifacts.
## Default Handoff Gate
@@ -49,7 +55,7 @@ bun run docs:build
- Internal KB, `AGENTS.md`, or `.agents/skills/**` changes: `bun run test:docs:kb`
- Config/schema/defaults: `bun run test:config`, then `bun run generate:config-example` if template/defaults changed
- Launcher/plugin: `bun run test:launcher` or `bun run test:env`
- Runtime-compat / compiled behavior: `bun run test:runtime:compat`
- Runtime-compat / compiled behavior after `bun run build`: `bun run test:runtime:compat`
- Stats dashboard UI: `bun run test:stats`
- Build/release scripts (`scripts/**`): `bun run test:scripts`
- Packaging: build the platform package, then run `bun run test:package <resources-directory>`.
@@ -62,11 +68,30 @@ bun run docs:build
## Coverage Reporting
- `bun run test:coverage:src` runs the maintained `test:src` lane through a sharded coverage runner: one Bun coverage process per test file, then merged LCOV output.
- `bun run test:coverage:src` runs the same discovered `bun-src-full` membership as
`test:src` through a sharded coverage runner: one Bun coverage process per test
file, then merged LCOV output.
- A failing coverage shard stops the runner with a nonzero status. Coverage is a
source test gate, not a report-only step.
- Machine-readable output lands at `coverage/test-src/lcov.info`.
- Every reusable quality-gate run uploads that LCOV file as the
`coverage-test-src` artifact.
## Compiled Runtime Smoke
- `bun run test:smoke:dist` and its `test:runtime:compat` alias require an existing
full build and fail with the missing artifact paths when `dist/` or the stats UI
bundle is absent.
- The check runs the emitted stats daemon under Electron's Node runtime. It opens
the production HTTP server, queries the overview endpoint through native
libsql-backed storage, and leaves an HTTP request body unfinished before
shutting the daemon down. It verifies a clean exit and that the port and
ownership state are released despite the unfinished request.
- The check also occupies the configured port, requires startup to fail without
stale ownership state, releases the conflict, and verifies a clean retry.
- This is not a full Electron UI startup check. It does not require a display and
makes no claims about renderer, window, tray, or mpv behavior.
## Dependency Audit Policy
- `bun audit --audit-level high` blocks the reusable quality gate.