Skip to content

refactor(ui): route progress messages by FileIndex instead of CurrentIndex#102

Merged
flexiondotorg merged 2 commits into
mainfrom
plumbing
Jun 3, 2026
Merged

refactor(ui): route progress messages by FileIndex instead of CurrentIndex#102
flexiondotorg merged 2 commits into
mainfrom
plumbing

Conversation

@flexiondotorg
Copy link
Copy Markdown
Contributor

Decouples per-file TUI state from a global current-file cursor, enabling concurrent file processing. Removes Model.CurrentIndex field; message handlers now route updates directly via msg.FileIndex. Adds debugSink concurrency primitive for race-safe logging across parallel workers.

  • Add FileIndex field to ProgressMsg for per-file message routing
  • Replace CurrentIndex-based handlers with FileIndex routing in Update()
  • Remove Model.CurrentIndex field and all references
  • Update footer to show aggregate progress (N files, K complete, J failed)
  • Add debugSink: mutex-guarded log sink with whole-line atomicity
  • Add withFilePrefix wrapper for per-file debug markers
  • Add unit tests: routing, out-of-range safety, aggregate footer, race conditions

…Index

Decouples per-file TUI state from a global current-file cursor, enabling
concurrent file processing. Removes Model.CurrentIndex field; message
handlers now route updates directly via msg.FileIndex. Adds debugSink
concurrency primitive for race-safe logging across parallel workers.

- Add FileIndex field to ProgressMsg for per-file message routing
- Replace CurrentIndex-based handlers with FileIndex routing in Update()
- Remove Model.CurrentIndex field and all references
- Update footer to show aggregate progress (N files, K complete, J
  failed)
- Add debugSink: mutex-guarded log sink with whole-line atomicity
- Add withFilePrefix wrapper for per-file debug markers
- Add unit tests: routing, out-of-range safety, aggregate footer, race
  conditions

Signed-off-by: Martin Wimpress <code@wimpress.io>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 7 files

Confidence score: 4/5

  • This PR looks safe to merge overall, with risk concentrated in test reliability rather than production behavior.
  • In internal/ui/model_routing_test.go, the expected file slice is aliased instead of copied, so in-place mutations can be hidden and the safety test may give a false pass.
  • Given the issue is medium severity (6/10) but scoped to a test assertion pattern, the merge risk appears minimal to moderate rather than blocking.
  • Pay close attention to internal/ui/model_routing_test.go - aliased expected slices can mask unintended mutation regressions.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread internal/ui/model_routing_test.go Outdated
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Auto-approved: This PR refactors the TUI's progress message routing from a global current-file index to per-file indices, enabling concurrent processing without altering core audio logic; the changes are limited to UI state management, well-tested with routing and safety tests, and include a mutex-guarded...

Re-trigger cubic

@flexiondotorg flexiondotorg merged commit 769dda7 into main Jun 3, 2026
16 checks passed
@flexiondotorg flexiondotorg deleted the plumbing branch June 3, 2026 00:02
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