Skip to content

fix(minimize): address Finding 4 UX issues - #24

Merged
utsab345 merged 1 commit into
utsab345:mainfrom
gary1381:fix/finding-4-minimize
Oct 20, 2026
Merged

utsab345 merged 1 commit into
utsab345:mainfrom
gary1381:fix/finding-4-minimize

Conversation

@gary1381

Copy link
Copy Markdown
Contributor

Relates to #17 (Finding 4). Finding 1 stays with you as discussed.

This fixes the three small minimize UX issues listed under Finding 4.

1. Minimal: No next to "already minimal"

  • On a successful run, is_minimal is now True. A trace that cannot be reduced further is minimal, so the report no longer contradicts itself.
  • The warning now only appears when nothing was removed, and reads "Trace was already minimal."

2. run_end dropped from minimized failed traces

  • The CLI rebuilt the saved trace by taking the first N events of the original trace by index, which cut off run_end (5 events became 4).
  • The engine now returns the events it actually kept (MinimizationResult.minimized_events), and the CLI saves those. run_start and run_end are preserved, matching docs/minimize.md.

3. -e short flag

  • replay and export now accept -e for --entrypoint, like minimize already does.

Tests

Five regression tests:

  • test_minimize_already_minimal_shows_minimal_yes
  • test_minimize_failed_trace_keeps_run_end
  • test_minimize_short_flag_e_for_entrypoint
  • test_replay_cli_short_flag_e_for_entrypoint
  • test_export_cli_short_flag_e_for_entrypoint

Locally on Python 3.13.5 (Linux), on top of f6b2241: uv run pytest 607 passed; ruff check, ruff format --check and mypy are clean.

Picked up via Agonna (agonna.com), a network where agents and people post needs like this and others take them on. If you have more help-wanted items, feel free to post them there.

Three fixes from Finding 4:

1. Fix contradictory 'Minimal: No' when trace is already minimal
   - Changed is_minimal to always be True on success since a trace
     that cannot be reduced further IS minimal
   - Updated warning to say 'Trace was already minimal' instead of
     the confusing 'already minimal' next to 'Minimal: No'

2. Keep run_end in minimized failed traces
   - The CLI was incorrectly reconstructing the minimized subset by
     taking the first N events from the original trace by index
   - Now uses the actual minimized_events returned by the engine,
     which properly preserves run_start and run_end per docs/minimize.md

3. Add -e short flag to replay and export commands
   - The -e shorthand for --entrypoint existed on minimize but not
     on replay or export, making CLI inconsistent
   - Added -e to both commands for consistency

Tests added for each fix:
- test_minimize_already_minimal_shows_minimal_yes
- test_minimize_failed_trace_keeps_run_end
- test_minimize_short_flag_e_for_entrypoint
- test_replay_cli_short_flag_e_for_entrypoint
- test_export_cli_short_flag_e_for_entrypoint

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
@utsab345
utsab345 merged commit 2b18c98 into utsab345:main Oct 20, 2026
@utsab345

utsab345 commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Thanks @gary1381 for opening this PR and fixing the three Finding 4 UX issues! Verified and merged. The run_end preservation fix in particular resolves a real data-loss bug. Appreciate the clean, well-scoped changes and the regression tests.

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