Skip to content

test(assistant): cover failed progress persistence#47

Merged
omarluq merged 1 commit into
mainfrom
test/failed-progress-persistence
May 24, 2026
Merged

test(assistant): cover failed progress persistence#47
omarluq merged 1 commit into
mainfrom
test/failed-progress-persistence

Conversation

@omarluq
Copy link
Copy Markdown
Owner

@omarluq omarluq commented May 24, 2026

Summary

  • add coverage for persisting partial streamed progress on provider failure
  • cover UI handling of streamed side-effect blocks when a prompt fails

Validation

  • mise exec -- task ci

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 24, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 263f0283-ca26-4289-8b63-203e642ee08c

📥 Commits

Reviewing files that changed from the base of the PR and between deeb867 and 422d43a.

📒 Files selected for processing (2)
  • internal/assistant/runtime_test.go
  • internal/terminal/render_test.go

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for error reporting when persistence fails
    • Enhanced test coverage for progress display during error conditions
    • Refactored assertion helpers for improved test maintainability

Walkthrough

This PR refactors and extends test coverage for prompt failure handling in two complementary areas. Runtime tests are consolidated with a shared assertion helper and expanded with a new error-reporting test. Terminal rendering tests are updated to verify streamed progress is preserved and properly rendered before prompt errors are displayed.

Changes

Test Coverage Updates for Prompt Failure Handling

Layer / File(s) Summary
Runtime persistence failure test assertions
internal/assistant/runtime_test.go
Refactors TestRuntime_PromptPersistsPartialProgressOnProviderFailure to use a new assertPersistedPartialFailure helper. Adds TestRuntime_PromptReportsPersistenceFailureWhenFailedProgressCannotPersist to validate error reporting when persisting partial progress fails, verifying error messages contain both "persist failed prompt progress" and "append partial prompt progress".
Terminal error rendering with streamed content preservation
internal/terminal/render_test.go
Updates TestApplyPromptErrorKeepsStreamedProgressVisible setup to populate app.streamingBlocks with bash execution, custom progress, and thinking delta entries. Refactors assertPromptErrorMessages to expect five persisted messages (including streamed bash and custom progress) post-error, and asserts app.streamingBlocks is empty after error application.

Possibly Related PRs

  • omarluq/librecode#46: Extends runtime persistence-failure error behavior and terminal streamed-progress restoration alongside implementation changes to runtime.go and terminal/async_events.go.
  • omarluq/librecode#42: Implements the "persist failed stream progress" behavior in internal/assistant/runtime.go that is validated by the new runtime persistence-failure tests in this PR.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Whiskers twitch with delight,
Tests grow taller through the night,
Helpers shared, assertions true,
Progress streamed in every hue!
Errors caught with careful sight,
All our code now shines so bright!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'test(assistant): cover failed progress persistence' accurately and concisely describes the main changes, which focus on adding test coverage for failed progress persistence scenarios.
Description check ✅ Passed The description clearly relates to the changeset, explaining that it adds coverage for persisting partial streamed progress on provider failure and UI handling of streamed blocks when prompts fail, which matches the file changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/failed-progress-persistence

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.55%. Comparing base (deeb867) to head (422d43a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #47      +/-   ##
==========================================
+ Coverage   61.48%   61.55%   +0.07%     
==========================================
  Files         173      173              
  Lines       17073    17073              
==========================================
+ Hits        10497    10509      +12     
+ Misses       5526     5516      -10     
+ Partials     1050     1048       -2     
Flag Coverage Δ
unittests 61.55% <ø> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@omarluq omarluq merged commit 9f182f8 into main May 24, 2026
13 checks passed
@omarluq omarluq deleted the test/failed-progress-persistence branch May 24, 2026 22:14
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.

2 participants