Skip to content

fix: guard summary and score display on parseFailed analysis#67

Merged
pi3-code merged 1 commit intomainfrom
fix/guard-parse-failed-summary
Mar 6, 2026
Merged

fix: guard summary and score display on parseFailed analysis#67
pi3-code merged 1 commit intomainfrom
fix/guard-parse-failed-summary

Conversation

@pi3-code
Copy link
Contributor

@pi3-code pi3-code commented Mar 5, 2026

Summary

Follow-up to #65. When analysis parsing fails, the stub object has all-zero scores — but printAnalysisSummary and printScoreSummary still ran, showing misleading "STRATEGY ASSESSMENT" bars and KSM scores of 0.0 right after the spinner already warned about the parse failure.

  • Guard all four printAnalysisSummary call sites to skip when parseFailed is true
  • In analyze.ts multi-run mode, show Score: N/A (parse failed) instead of silent skip
  • In results-flow.ts, show retry message when user selects "View analysis" on a failed parse
  • Add export.test.ts covering promptExport for undefined, parseFailed: true, parseFailed: false, and valid analysis

Files changed:

  • src/commands/run.ts — guard summary + score block
  • src/interactive/run-flow.ts — guard summary + score block
  • src/commands/analyze.ts — guard summary + add N/A fallback for multi-run
  • src/interactive/results-flow.ts — guard interactive "View analysis" menu action
  • tests/unit/export.test.ts — new (4 tests)

Test plan

  • npm run build — clean
  • npx vitest run — 415/415 pass (including 4 new export tests)
  • Manual: run a benchmark, corrupt the analysis JSON, verify no zero-score summary prints
  • Manual: oasis analyze on multiple runs with one corrupted — verify Score: N/A (parse failed) appears

When analysis parsing fails, the stub analysis object has zero scores
across all fields. Before this fix, printAnalysisSummary still ran,
showing a misleading "STRATEGY ASSESSMENT" section with all-zero bars
right after the spinner already reported the parse failure.

Guard all four call sites (run.ts, run-flow.ts, analyze.ts,
results-flow.ts) so summary and score output are skipped when
parseFailed is true. In analyze.ts multi-run mode, show an explicit
"Score: N/A (parse failed)" line instead of silent skip.

Add export.test.ts covering promptExport behavior for undefined,
parseFailed: true, parseFailed: false, and valid analysis inputs.
@pi3-code pi3-code requested a review from Treelovah March 5, 2026 21:37
Copy link
Contributor

@Treelovah Treelovah left a comment

Choose a reason for hiding this comment

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

Good follow-up to #65. This catches the other half of the problem — the zeroed-out strategy bars and 0.0 KSM score that still printed even after the export prompt was gated. All four callsites guarded, multi-run N/A fallback is clean, and the export tests cover the change from #65 too.

@pi3-code pi3-code merged commit a636736 into main Mar 6, 2026
4 checks passed
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