authorclover caruso <git@paperclover.net> 2026-10-11 22:41:04-07:00
committerclover caruso <git@paperclover.net> 2026-10-11 22:47:02-07:00
log6eb07a6251a76619f3c454214d98076d8951273e
treec2817236418b0b7d7f24fa6e8f713bf2d82caaf3
parent8e74dcce15aac05c790b8a2ad57cfb37d0f2f18c
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU (~clover)

test: review uncertain attempts before resuming publication

Assisted-by: gpt-6.1-sol

1 files changed, 7 insertions(+), 20 deletions(-)

crates/notebook/tests/session.rs+7-20
......@@ -837,27 +837,16 @@ fn an_uncertain_attempt_is_released_after_restart_by_review() {
837837 let mut faulty = server::Server::new(&source);
838838 faulty.fault = server::Fault::UnknownBefore;
839839 assert!(replica.sync_once(&mut faulty).is_err());
840 let attempted = replica.status(id).unwrap();
840841 assert!(matches!(
841 replica.status(id).unwrap(),
842 attempted,
842843 Some(EditStatus::AwaitingConfirmation { .. })
843844 ));
844845 drop(replica);
845846
846 let notified = Arc::new(AtomicUsize::new(0));
847 let counter = Arc::clone(&notified);
848 let section = Section::resume(
849 &file,
850 notebook::Replica::open(&cache).unwrap(),
851 false,
852 move || {
853 counter.fetch_add(1, Ordering::SeqCst);
854 },
855 )
856 .unwrap();
857 wait(
858 &section,
859 |event| matches!(event, Event::Attempt { id: n, status: EditStatus::AwaitingConfirmation { .. } } if *n == id),
860 );
847 let section =
848 Section::resume(&file, notebook::Replica::open(&cache).unwrap(), true, || {}).unwrap();
849 assert_eq!(section.status(id).unwrap(), attempted);
861850 assert_eq!(
862851 section
863852 .pending()
......@@ -872,6 +861,7 @@ fn an_uncertain_attempt_is_released_after_restart_by_review() {
872861 if continued {
873862 section.release(id, &archive, Resolution::Mine).unwrap();
874863 assert_eq!(section.status(id).unwrap(), Some(EditStatus::Pending));
864 section.set_offline(false);
875865 published(&section, id);
876866 assert_same(stored_page(&file, space), &local);
877867 } else {
......@@ -887,10 +877,7 @@ fn an_uncertain_attempt_is_released_after_restart_by_review() {
887877 }
888878 let recovery = Recovery::open(&archive).unwrap();
889879 assert_eq!(recovery.pending().unwrap().len(), 1);
890 assert!(matches!(
891 recovery.status(id).unwrap(),
892 Some(EditStatus::AwaitingConfirmation { .. })
893 ));
880 assert_eq!(recovery.status(id).unwrap(), attempted);
894881 assert!(section.pending().unwrap().is_empty());
895882 assert!(
896883 section