0961967f3e9d
keep checkpoints out of koh saves when piped or asked for json, so the list agrees with the view (3.0.77)
- time
- 2026-09-27 10:04 UTC · 2 weeks ago
- machine
- Junes-MacBook-Pro.local
- agent
- deepseek/deepseek-flash
- session
- koh 3 phases 6-8
- parent
- 6d6918095a35
↓ koh-0961967f.tar.gzatlas at this save
files changed4 files
VERSION+1 −1src/cli/cmd_log.v+8 −11tests/cli_test.v+8 −1v.mod+1 −1src/cli/cmd_log.v+8 −11
@@ -84,19 +84,16 @@8484 return 08585 }8686 87-// line_for_tab picks the saves a tab shows. `log` and `saves` use the same88-// filter; checkpoints narrows the line to checkpoints.87+// line_for_tab picks the saves a tab shows: `log` is the whole line, `saves`88+// leaves checkpoints out, and `checkpoints` keeps only them, so the two lists89+// never overlap.8990 fn line_for_tab(store &storage.Store, tab view.Tab) ![]history.Save {90- if tab != .checkpoints {91- return history.line(store)91+ line := history.line(store)!92+ if tab == .all {93+ return line9294 }93- mut out := []history.Save{}94- for save in history.line(store)! {95- if save.is_checkpoint {96- out << save97- }98- }99- return out95+ want_checkpoints := tab == .checkpoints96+ return line.filter(it.is_checkpoint == want_checkpoints)10097 }10198 10299 fn history_view(store &storage.Store, tab view.Tab) int {tests/cli_test.v+8 −1
@@ -668,17 +668,24 @@668668 saves := run(dir, 'saves')669669 assert saves.code == 0670670 assert saves.out.contains('plain save')671- assert saves.out.contains('checkpoint save')671+ // The two lists never overlap, on a terminal or piped.672+ assert !saves.out.contains('checkpoint save')672673 checkpoints := run(dir, 'checkpoints')673674 assert checkpoints.code == 0674675 assert checkpoints.out.contains('checkpoint save')675676 assert !checkpoints.out.contains('plain save')677+ json_saves := run(dir, 'saves', '--json')678+ assert json_saves.code == 0679+ assert json_saves.out.contains('"is_checkpoint":false')680+ assert !json_saves.out.contains('"is_checkpoint":true')676681 json_result := run(dir, 'checkpoints', '--json')677682 assert json_result.code == 0678683 assert json_result.out.contains('"head_id"')679684 assert json_result.out.contains('"saves"')680685 assert json_result.out.contains('"is_checkpoint":true')681686 assert !json_result.out.contains('"is_checkpoint":false')687+ // `log` stays the whole line, checkpoints and all.688+ assert run(dir, 'log').out.contains('checkpoint save')682689 }683690 684691 fn test_remote_configuration_is_isolated_and_atomic() {v.mod+1 −1
@@ -1,6 +1,6 @@11 Module {22 name: 'koh3'3- version: '3.0.76'3+ version: '3.0.77'44 description: 'One SQLite file per repo, one line of history.'55 license: 'MIT'66 }