Skip to content

test: run the m1 test coverage audit - #55

Merged
kixelated merged 3 commits into
mainfrom
quest/m1/audit-tests
Nov 26, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m1/audit-tests

Conversation

@kixelated

@kixelated kixelated commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

First run of the tests audit in this repo (quest audit tests).

Findings

Coverage baseline (measured with bun test --coverage per CI suite; the tooling isn't committed):

  • api: 41 tests. account.ts 92%, auth.ts 97%, avatar.ts 97%, oauth.ts 94%, storage.ts 96%, room.ts 84%. The uncovered part of room.ts is the join route, which belongs to the open room-token-identity PR (fix(room)!: bind guest identities and expire room tokens #53), so this PR doesn't touch it.
  • app: 57 tests. The pure modules (capture, speaker, room/peers, room/physics, room/sanitize, room/preview) are at 100% and room/metadata is at 98%. No suite loads room/space.ts, the WebGL renderers, room/watch.ts, video.ts, audio.ts, chat.ts, or most page components. Only test/media.browser.ts reaches capture and decode.

Unreachable tests: none. Every test file runs in just check, which uses set -euo pipefail. There are no skipped, todo, or env-gated tests. moq/ suites are upstream's.

Wall-clock tests (all fixed here):

  • api/test/auth.test.ts and api/test/oauth.test.ts hand-forged expired JWTs from Date.now(). Those copies of the token format could drift from what Auth.Context actually mints. They now mint real tokens and codes under setSystemTime and pin the session lifetime (one year) and the code lifetime (five minutes) at the boundary.
  • app/src/api.test.ts waited with 10 rounds of setTimeout(0). It now awaits Settings.oauth.token.changed(), set up before the client loads.

Missing regression tests: fixes merged since #43 that changed no test:

None of these has a seam today, so each is a follow-up below.

Drifted mirrors:

  • The in-memory R2 Bucket matches what storage.ts calls.
  • The API harness builds its context by hand and leaves out room. A missing field fails loudly in tests, so this PR leaves it.

Gap fixed here: an avatar uploaded for an account that was deleted mid-update was untested. A session token outlives its account. A new test checks that the upload is deleted rather than orphaned in R2.

I mutation-checked each new API test: it fails when the lifetime or the cleanup line it covers is changed.

Space seam

Driving Space in happy-dom would mean faking AudioContext, the chat worker, and the video pipeline through Broadcast, which costs too much for what it would catch. The recommended seam is to extract the gesture state machine into a pure module, the way peers.ts and physics.ts were extracted, and unit-test that. The rendering half goes to a real-browser smoke test built on the existing Playwright and relay harness.

Impact

Tests and quests only. No public API or wire change.

Follow-ups

Validation

  • quest gate just check passes: quest check, tsc, Biome, 41 API tests, 57 app tests, and the media browser test.
  • just build was not run locally because the build output doesn't include tests. CI runs it.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, high

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with high)

Review

Rewritten by quest review after each round.

  • Head: bc7cdee

  • Base: origin/main at 6a3af10

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.2-sol, high effort

  • Session: 01a216a0-148c-7d72-8b32-98c949f78ed6, round 2

  • Score: 10/10, The avatar test deletes the account during the upload, the authentication test waits for the state change before asserting it, and neither revision introduces a new finding.

  • Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 25, 2026 22:46
Quest-Claim: cbda28fe9ec526f8
Mock the clock for session and login-code expiry instead of hand-forging
expired JWTs, wait on the token signal instead of draining timers, and cover
the upload cleanup for an account deleted mid-update. Add follow-up quests for
Space gesture tests and a room-page browser smoke, and plan the next run in m2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Audit test coverage test: run the m1 test coverage audit Nov 26, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 26, 2026 06:56
@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8c0844ec-a38f-41b0-83bb-61e4a91bca30
Commits

Reviewing files that changed from the base of the PR and between 6a3af10 and bc7cdee.

Files selected for processing: 8

  • api/test/account.test.ts
  • api/test/auth.test.ts
  • api/test/oauth.test.ts
  • app/src/api.test.ts
  • quest/m1/audit-tests.md
  • quest/m1/room-browser-smoke.md
  • quest/m1/space-gesture-tests.md
  • quest/m2/audit-tests.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@kixelated
kixelated merged commit fc0dc04 into main Nov 26, 2026
4 checks passed
@kixelated
kixelated deleted the quest/m1/audit-tests branch November 26, 2026 07:02
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.

1 participant