Skip to content

refactor(tests): type speech synthesis fixtures - #195933

Merged
vincentkoc merged 2 commits into
mainfrom
refactor/tts-typed-synthesis-fixtures
Nov 9, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
refactor/tts-typed-synthesis-fixtures

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Related: #188252

What Problem This Solves

Shared TTS fixtures discard real request types and recover them through generic unknown-call plumbing. Once the helper returns the actual synthesis request type, one existing fallback assertion also retains an unnecessary string conversion; exact-head CI caught that directly affected consumer.

User Impact

No production runtime, public API or configuration change. Existing synthesis, transcoding, fallback, summary, dispatch and cron cases and their behavioral assertions remain intact.

Why This Change Was Made

Use the real transcode function signature/return union and typed first synthesis request directly. Preserve the missing-call Error, live record/attempt helpers, and the CAF called-once/mp3-to-caf argument checks. In the existing UTF-16 truncation case use the already-typed request.text directly, preserving its input, awaited call, both expectations, preference setup and finally cleanup byte-for-byte.

Full reviewed candidate: 09c642f7b0ef7683c8da211c9f066588257e61e3, original base 26c18f969746809b62933052a9781b771ea1c024. Three test/support files,6+/13- lines (net-7),339 fewer bytes. The correction itself is one replacement,-8 bytes,zero LF/case/assertion delta. Both original fixture files remain byte-identical to incoming 29e985e86978092eb8b6c58836df7a90aecdd224. No cast, suppression, rule/baseline relaxation, extra test or unrelated cleanup.

Evidence

  • Real red: CI https://github.com/openclaw/openclaw/actions/runs/42670564341/attempts/2, job129360930743 (check-lint-core-2) failed typescript(no-unnecessary-type-conversion) at src/tts/tts-runtime-fallbacks.test.ts:445:37. The helper returns SpeechSynthesisRequest and its text field is string. Final attempt2 disposition:57 jobs,26 success/29 skipped/2 failed (lint and downstream combined gate),no active jobs. Complete134910-byte failed-job log retained, SHA256 63763735bf05e4ba3ecf4e60eff982e31094e9018c28cbddbe9bc756044f5349. This is PR-induced, not the earlier backend error or an inherited-main exception.
  • Corrected consumer and typed-support closure pass the same maintained type-aware core lint owner/config (config/tsconfig/oxlint.core.json) over all three candidate files:exit0,3.50s.
  • Full existing fallback suite passes40 cases, including the UTF-16 boundary case:exit0,13.01s whole command; Vitest10.81s. Normal compiler-cache reuse, completed-generation verification, retention and resource cleanup completed. This is affected functional proof, not a new matched-cost sample.
  • Affected core.test.other typecheck passes2.06s; pinned three-file format check passes0.07s; whitespace passes. Normal configured-human signed correction and all configured hooks pass.
  • One fresh complete independent base26c..09c review covers all three changed files, complete owners and the five-consumer closure:scoped-clean,zero findings,confidence.97,one93870-byte pass. Source-only assessment; execution compliance is self-reported/independently unverified. No project execution is inferred from that review.
  • Historical incoming29e proof is retained unchanged:all70 cases across five consumer suites,three owning test type projects,original fixture behavior,format/hooks/ratchet and the predeclared compiler-warm cost study below. Reuse is limited to unchanged inputs; none is relabeled as exact-final-head CI or a new-head cost result. The directly affected fallback suite and static surface were rerun; the whole cost study and unrelated suites were not replayed. No runtime/CPU improvement is claimed.
  • The native correction owner retained old READY/preparation evidence and validated the actual incoming IMPORTANT finding before creating this signed correction. The prior accepted squash request was confirmed retired before any remote-head repair; no duplicate merge request, CI rerun/dispatch or administrator bypass was used. Normal publication, exact-final-head CI/security/review and completed-evidence preparation remain required before replacement recovery and squash landing.
  • No dependency installation, Matrix server/lifetime, borrowed application graph, personal checkout deletion or workflow/binding change was performed. The existing task-owned physical graph and unchanged743 frozen inputs/tooling/runtime were qualified.

The original DNS checkout failure and CI attempt1 provider-level Internal server error remain historical evidence. Their later normal setup recovery and separate attempt2 lint failure do not erase those failures. A test-only change does not alter SDK declarations/package topology; no full runtime build/API-byte-diff claim is made.

Historical compiler-warm comparison: base26c versus incoming29e, before this one-line correction

The following predeclared population and raw rows are retained unchanged. They are not measurements of correction09c. Every20percent stop remains binding; no sample was discarded, replaced or averaged away.

