fix: red-team round 3 hardening across desktop, mobile, core and server

Batch of red-team r3 fixes that were in the working tree before the
2026-09-28 design overhaul, committed as one unit with their tests.

- desktop main: STT timeouts and sidecar, voice recording store, sync
  (credentials, audio, knowledge reindex, push gates), runtime
  provisioner, update policy, AltGr keybindings, voice-command policy,
  dictionary file codec/limits, meeting transcript condensing and a
  local recording ledger so interrupted-session recovery only closes
  meetings this device recorded (a phone's live meeting is left alone).
- mobile: login CSRF via implicit token callbacks rejected, account
  deletion/retention, durable queue retention, knowledge realtime
  without unfiltered DELETE, meeting re-record failure paths, cloud STT
  client, preferences store/resync.
- core: text chunking splits long unbroken transcripts to fit, template
  field policy, dictionary limits, meeting markdown inline handling.
- server: payple webhook policy and cancellation order scope, meeting
  document generation quota, team RPC null-role guard, unified LLM
  quota in-flight accounting, knowledge chunk vector index, meeting
  re-record failure paths (migrations 20260929*).
- ci: portable/runtime feed gates, update-policy schema, Forgejo file
  delete and alias planning.

Four older tests are updated to the new contracts rather than the old
behavior: token-pair auth callbacks are rejected, knowledge realtime no
longer subscribes to DELETE, long transcript lines are split, and
meeting recovery requires the local recording ledger for empty rows.
This commit is contained in:
Yun Chan 2026-09-28 20:45:52 +09:00
parent 2428ede03d
commit ba9ef9741e
161 changed files with 17056 additions and 2379 deletions

View file

@ -188,6 +188,14 @@ export function buildLocalSuggestionCandidates(
return buildLocalSuggestionCandidateEntries(prefix, hints, limit, maxChars).map((entry) => entry.text)
}
export interface LocalSuggestionBuildOptions {
/**
* 사용자가 친 원문이 공백으로 끝났는가(단어를 끝냈는가). 생략하면 prefix 인자의 뒤 공백으로 판단한다.
* true 면 접두 꼬리와 문구 머리가 단어 중간에서 겹치는 후보를 버린다.
*/
wordFinished?: boolean
}
/**
* buildLocalSuggestionCandidates 와 같은 후보를, 접두와의 이음새 정보와 함께 돌려준다.
*
@ -198,8 +206,12 @@ export function buildLocalSuggestionCandidateEntries(
prefix: string,
hints: LocalSuggestionHints,
limit = 3,
maxChars = SUGGESTION_MAX_OUTPUT_CHARS
maxChars = SUGGESTION_MAX_OUTPUT_CHARS,
options: LocalSuggestionBuildOptions = {}
): LocalSuggestionCandidate[] {
// 커서 앞 원문이 공백으로 끝나면 단어가 끝났다 — 단어 중간 이어 쓰기(attach)는 조각이 된다
// ("내일 회의 " + "록 공유드립니다"). 호출자가 뒤 공백을 걷어낸 접두를 넘기면 명시적으로 알린다.
const wordFinished = options.wordFinished ?? /\s$/u.test(prefix)
const safeLimit = Math.max(0, Math.floor(limit))
const safeMaxChars = Math.max(0, Math.floor(maxChars))
if (safeLimit === 0 || safeMaxChars < 2) return []
@ -232,7 +244,9 @@ export function buildLocalSuggestionCandidateEntries(
const overlap = suffixPrefixOverlap(normalizedPrefix, candidate)
if (overlap >= 2) {
const remainder = candidate.slice(overlap)
append(normalizeSuggestionText(remainder, safeMaxChars), !/^\s/u.test(remainder))
const midWord = !/^\s/u.test(remainder)
if (midWord && wordFinished) continue
append(normalizeSuggestionText(remainder, safeMaxChars), midWord)
} else if (acceptsWholePhrase) {
append(candidate)
}
@ -282,7 +296,10 @@ function firstCodePoint(text: string): string {
* - 이음새 양쪽 어느 쪽도 띄어 쓰지 않는 문자 체계(중·일·태 등, CJK 구두점)가 아니다.
*/
export function joinSuggestion(rawPrefix: string, candidate: string, joint: SuggestionJoint = 'separate'): string {
if (!candidate || joint === 'attach') return candidate
if (!candidate) return candidate
// 단어 중간 이어 쓰기는 공백 없이 붙인다. 원문이 이미 공백으로 끝났으면 이어 붙일 단어가 없다
// — separate 규칙으로 간다(공백 뒤라 결과는 후보 그대로).
if (joint === 'attach' && !/\s$/u.test(rawPrefix)) return candidate
const before = lastCodePoint(rawPrefix)
const after = firstCodePoint(candidate)
if (!before || !after) return candidate