Skip to content

fix: reliability batch 2A — one unified post-transcription pipeline for classic and adaptive modes - #82

Merged
GalaxyRuler merged 8 commits into
mainfrom
codex/reliability-batch-2a
Jul 20, 2026
Merged

fix: reliability batch 2A — one unified post-transcription pipeline for classic and adaptive modes#82
GalaxyRuler merged 8 commits into
mainfrom
codex/reliability-batch-2a

Conversation

@GalaxyRuler

Copy link
Copy Markdown
Owner

Before Submitting This PR

  • I have searched existing issues and PRs to ensure this isn't a duplicate
  • I have read CONTRIBUTING.md

Top of the stack: #78#79#80#81 → this. Merge bottom-up.

Human Written Description

This unifies the two post-transcription paths that had silently diverged. The bug that motivated it: turning on adaptive profiles quietly disabled the LLM post-processing you had explicitly configured, and the "smart" profile prompts the adaptive system built were never actually sent to any model. Both modes now run one explicit pipeline, so what the settings promise is what actually executes.

What's in the batch

  1. One pure pipeline (src-tauri/src/pipeline.rs): OpenCC zh-variant conversion → profile deterministic cleanup (adaptive only) → smart formatting → optional single LLM stage → validation. Structured result separates raw input, deterministic output, LLM output, and final text, with zh_conversion_applied / llm_invoked / fallback_reason.
  2. Shared gated LLM stage. Adaptive mode no longer bypasses configured post-processing, and adaptive being ON never by itself authorizes an LLM call — gating stays exactly the existing consent + request + private-session + provider checks. Prompt precedence: the user's selected prompt always wins; the adaptive profile's rewrite prompt is used only as a fallback. Structured→legacy provider fallback counts as one invocation.
  3. Both modes + both secondary callers route through it. History retry preserves an entry's adaptive profile semantics (previously silently converted to classic); adaptive reprocess uses the pipeline while keeping its private-session gate and never triggering an ungated LLM call. zh-Hans/zh-Hant conversion now applies in both modes.
  4. Configured default profile honored — routing uses adaptive_default_profile_id instead of hardcoded default_clean for unknown/casual targets.
  5. Profile policies enforcedpreserve_numbers and preserve_raw_language now validate LLM output, falling back to the deterministic text with a recorded reason.

Testing

  • Full Rust suite: 790 passed, 0 failed (implementation + independent review run).
  • tsc, ESLint, Prettier, translations, settings-lock coverage, cargo-deny: pass. No new dependencies.
  • Mutation-verified regression guard: the adaptive→LLM wiring test was proven discriminating by injecting the original bypass (post_process_requested && adaptive_profile.is_none()) at the processor entry — test fails (invocation count 0 vs 1); removing the mutant restores green. Verified independently in two sessions.

Needs installed-product verification (follow-up): real LLM provider round-trip in adaptive mode; zh conversion end-to-end through recording→history→insertion; retry semantics in the installed app.

AI Assistance

  • AI was used (please describe below)

If AI was used:

  • Tools used: Codex (implementation), Claude Code (audit, code review, mutation verification)
  • How extensively: implemented and reviewed AI-driven from a human-approved plan with FINAL design decisions fixed in advance; the key regression test was mutation-tested independently by both AIs

🤖 Generated with Claude Code

Batch 1 changed set_active_model to return ModelSwitchOutcome { reason }.
The Playwright mock still returned the pre-batch unit (null) shape, so
modelStore.selectModel's result.data.reason access threw during first-run
onboarding, stalling the model->shortcut step. Update the mock to the real
shape and null-guard the frontend read defensively.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Base automatically changed from codex/reliability-fixes to main July 20, 2026 20:35
@GalaxyRuler
GalaxyRuler merged commit d401ae1 into main Jul 20, 2026
15 checks passed
@GalaxyRuler
GalaxyRuler deleted the codex/reliability-batch-2a branch July 20, 2026 20:35
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