Skip to content

feat(devices): pair hardware listeners with Sanctum - #238

Merged
i098 merged 38 commits into
mainfrom
fm/sanctum-any-device
Nov 23, 2026
Merged

i098 merged 38 commits into
mainfrom
fm/sanctum-any-device

Conversation

@i098

@i098 i098 commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Closes #237

Summary

Sanctum previously needed an open browser tab to record. A Linux device can now pair from the website and record with a microphone and a status light or small screen. Other hardware can use the device protocol. The website keeps its fullscreen listening view.

What changed and why

The hardware listener opens the microphone only when it can show the recording state. It buffers audio during a network outage. Removing the device from Settings revokes its credential. Provisional meetings remain private to the person who paired the device.

A hardware credential can use only its own listeners. If a chunk fails permanently, the device keeps it locally and uploads later chunks.

Related task

Hardware listener setup and the device protocol describe the new client.

Test evidence

  • V1 through V7 passed on ARM64 Linux under QEMU before the review cuts.
  • The hosted Linux client replay passed V1 through V7 on db5bafb0 with Chromium, disposable MySQL, and synthetic audio.
  • Both devices paired and produced a transcript. The light route preserved 992,000 samples across a 10-second outage.
  • The hosted application checks passed on 60d3424 after the pairing fixture update.
  • The hosted browser proof passed 14 tests, including the two unchanged listening specs.
  • Seven pairing tests passed in Chromium after the repairs. They cover sign-in return, code lockout, and a missing CSRF cookie.
  • Nine device API and ingest tests passed on disposable MySQL. They cover access that ends during an upgrade and revocation during capture.
  • The hosted device job passed formatting, Clippy, 24 Rust tests, and V1 through V7 on 60d3424.
  • On fd53a0d4, 10 device API and ingest tests passed against MySQL via HTTP and WebSocket connections.
  • On the same commit, the locally built Linux x86-64 listener passed V1 through V7 with Chromium and fixture audio.
  • Chromium exercised /pair at 320 pixels against the same API build. It verified wrong codes, lockout, and refusal when the CSRF cookie was absent.
  • Chromium showed all eight kiosk states at 240 × 240 and 320 × 240 from the Rust status feed. Both views cleared the listening state when the feed stopped.
  • The application and quality checks passed on fd53a0d4 after a title-only repair. The device job passed on the same commit.
  • Local evidence: live-proof/test-gate-receipt.txt, live-proof/server-guards.log, live-proof/pairing-browser-shared-db.log, live-proof/kiosk-live-browser.log, and live-proof/device-replay.log.
  • V8 did not run because the development stack had no speech-to-text settings. This test does not verify a physical microphone or LED. No deployment or production migration ran.

The first no-mistakes run, 01M8486BF5FST9JK3E9V56HK7Y, failed when the review repair exceeded its one-hour limit.
The branch preserves both commits from that run.
The recovery run, 01M84MYNXJMQH60J0EZSXX125Y, started on 60d3424.
The validator recorded a test exception for its first inconclusive result. Separate runs on fd53a0d4 supplied the four missing live checks above.

Release limits

  • A live socket on another API process closes on its next authorization check after revocation.
  • The kiosk confirms delivery to a local connection. The client cannot confirm that the physical display shows the page.

Review decisions

  • Keep pairing link prefills. Approval shows the exact code and asks the person to check their device.
  • Keep direct mode for local and private networks. Deployments behind Caddy or Cloudflare use the documented trusted ingress mode.
  • Keep unuploaded audio on revocation. Revocation blocks capture and upload; it does not authorize deletion of the device's local files.
  • Count crash staging files toward the buffer limit. Do not delete them automatically because they can contain recoverable audio.
  • Keep custom capture commands quiet. Their error output can contain secrets; the built-in ALSA input logs errors.
  • Keep the loopback-only kiosk address and document 127.0.0.1:7171. Keep the waveform unchanged: it uses bands, not the overall level.
  • Keep the capability field for integrations with speakers. The reference client does not play audio.
  • Keep the device CI check on all target pull requests. Changes in shared server and browser modules can affect hardware capture.

Browser evidence

Pairing, 320 × 240 Recording, 320 × 240
Kiosk shows the pairing code Kiosk shows the waveform and recording state

Fullscreen listening, 1024 × 640 · Meeting transcript in Review

devices/Cargo.lock is generated. The slice merge commits preserve their review history.

