Phase 9 of the rebrand cascade. Sweep covers everything the Phase 8
frontend pass deliberately skipped: docs/, root markdown, scripts,
Cargo.toml descriptions, code comments that survived earlier
word-boundary sed, plus a handful of identifiers caught on the final
verify pass.
transcription-app changes:
- README.md, HANDOVER.md, KNOWN-ISSUES.md, run.sh — magnotia/Magnotia
-> lumotia/Lumotia.
- docs/ — sweep across all subdirs except docs/handovers/ (preserved
as immutable audit trail). Includes architecture-map references
to magnotia_core::*, magnotia_storage::*, etc. now pointing at
lumotia_*; dev-setup.md tracing output examples (lumotia_startup
target); brief/ + superpowers/ + issues/ + whisper-ecosystem/ +
audit/.
- Cargo.toml descriptions on 9 crates (core, audio, cloud-providers,
hotkey, llm, mcp, plus referenced others).
- crates/core/src/{error,hardware,recommendation,paths}.rs +
crates/audio/src/wav.rs + crates/llm/src/model_manager.rs +
crates/cloud-providers/src/keystore.rs + crates/mcp/src/lib.rs —
doc comments and a model-manager user-agent string.
- Caught on final pass: BroadcastChannel("magnotia_task_sync") -> ...
("lumotia_task_sync"); magnotia_locale i18n localStorage key
renamed + migration shim added; CSS keyframe names
magnotiaPulse / magnotiaBar / magnotiaFade renamed in the design-
system kit; magnotia_viewer_item / magnotia_viewer_mode handoff
keys renamed in HistoryPage + viewer/+page.svelte; src/assets/
wordmark.svg text.
- src-tauri/src/lib.rs comment cleanup ("magnotia era" was sed'd
to "lumotia era" earlier — restored).
Preserved (intentional):
- crates/core/src/paths.rs — keeps "magnotia" / "Magnotia" / ".magnotia"
legacy detection strings in legacy_and_target_paths() so the
migration shim can still find user data from the magnotia era.
- src/lib/stores/{page,focusTimer}.svelte.ts + src/lib/i18n/index.ts
— migration call sites reference the legacy magnotia keys
deliberately.
- docs/handovers/ — historical audit trail.
cargo build --workspace passes. npm run check: 0 errors / 0 warnings
(3958 files). cargo test --workspace: 339 pass / 0 fail.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
79 lines
4.2 KiB
Markdown
79 lines
4.2 KiB
Markdown
---
|
|
name: HITL feedback
|
|
type: architecture-map-page
|
|
slice: 02-tauri-runtime
|
|
last_verified: 2026/05/09
|
|
---
|
|
|
|
# `commands::feedback`
|
|
|
|
> **Where you are:** [Architecture map](../../README.md) → [Tauri runtime](../README.md) → [Commands](README.md) → Feedback
|
|
|
|
**Plain English summary.** Phase 2: thumbs + correction capture on AI-generated output (microsteps from a task decomposition, task lines extracted from a transcript, or LLM cleanup). The captured rows feed a few-shot loop: subsequent prompts are conditioned on the user's preferred style by injecting the (input, preferred-output) pairs as exemplars.
|
|
|
|
## At a glance
|
|
|
|
- Path: `src-tauri/src/commands/feedback.rs`.
|
|
- LOC: 110.
|
|
- Tauri commands exposed:
|
|
- `record_feedback(state, input: RecordFeedbackInput) -> Result<i64, String>` — returns the new row id.
|
|
- `list_feedback_examples_cmd(state, target_type, limit, min_rating, profile_id) -> Result<Vec<FeedbackDto>, String>`.
|
|
- Events emitted: none.
|
|
- Depends on: `lumotia_storage::{record_feedback, list_feedback_examples, FeedbackRow, FeedbackTargetType, RecordFeedbackParams}`.
|
|
- Called from frontend at: dictation result panel (thumb up/down + correction-text on cleanup); Tasks page (thumb on extracted tasks and decomposed microsteps).
|
|
|
|
## What's in here
|
|
|
|
### `RecordFeedbackInput` (`src-tauri/src/commands/feedback.rs:15`)
|
|
|
|
Frontend-supplied shape:
|
|
|
|
- `targetType`: `"microstep" | "task_extraction" | "cleanup"`. Parsed via `FeedbackTargetType::parse`.
|
|
- `targetId`: optional surface-specific id (subtask id, task id, transcript id).
|
|
- `rating`: `-1` (thumbs down), `0` (correction, neutral), `+1` (thumbs up).
|
|
- `originalText`: the AI-generated text the user is rating.
|
|
- `correctedText`: the user's preferred text (when they corrected it).
|
|
- `contextJson`: freeform JSON used by the prompt builder later to reconstruct the (input, preferred-output) pair.
|
|
- `profileId`: scopes the row.
|
|
|
|
### `FeedbackDto` (`:38`)
|
|
|
|
camelCase mirror of `FeedbackRow`. Note `rating` widens to `i64` in the DTO (storage uses `i64`).
|
|
|
|
### `parse_target_type` (`:68`)
|
|
|
|
Wraps `FeedbackTargetType::parse(raw)`, returning `"unknown feedback target_type: <raw>"` on miss.
|
|
|
|
### `record_feedback` (`:73`)
|
|
|
|
`parse_target_type` then `db_record_feedback`. Returns the row id.
|
|
|
|
### `list_feedback_examples_cmd` (`:95`)
|
|
|
|
Clamps `limit` to `[1, 64]`, defaults 8. Clamps `min_rating` to `[-1, 1]`, default 0. Calls `db_list_feedback_examples`. Returns `FeedbackDto`s. Used by the `commands::tasks` few-shot exemplar pull and would be used by the equivalent in `commands::llm` if/when cleanup gets its own exemplar path.
|
|
|
|
## Data flow
|
|
|
|
```
|
|
dictation result thumbs-up -> invoke('record_feedback', { targetType: 'cleanup', rating: +1, originalText, correctedText, contextJson, profileId })
|
|
-> lumotia_storage::record_feedback -> row id
|
|
|
|
decomposition thumbs-down + correction -> record_feedback({ targetType: 'microstep', rating: 0, originalText, correctedText: "user's preferred wording", contextJson: {parent_text}, profileId })
|
|
|
|
next decompose call -> list_feedback_examples_cmd('microstep', 5, 0, profile_id)
|
|
-> [FeedbackDto, ...] -> few-shot exemplars
|
|
```
|
|
|
|
## Watch-outs
|
|
|
|
- **No `ensure_main_window` guard.** Tasks float and History viewer secondary windows can also fire feedback. Intentional. If you ever want to lock down feedback writes, this is where to add the guard.
|
|
- **`contextJson` is freeform.** Storage stores the raw string. `commands::tasks::to_llm_examples` parses it and skips rows that are malformed. Bad data therefore degrades gracefully but doesn't surface to the user. The `eprintln!` in `to_llm_examples` is the only visibility.
|
|
- **`min_rating` clamp is `[-1, 1]`.** Pass `1` to get only thumbs-up examples, `0` for thumbs-up + corrections, `-1` for everything. The default of `0` is what `commands::tasks` picks.
|
|
- **No deduplication.** A user thumbs-upping the same output twice creates two rows. The exemplar trim in `commands::tasks` does not dedupe by `originalText`. If two identical exemplars steal slots, that's just lost prompt budget.
|
|
|
|
## See also
|
|
|
|
- [Tasks](tasks.md) — the consumer of `list_feedback_examples_cmd`.
|
|
- [LLM](llm.md) — the cleanup path that produces the text that thumbs-up/down feedback rates.
|
|
- [Profiles](profiles.md) — `profileId` is the scoping key.
|