uttrflow / uttrflow/uttrflow-swift

Clean-up diagnostics report at most 12 edits per type because example truncation discards the true totals

Open
#783 0 comments 0 reactions 0 assignees View on GitHub
area:dictation bug P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## Problem

`CleaningRecord` limits each step's removed/replaced/inserted examples to 12 before storing them. It does not retain separate totals. Diagnostics then uses those arrays' counts for both the page and Copy Diagnostics, so 20 removals are reported as 12. Merging records from multiple pieces applies the same truncation again and also loses the total.

The example cap is useful and should remain; the problem is using a bounded sample as the complete count. This makes the report understate how much the cleaning passes changed in a long dictation.

## Reproduction

Reviewed main at `8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d`. An isolated Swift release test uses the unchanged production `Draft` and `CleaningRecord`:

```swift
var draft = Draft(text: Array(repeating: "um", count: 20).joined(separator: " "))
for index in draft.words.indices { draft.remove(at: index, by: .fillers) }
let record = CleaningRecord(draft: draft, ran: [.fillers])
```

Observed: `draft.removed.count == 20`, but `record.changes.first?.removed.count == 12`. `DiagnosticsPresenter.detail(of:)` and `countedCleanUp` render the latter as the number removed. The test directly exercises record accounting; it does not claim to measure how a particular recognizer transcribes twenty consecutive fillers.

## Source

- [CleaningRecord truncation and merging](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowCore/Cleaning/CleaningRecord.swift#L96)
- [Diagnostics page counts](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowUX/DiagnosticsPresentation.swift#L437)
- [Copied diagnostics counts](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowUX/DiagnosticsPresentation.swift#L459)

## Acceptance criteria

- Keep exact removed, replaced and inserted totals separately from capped examples, and sum those totals when merging pieces.
- Display the exact counts on the page and in Copy Diagnostics while keeping example storage bounded.
- Test more than 12 changes of each kind and a multi-piece merge whose combined total exceeds 12. Include a smaller case to preserve existing output.

## Existing work checked

Checked open and closed reports for CleaningRecord, truncation, wordLimit and count reporting. #645 concerns quoted text in copied refusal reasons; it does not cover lost edit totals.

Contributor guide

Open the contributing guide

Research direction

Start with Sources/UttrflowCore/Cleaning/CleaningRecord.swift, then trace the counts used by Sources/UttrflowUX/DiagnosticsPresentation.swift for the diagnostics page and copied output. Use the isolated Swift release test described in the issue and add coverage for more than 12 edits, multi-piece merges, and a smaller case. Done means exact totals appear in both outputs while stored examples remain capped.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
desktop, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.