i098 and others added 30 commits November 23, 2026 09:28
- Keep the existing browser wire format and declare device indicators on start.
- Share PCM, WAV, and indication vectors across TypeScript and Rust.
- Separate public pairing from authenticated device management.
- Add nonblocking audio levels and enable checks for slice pull requests.
- Carry the approver and workspace names on the device.
- Keep spoken work outside scoped device sockets.
Add Linux LED, terminal and loopback kiosk outputs.
Check the shared light patterns and report output faults to the listener.
- Run workspace Clippy and tests on changes to the feature branch.
- Generate a lockfile until the integration adds the CLI lockfile.
- Pair devices with a short code and issue a capture-only bearer once.
- Store only hashed codes and credentials. Enforce pairing limits in MySQL.
- Save accepted device capabilities with the epoch start.
- Keep spoken work and action updates off device sockets.
- Exercise bearer ingest and archive reconciliation with fixture audio.
Pair the device and require a visible indication before capture.
Stream PCM, resume live capture, and keep WAV chunks until receipt.
Add /pair, where a signed-in person types the code that a device
shows, sees what the device has, and approves or denies it. Add
Menu > Settings > Devices with Remove.

Closes #229
- Serve web-app/dist/kiosk/ with a relative base for the device client.
- Read same-origin /events; show error when the feed is silent 3 s.
- Reuse the approved waveform; the listening view does not change.

Closes #233
- Add changelog.d/233.added.md for the small-screen kiosk page.
feat(server): add device enrolment and revocation
- Construct the signal guard without moving fields out of a value with Drop.
- Use the standard even-length predicate for PCM16 input.
- Limit the expectation to the test callback with the Tungstenite result type.
feat(media): accept hardware listener declarations
- Stop the indicator worker by closing its sender before joining it.
- Keep the kiosk fixture filesystem import in tests.
feat(web): kiosk page for small device screens
feat(devices): add the Rust reference listener core
feat(devices): add light and screen indicators
- Poll for the existing rise and needle thresholds for up to five seconds.
- Keep the fullscreen view and its audio fixture unchanged.
- Record the indicator dependencies introduced by the slice merge.
- Keep the locked Rust check usable on the remaining slice.
- Restore the original setup and pixel assertions for both specs.
- Keep the device client off the fullscreen listener startup path.
- Keep the original waveform checks and thresholds.
feat(web): pair page and device list
- Add the Linux listener command and systemd example.
- Verify light-only and kiosk flows with synthetic audio in CI.
- Record the ARM64 fixture result and restore main-only CI filters.
- Preserve timing and require a complete cycle before comparing the code.
- Bind listeners to the device credential that registers them.
- Limit IPv6 pairing by prefix and show the approval code again.
- Keep rejected audio locally while the rest of the queue uploads.
- Refresh the lockfile for the smaller listener HTTP feature set.
- Keep the listener column compatible with the migration ledger.
i098 added 8 commits November 23, 2026 11:55
- Expect the listener device ID column in migration 024.
- Check the live connection twice before starting capture.
- Return the permanent failure exit code for invalid CLI configuration.
- Show the lockout message only when the server reports a code lockout.
- Wait for a new document when testing the same-URL sign-in return.
- Close the live socket if access ends during the upgrade.
- Verify the socket rejects access that ends before tracking.
@i098 i098 changed the title feat(devices): pair hardware listeners with Sanctum feat(devices): run Sanctum listeners on any device with a mic and a screen or light Nov 23, 2026
@i098 i098 changed the title feat(devices): run Sanctum listeners on any device with a mic and a screen or light feat(devices): pair hardware listeners with Sanctum Nov 23, 2026

@i098 i098 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the hardware listener on fd53a0d4. The validator recorded a test exception after its first pass left four scenarios untested. Separate live runs on the same commit covered all four.

  • Ten MySQL-backed API tests covered pairing limits, indicator checks, and WebSocket revocation.
  • At 320 pixels, Chromium showed wrong-code and lockout messages. The API refused approval without the CSRF cookie.
  • Chromium showed all eight kiosk states at 240 × 240 and 320 × 240. Both screens cleared the listening state when the Rust feed stopped.
  • The light and screen listeners passed V1 through V7 with fixture audio. The light listener preserved 992,000 samples across a 10-second outage.

Application checks and the device job passed on this commit. The first hosted run rejected the pull request title, not the commit range.

I did not test V8 or physical hardware. No deployment or production migration ran.

@i098
i098 marked this pull request as ready for review November 23, 2026 19:20
@i098
i098 merged commit 72a07dd into main Nov 23, 2026
40 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pair a hardware listener with a microphone and recording indicator

1 participant