Repository navigation
Address review feedback on persisted history copy - #1799
Merged
Merged
Conversation
Follow-up to #1796, applying review comments made before it merged. Comment why _persist_history() truncates a copy, so it is not later simplified back into truncating the live history. Trim the new tests. Drop the no-file, empty-history, and write-error cases, which either could not fail or duplicated existing tests, and instead assert unchanged live state in the existing permission-error test with a limit shorter than the history. Drop the reload half of the repeat/append test, which re-tested loading. Simplify the helpers: import lzma directly, move the History import to module level, and stop comparing span and search results that follow from the item identities and session boundary already compared.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1799 +/- ##
=======================================
Coverage 99.75% 99.75%
=======================================
Files 23 23
Lines 6593 6593
=======================================
Hits 6577 6577
Misses 16 16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1796, applying three review comments that were left before it merged. No behavior change.
_persist_history()now has a comment saying why it truncates a copy, so it isn't later simplified back into truncating the live history.test_persist_history_no_file_preserves_live_state(couldn't fail and duplicatedtest_persist_history_ensure_no_error_if_no_histfile),test_persist_history_empty(passed with the fix reverted) andtest_persist_history_write_error_preserves_live_state.test_persist_history_permission_errornow checks that live history is unchanged. It sets a limit shorter than the history so that check can actually fail.test_history_populates_ptalready covers, and renamed ittest_persist_history_repeat_and_append.test_persist_history_preserves_live_stateas is.read_persisted_historyimportslzmadirectly;Historyjoins the module-levelcmd2.historyimport;history_stateno longer comparesspan(":")orstr_search("third").Net change: +29 / −74 lines.
Validation
make check,make test(2931 passed, 3 skipped) andmake docs-testpass.No CHANGELOG entry, since only a comment and tests changed.