Repository navigation
fix(dox): one soft Distant sonar ping for every press - #553
Conversation
Every link, button and copy button now plays the Distant sonar: a quiet 1050 Hz ping heard from far off, almost all echo. It replaces the link Sonar, the button Deep sonar and the copy Glass clink, which were too loud and too many. It is the same press sound as northguild.dev. - A link that leaves the page waits 600 ms for its ping, up from 333. - A hidden tab keeps sounding for 1.2 s, up from 0.65, so the ping rings out. - The sound-check gate expects one 1050 Hz ping for links, buttons and copy. The loudness test caps the press at its measured 0.0126 peak.
baldurpan
left a comment
There was a problem hiding this comment.
Reviewed at 9aabe18. Nothing to raise. The single Distant ping is wired consistently: voices.ts and sonar-lock.ts have no leftover SONAR_PING, the tests read LINK_HOLD_MS and HIDE_TAIL_MS, and the sound-check.mjs cue shapes and the 1050 Hz pitch match DISTANT_SONAR. tier-3-sound.md matches the code. Locally, src/lib/sound, sonar, copy and src/components/ask pass, DoxPage.sound.test.tsx included. I didn't run sound-check in the browsers. CI's test and gate jobs were still running when I approved.
In the shared test worker, once a file has loaded React Testing Library, its asyncWrapper waits on a setTimeout(0) that Vitest's fake timers never fire. Every user.click in the link hold tests then hung for the 20 s limit, so the file failed whenever a React file ran before it. Each test now runs with Testing Library's plain wrapper and puts the previous one back after.
baldurpan
left a comment
There was a problem hiding this comment.
Approving again, at f4438ed. The only change since 9aabe18 is in link-hold.test.ts. It saves Testing Library's asyncWrapper before each test, swaps in a plain one so fake timers can't hang user.click, and restores it afterwards, so nothing leaks into other files. The assertions and the LINK_HOLD_MS checks are unchanged. Running src/lib/sound and src/components/ask together now passes locally, 404 of 404. That was the combination that failed before this commit.
Companion PR: northguild/northguild.dev#28, where the Distant sonar was picked and first used.
Summary
Every press on the docs now plays one sound: the Distant sonar, a quiet 1050 Hz ping heard from far off, almost all echo. It replaces the three press sounds from #549: the Sonar on links, the Deep sonar on other buttons and the Glass clink on copy buttons. The owner picked it by ear for northguild.dev (northguild/northguild.dev#28), so both halves of the site now sound the same on a press.
What Changed
1. The press voice
voices.ts:DISTANT_SONARanddistantSonar(). Theclick,pressandcopycues all play it.sonar-lock.ts:SONAR_PINGis gone, as nothing plays it now.2. Timing, so the longer ping is heard
link-hold.ts: a link that leaves the page waits 600 ms for its ping, up from 333.engine.ts: a hidden tab keeps sounding for 1.2 s (HIDE_TAIL_MS), up from 0.65. A link that opens a new tab still rings out.3. Gates and tests
scripts/sound-check.mjs: expects one 1050 Hz ping for links, buttons and copy.scripts/sound-peaks.browser.test.ts: the press ceiling is the Distant sonar's measured peak, 0.0126. The Deep sonar's was 0.1308.engine.test.tsreadsHIDE_TAIL_MSinstead of a hard-coded 600 ms.4. Docs and names
context/dox/built/tier-3-sound.md: the sound table, the 1.2 s tail and the 600 ms hold.Validation
pnpm run lint: passes (warnings only, in files this PR does not touch).oxfmt --checkon the changed files: passes.astro checkinapps/dox: 0 errors.main. After it, the sound, copy, sonar and component tests pass (2,815).sound-peaks.browser.test.ts: 8 of 8.sound-checkgate itself, which needs a built site and three browsers. It passesnode --check.Risk / Impact
Low. Only what a press sounds like and how long a leaving link waits while sound is on. With sound off, which is the default, links go at once as before.
Release
No changeset: the change is in
apps/dox, outsidepackages/.Checklist
packages/)