Skip to content

Architecture: deepen transcription orchestration seams #47

Closed

Description

@ElbertePlinio

Goal

Reduce dual-path PickScribe behavior by concentrating shared incremental, cleanup, delivery, settings, and lifecycle policy while preserving local transcription, cancellation, partial-failure behavior, Linux CLI compatibility, and Linux-first scope.

Why

Incremental, cleanup, and final delivery currently have active CLI and desktop implementations. Recent incremental history required lockstep repairs; the live backlog path differs today. Configuration mutations also have inconsistent persistence/effect publication. Focused deep modules make the interface test surface deterministic without adding speculative cross-platform work.

Top priority

CAND-1 — shared incremental orchestration. First characterize and unify scheduling/fallback/finalization policy used by CLI and desktop. Preserve each adapter’s process files or Tauri events.

Architecture constraints

  • Local whisper transcription remains local. Cleanup is the only optional remote step; local-only remains enforced.
  • Preserve cancellation, stale-result rejection, raw fallback, segment-safety behavior, and keep_audio cleanup.
  • Preserve legacy CLI binaries, wrappers, flags, environment overrides, stdin/stdout, and exit behavior.
  • Linux ships; do not add macOS/Windows implementations, platform adapters, or native-host claims.
  • Prefer one deep module over shallow pass-through layers. A seam requires two real adapters.

Scope / acceptance checklist

  • CLI and Tauri incremental paths share deterministic timing, backlog, fallback, final-drain, and segment-state policy.
  • All cleanup callers share provider/local-only/prompt/response/fallback policy while retaining CLI presentation.
  • Linux delivery strategy is shared while CLI output/warning behavior remains compatible.
  • Settings mutations persist before runtime effects and publish a consistent successful result.
  • Lifecycle transition and terminal-outcome behavior has focused tests for cancellation and partial failure.
  • No behavioral expansion to remote data handling or non-Linux platforms.
  • Existing validation remains green; future release work includes targeted desktop smoke where stated.

Dependency-ordered PR plan

PR 1 — Incremental orchestration

  • Depends on: none
  • Touches: src/engine/incremental.rs, src/engine/audio_segments.rs, src/engine/segments.rs, src/bin/pickscribe.rs, src-tauri/src/engine.rs
  • Prove: CLI and desktop share backlog/fallback/finalization decisions; cancellation and partial segment failure remain safe.
  • Validation: focused core/CLI/Tauri incremental tests, then cargo test --workspace --locked --all-targets.
  • Link: pending

PR 2 — Shared cleanup policy

  • Depends on: none; may run in parallel with PR 1
  • Touches: src/engine/cleanup.rs, src/bin/pickscribe-cleanup.rs, src/bin/pickscribe.rs, desktop cleanup callers
  • Prove: CLI and desktop apply the same provider, local-only, prompt, response, raw-fallback, and segment-safety policy.
  • Validation: cleanup library and CLI tests, then workspace tests.
  • Link: pending

PR 3 — Shared Linux delivery

  • Depends on: PR 2 if cleanup-binary restructuring conflicts; otherwise none
  • Touches: src/engine/paste.rs, src/bin/pickscribe-cleanup.rs, desktop delivery caller
  • Prove: CLI flags/output remain compatible while backend selection and insertion policy have one owner.
  • Validation: focused paste configuration/CLI tests; manual Linux Wayland and X11 smoke before release.
  • Link: pending

PR 4 — Settings application

  • Depends on: none
  • Touches: src-tauri/src/lib.rs, src-tauri/src/tray.rs, src/lib/views/Settings.svelte, configuration frontend paths
  • Prove: persistence failure produces no runtime mutation; full save, float command, and tray use one result path; dirty external changes are explicit.
  • Validation: Tauri library tests, bun run test, bun run check, then workspace tests.
  • Link: pending

PR 5 — Lifecycle test seam

  • Depends on: PR 1 policy contract settled; characterization may begin earlier
  • Touches: src-tauri/src/engine.rs, Tauri lifecycle entry paths and tests
  • Prove: duplicate requests, every cancellation stage, stale completion, raw fallback, delivery failure, and history failure reach defined terminal states.
  • Validation: cargo test -p pickscribe-app --locked --lib; workspace tests; future desktop smoke for start/stop/cancel before shipping.
  • Link: pending

Existing issue coordination

Non-goals

Feature-flag decision

No feature flags. Each PR preserves existing behavior and is independently reviewable; a flag would add another shallow state path without a rollout requirement.

Audit commit snapshot

2e1408619c35d205754ff34449b622fd8305e796 on main.

Current status

Planned.

Next action

Create the master issue from this body, then open PR 1 with characterization tests before changing incremental production routing.

