refactor(transcription): hoist @mention constants to shared module

Single source of truth for MAX_QUERY_LENGTH, SEARCH_DEBOUNCE_MS, and
SEARCH_RESULT_LIMIT — MentionDropdown imports MAX_QUERY_LENGTH;
PersonMentionEditor imports the debounce + result-limit; the spec's
mirror now imports SEARCH_DEBOUNCE_MS so it can never drift. Unblocks
the displayName length-cap fix (Felix #3 on PR #629).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-19 23:59:04 +02:00
committed by marcel
parent cb0ce90fd6
commit 5f6b896bd2
4 changed files with 17 additions and 12 deletions

View File

@@ -11,14 +11,14 @@ import { page, userEvent } from 'vitest/browser';
import PersonMentionEditorHost from './PersonMentionEditor.test-host.svelte';
import type { components } from '$lib/generated/api';
import { m } from '$lib/paraglide/messages.js';
// Single source of truth for the debounce window — imported from the shared
// module so the test cannot drift from production. Sara on PR #629 round 3.
import { SEARCH_DEBOUNCE_MS } from './mentionConstants';
type Person = components['schemas']['Person'];
type PersonMention = components['schemas']['PersonMention'];
// Mirror of the debounce in PersonMentionEditor.svelte. Naming the magic and
// using a generous slack (SEARCH_DEBOUNCE_MS + 350 = 500 ms) kills CI-jitter
// flakiness Sara raised on PR #629.
const SEARCH_DEBOUNCE_MS = 150;
// Slack on top of the debounce to absorb CI jitter (total 500 ms is generous).
const POST_DEBOUNCE_SLACK_MS = 350;
const AUGUSTE: Person = {