Predeclared matched cost protocol and results

Before any runtime sample, the unused initial warmup plan was explicitly superseded by one compiler-warm set: five serial base/head pairs, each selected revision followed by exactly one separately timed preparation and then one identical measured invocation. No extra warmups, replacement arms, hand-seeded cache or subtracted startup/compiler/verification/cleanup costs. Preparation remains a separate population and is included in total spend.

Exact command for both populations:

/usr/bin/time -l node scripts/run-vitest.mjs src/tts/tts-runtime-routing.test.ts src/tts/tts-runtime-fallbacks.test.ts src/tts/tts-summary.test.ts src/auto-reply/reply/dispatch-from-config.completed-delivery.test.ts src/cron/isolated-agent/delivery-payload-normalization.test.ts --maxWorkers=1

Same physical qualified graph, Node26.13.0/Darwin arm64, inherited NODE_OPTIONS=--max-old-space-size=4096, ordinary worker policy, fresh invocation/one worker. Identical task-local GOMAXPROCS=1, GOMEMLIMIT=3GiB, RAYON_NUM_THREADS=1, OPENCLAW_VITEST_MAX_WORKERS=1, and normal filesystem-module cache at $PWD/.local/tts-fixture-proof/vitest-fs. Host load was recorded at source selection. Every measured arm observed a maintained local compiler-cache hit/reused outputs plus normal complete input/output inventory verification, cache ownership and retention/cleanup; source/graph bindings stayed unchanged. Preparation1/base missed; all other preparations hit, so preparation is not labeled cold.

Whole-command seconds; RSS is bytes; Vitest is its three reported shard durations in seconds. Every row below is exit0/five files/70 cases and positively settled.

pair arm population cache wall user CPU system CPU max RSS Vitest durations
1 base preparation miss 61.16 66.17 32.58 8057503744 33.31, 7.52, 12.58
1 base measured hit 17.39 15.38 15.67 1560657920 6.48, 3.04, 4.37
1 head preparation hit 15.32 14.99 14.66 1544880128 5.68, 2.54, 3.91
1 head measured hit 15.28 15.07 15.21 1603764224 5.42, 2.55, 4.02
2 base preparation hit 18.20 15.05 15.51 1551646720 7.24, 3.02, 4.48
2 base measured hit 14.85 14.76 14.75 1565032448 5.37, 2.54, 3.82
2 head preparation hit 18.74 15.19 15.77 1590280192 7.24, 3.15, 4.6
2 head measured hit 15.05 14.84 15.09 1512456192 5.41, 2.59, 3.96
3 base preparation hit 17.81 15.09 15.24 1590116352 6.14, 3.05, 5.35
3 base measured hit 15.23 15.01 14.81 1520500736 5.59, 2.6, 3.86
3 head preparation hit 16.24 15.00 15.24 1513504768 6.09, 3.07, 3.95
3 head measured hit 15.30 15.18 14.93 1559592960 5.63, 2.6, 3.95
4 base preparation hit 19.01 15.34 16.57 1479507968 6.76, 3.26, 5.42
4 base measured hit 16.46 15.65 17.07 1566949376 6.45, 2.77, 3.95
4 head preparation hit 15.86 15.06 15.61 1511096320 5.44, 2.58, 4.18
4 head measured hit 18.61 15.46 15.82 1534623744 6.92, 3.27, 4.66
5 base preparation hit 18.54 15.69 15.84 1489616896 7.41, 3.08, 4.65
5 base measured hit 15.31 15.23 15.57 1493352448 5.52, 2.66, 4.02
5 head preparation hit 17.79 15.03 15.16 1525628928 6.94, 3.03, 4.5
5 head measured hit 14.94 14.80 14.93 1454096384 5.41, 2.58, 3.88
metric base median head median median delta base range (spread) head range (spread) base p95 head p95 p95 delta
maxRSS 1560657920 1534623744 -1.67% 1493352448–1566949376 (73596928.00) 1454096384–1603764224 (149667840.00) 1566949376 1603764224 +2.35%
system 15.57 15.09 -3.08% 14.75–17.07 (2.32) 14.93–15.82 (0.89) 17.07 15.82 -7.32%
user 15.23 15.07 -1.05% 14.76–15.65 (0.89) 14.8–15.46 (0.66) 15.65 15.46 -1.21%
wall 15.31 15.28 -0.20% 14.85–17.39 (2.54) 14.94–18.61 (3.67) 17.39 18.61 +7.02%