Activity

  1. added
    enhancement
    on Jul 15, 2026
  2. ElbertePlinio commented on Jul 19, 2026

    @ElbertePlinio
    MemberAuthor

    CAND-4 progress

    PR #51 implements the settings-application slice only; CAND-1 incremental orchestration is untouched.

    • characterized full-save and shared float-mutation success/failure ordering
    • concentrated validation, atomic persistence, runtime effects, and successful publication in one Tauri module
    • routed command/capsule/tray float toggles through the module
    • enforced no runtime/config event after persistence failure
    • kept reporting disabled in local-only mode, including direct Sentry envelopes
    • added dirty-form external reconciliation while preserving Adopt responsive unsaved-settings actions #45 save/discard/navigation behavior
    • passed Rust workspace tests, frontend tests/check/build, and serious local review

    Status: review-ready — #51

  3. ElbertePlinio commented on Jul 19, 2026

    @ElbertePlinio
    MemberAuthor

    CAND-2 progress

    PR #52 implements the shared cleanup-policy slice only; CAND-1 incremental orchestration and the settings module from #51 are untouched.

    • concentrated auto-provider resolution and credential selection in engine::cleanup
    • centralized local-only remote endpoint and Ollama :cloud rejection
    • shared full/segment prompts and request/response interpretation
    • shared strict failure versus raw-transcript fallback behavior
    • centralized unchanged, unsafe, and no-text conservative segment handling
    • preserved CLI flags, exit behavior, child-process/custom-command delivery, and desktop events
    • passed Rust workspace tests, frontend build, CLI behavior smoke, serious local review, and fix verification

    Status: review-ready — #52

  4. ElbertePlinio commented on Jul 19, 2026

    @ElbertePlinio
    MemberAuthor

    CAND-5 progress

    PR #53 implements the lifecycle test-seam slice only; CAND-1 incremental orchestration is untouched.

    • extracted deterministic transition validity (toggle_action), session-current gating (session_is_current), and terminal-outcome projection (failure_outcome/no_speech_outcome/delivery_outcome) into src-tauri/src/lifecycle.rs
    • replaced three duplicated inline stale-session checks in engine.rs with the single session_is_current predicate shared by every pipeline checkpoint
    • kept recorder/STT/cleanup/delivery/history as effect implementations at the seam in engine.rs; incremental scheduling and the Stage set are untouched
    • characterized duplicate start/toggle, stop before init finishes, cancellation at every pipeline stage, stale completion after cancel/new session, cleanup failure with raw delivery, and history failure
    • passed cargo test (lib + -p pickscribe-app --locked --lib), cargo test --workspace --locked --all-targets, and bun run build

    Status: review-ready — #53

    With CAND-2, CAND-4, and CAND-5 review-ready, CAND-1 (shared incremental orchestration) is now the only remaining candidate, and it now has a lifecycle safety net in place: cancellation, stale-completion, and terminal-outcome behavior around the incremental result is characterized independently of the incremental scheduler itself, so CAND-1's move can proceed against a deterministic seam instead of Tauri effects.

  5. ElbertePlinio commented on Jul 19, 2026

    @ElbertePlinio
    MemberAuthor

    CAND-1 (PR 1 — Incremental orchestration) is up: #55.

    src/engine/incremental.rs now owns scheduling/fallback/finalization
    policy as a deep module (SchedulingConfig, next_step/choose_segment_end/
    after_boundary/classify_slice, IncrementalHost + run()), and both the
    CLI worker loop (src/bin/pickscribe.rs) and the desktop worker loop
    (src-tauri/src/engine.rs) now drive through it instead of each carrying
    its own copy of the state machine. The one policy divergence between the
    two (live backlog overflow: stop-immediately vs. flag-and-continue) is
    unified on the CLI's stop-immediately behavior — see #55's description for
    the rationale.

    CLI process files/exit codes/orphan handling, Tauri events/stage
    transitions, the #49 IncrementalResult::Partial salvage path, and
    keep_audio retention are all preserved; cargo test --workspace --locked --all-targets, bun run build, and manual CLI smoke (start/stop/cancel
    against real pw-record/whisper-cli) are green.

    This issue completes when #55 merges (the remaining CAND items in the PR
    plan are separate follow-up PRs).

  6. ElbertePlinio commented on Jul 19, 2026

    @ElbertePlinio
    MemberAuthor

    All five candidates landed: #49 (P0 UI-thread + fallback salvage groundwork), #51 (settings module), #52 (shared cleanup policy), #54 (shared Linux delivery), #53 (lifecycle transition seam), #55 (shared incremental orchestration — CLI and desktop now route through one deep policy module; desktop's live backlog-overflow behavior intentionally unified to CLI's stop-immediately, documented in the PR). Main CI green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions