Skip to content

Recover from completion panics#81

Open
M09Ic wants to merge 1 commit into
reeflective:mainfrom
M09Ic:pr/console-completion-panic-recover
Open

Recover from completion panics#81
M09Ic wants to merge 1 commit into
reeflective:mainfrom
M09Ic:pr/console-completion-panic-recover

Conversation

@M09Ic

@M09Ic M09Ic commented Jun 27, 2026

Copy link
Copy Markdown

Background

A panic during completion currently escapes the completion path and can bring down an interactive console. Completion is usually triggered while typing, so a single bad completer or transient command-tree state should degrade into a visible completion error instead of crashing the process.

Approach

  • Add a deferred recover around Console.complete.
  • Return a readline completion message containing the panic value.
  • Reset the menu command state after a recovered panic so the next completion starts from a clean command tree.

Tests

  • Added a regression test that forces a nil command-tree panic and verifies complete does not panic.
  • Ran go test ./...

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 23.18%. Comparing base (7002774) to head (c47f10f).

Files with missing lines Patch % Lines
completer.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #81      +/-   ##
==========================================
+ Coverage   22.54%   23.18%   +0.63%     
==========================================
  Files          27       27              
  Lines        2045     2049       +4     
==========================================
+ Hits          461      475      +14     
+ Misses       1554     1544      -10     
  Partials       30       30              

☔ View full report in Codecov by Harness.
📢 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.

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