Nearest-rank p95 with n=5 is the observed maximum, not a reliable tail estimate. The unchanged20% STOP was applied independently to every paired raw wall/user/system/RSS cell and each median/p95 cell. All passed; largest paired increase13.06% (wall, pair4). Favorable cells did not offset adverse cells.

Total20-command spend, including all10 preparations: wall377.09s, user353.99s, system326.03s, aggregate CPU680.02s. Observation window687s includes gaps. Largest individual command maximum RSS8057503744B; largest measured command maximum RSS1603764224B. Per-command RSS maxima are not summed as simultaneous memory. This is a compiler-warm test-command cost gate, not product latency, cold-start, CPU, allocation or universal speedup evidence.

@vincentkoc vincentkoc self-assigned this Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR uses real speech and transcode request types while removing generic call-inspection scaffolding.

Example: The existing voice-memo test synthesizes mp3 and requests CAF output.

  • Before: The assertion extracts an unknown call argument through generic helpers.
  • After: The typed mock directly checks one call with sourceExtension mp3 and targetExtension caf.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and source-correct, but supplied validation contains no completed consumer-suite or owning-typecheck results.
Proof confidence 🦪 silver shellfish (2/6) This maintainer-authored test-only PR changes no shipped behavior, so the contributor real-behavior proof gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Partial
Reason: The maintainer-authored direction is established, and the diff removes type erasure and scaffolding without expanding scope; Related is appropriate for the broader campaign.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: it makes a focused fixture simplification, and source review found no actionable correctness or security defect.

Priority: P3
Reviewed head: 29e985e86978092eb8b6c58836df7a90aecdd224

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped-entry-point demonstration is necessary for this test-only refactor; consumer-suite qualification remains unrun.
Agent review details

How this fits together

Shared TTS fixtures exercise speech routing, fallback, summary, dispatch, and cron delivery, supplying synthetic provider audio and checking resulting requests and payloads.

flowchart LR
  A[Consumer suites] --> B[Shared TTS fixtures]
  B --> C[Production TTS owners]
  C --> D[Typed speech provider mock]
  C --> E[Typed transcode mock]
  C --> F[Payload and audio assertions]
Loading

Technical review

Best possible solution:

Keep the direct typed fixtures and existing behavioral assertions without adding another abstraction.

Do we have a high-confidence way to reproduce the issue?

This is a behavior-preserving fixture refactor rather than a reported product bug; source inspection confirms the redundant type-erasing path.

Is this the best way to solve the issue?

The patch is the smallest complete cleanup: reuse the existing function and request types, preserve missing-call detection, and assert transcode arguments directly.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against cde34f111b4d.

Provenance checked

  • Transcode mock signature and owner keeps the original intent (be40392: The prior refactor moved the mock to the actual audio conversion owner and retained real unlisted exports.)
  • Synthesis request extraction keeps the original intent (ecc49b5: The speech-core absorption moved implementation and split tests into src/tts; the generic helper was carried into that owner, without evidence that type erasure was a required contract.)
  • CAF routing assertion keeps the original intent (acdc645: The earlier test cleanup consolidated fixture scaffolding while preserving distinct behavior; this change retains its single-call and source/target format checks.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit be40392 adds src/tts/tts-runtime.test-support.ts:47 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: be403921d0f5; files: src/tts/tts-runtime.test-support.ts)

PR surface

Tests -7. Total -7 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 5 12 -7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 5 12 -7

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production +0/-0; tests and support +5/-12, net -7. The reduction removes generic fixture scaffolding while retaining the existing cases and assertions.

Labels

Label changes:

  • add P3: This is a small test-maintenance change with no production behavior change or established user-facing failure.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a small test-maintenance change with no production behavior change or established user-facing failure.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the routing, fallback, summary, completed-delivery, and cron-normalization suites plus targeted test typecheck, lint, and ratchets on the reviewed head.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 9, 2026, 6:49 AM ET / 11:49 UTC.

@vincentkoc
vincentkoc marked this pull request as ready for review November 9, 2026 18:03
@vincentkoc
vincentkoc enabled auto-merge (squash) November 9, 2026 18:05
@vincentkoc
vincentkoc disabled auto-merge November 9, 2026 19:10
@vincentkoc
vincentkoc merged commit dc1eace into main Nov 9, 2026
105 checks passed
@vincentkoc
vincentkoc deleted the refactor/tts-typed-synthesis-fixtures branch November 9, 2026 19:37
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
* refactor(tests): type speech synthesis fixtures

* fix(tests): use typed synthesis text in fallback assertion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant