liboxen 0.48.3

Oxen is a fast, unstructured data version control, to help version large machine learning datasets written in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
use crate::api;
use crate::api::client;
use crate::error::OxenError;
use crate::model::{Branch, Commit, NewCommitBody, RemoteRepository};
use crate::view::CommitResponse;
use crate::view::merge::{Mergeable, MergeableResponse};

pub async fn mergeability(
    remote_repo: &RemoteRepository,
    branch_name: &str,
    workspace_id: &str,
) -> Result<Mergeable, OxenError> {
    let uri = format!("/workspaces/{workspace_id}/merge/{branch_name}");
    let url = api::endpoint::url_from_repo(remote_repo, &uri)?;
    let client = client::new_for_url(&url)?;
    let res = client.get(&url).send().await?;
    let body = client::parse_json_body(&url, res).await?;
    let response: Result<MergeableResponse, serde_json::Error> = serde_json::from_str(&body);
    match response {
        Ok(val) => Ok(val.mergeable),
        Err(err) => Err(OxenError::basic_str(format!(
            "api::workspaces::commits::merge error parsing response from {url}\n\nErr {err:?} \n\n{body}"
        ))),
    }
}

pub async fn commit(
    remote_repo: &RemoteRepository,
    branch_name: &str,
    workspace_id: &str,
    commit: &NewCommitBody,
) -> Result<Commit, OxenError> {
    // Notify the server that we are starting a push
    api::client::repositories::pre_push_workspace(remote_repo).await?;

    let uri = format!("/workspaces/{workspace_id}/commit/{branch_name}");
    let url = api::endpoint::url_from_repo(remote_repo, &uri)?;
    log::debug!("commit_staged {url}\n{commit:?}");

    let client = client::new_for_url(&url)?;
    let res = client.post(&url).json(&commit).send().await?;

    let body = client::parse_json_body(&url, res).await?;
    log::debug!("commit_staged got body: {body}");
    let response: Result<CommitResponse, serde_json::Error> = serde_json::from_str(&body);
    match response {
        Ok(val) => {
            let commit = val.commit;
            // make sure to call our /complete call to kick off the post-push hooks
            let branch = Branch {
                name: branch_name.to_string(),
                commit_id: commit.id.clone(),
            };
            api::client::commits::post_push_complete(remote_repo, &branch, &commit.id).await?;
            api::client::repositories::post_push_workspace(remote_repo).await?;

            println!("🐂 commit {commit} complete!");
            Ok(commit)
        }
        Err(err) => Err(OxenError::basic_str(format!(
            "api::workspaces::commits error parsing response from {url}\n\nErr {err:?} \n\n{body}"
        ))),
    }
}

#[cfg(test)]
mod tests {

    use std::path::Path;

    use crate::config::UserConfig;
    use crate::constants::DEFAULT_BRANCH_NAME;
    use crate::error::OxenError;
    use crate::model::NewCommitBody;
    use crate::opts::DFOpts;
    use crate::test;
    use crate::{api, util};

    #[tokio::test]
    async fn test_commit_staged_multiple_files() -> Result<(), OxenError> {
        test::run_remote_repo_test_bounding_box_csv_pushed(|_local_repo, remote_repo| async move {
            let branch_name = "add-data";
            let branch = api::client::branches::create_from_branch(
                &remote_repo,
                branch_name,
                DEFAULT_BRANCH_NAME,
            )
            .await?;
            assert_eq!(branch.name, branch_name);

            let workspace_id = UserConfig::identifier()?;
            let directory_name = "data";
            let paths = vec![
                test::test_img_file(),
                test::test_img_file_with_name("cole_anthony.jpeg"),
            ];
            api::client::workspaces::create(&remote_repo, &branch_name, &workspace_id).await?;
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_id,
                directory_name,
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok());

            let body = NewCommitBody {
                message: "Add staged data".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };
            let commit =
                api::client::workspaces::commit(&remote_repo, branch_name, &workspace_id, &body)
                    .await?;

            let remote_commit = api::client::commits::get_by_id(&remote_repo, &commit.id).await?;
            assert!(remote_commit.is_some());
            assert_eq!(commit.id, remote_commit.unwrap().id);

            Ok(remote_repo)
        })
        .await
    }

    #[tokio::test]
    async fn test_mergeability_no_conflicts() -> Result<(), OxenError> {
        test::run_remote_repo_test_bounding_box_csv_pushed(|_local_repo, remote_repo| async move {
            let workspace_id = UserConfig::identifier()?;
            let directory_name = "data";
            let paths = vec![test::test_img_file()];
            api::client::workspaces::create(&remote_repo, DEFAULT_BRANCH_NAME, &workspace_id)
                .await?;
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_id,
                directory_name,
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok());

            let mergeable = api::client::workspaces::commits::mergeability(
                &remote_repo,
                DEFAULT_BRANCH_NAME,
                &workspace_id,
            )
            .await?;
            assert!(mergeable.is_mergeable);
            assert_eq!(mergeable.conflicts.len(), 0);
            assert_eq!(mergeable.commits.len(), 1);

            Ok(remote_repo)
        })
        .await
    }

    #[tokio::test]
    async fn test_mergeability_with_no_conflicts_different_files() -> Result<(), OxenError> {
        test::run_remote_repo_test_bounding_box_csv_pushed(|local_repo, remote_repo| async move {
            let workspace_1_id = "workspace_1";
            let directory_name = Path::new("annotations").join("train");
            api::client::workspaces::create(&remote_repo, DEFAULT_BRANCH_NAME, &workspace_1_id)
                .await?;

            // Create a second workspace with the same branch off of the same commit
            let workspace_2_id = "workspace_2";
            api::client::workspaces::create(&remote_repo, DEFAULT_BRANCH_NAME, &workspace_2_id)
                .await?;

            // add an image file to workspace 1
            let paths = vec![test::test_img_file()];
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_1_id,
                directory_name.to_str().unwrap(),
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok());
            let body = NewCommitBody {
                message: "Add image".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };
            // Commit to get the branch ahead
            api::client::workspaces::commit(
                &remote_repo,
                DEFAULT_BRANCH_NAME,
                workspace_1_id,
                &body,
            )
            .await?;

            // And write new data to the annotations/train/bounding_box.csv file
            let bbox_path = local_repo
                .path
                .join("annotations")
                .join("train")
                .join("bounding_box.csv");
            let data = "file,label\ntest/test.jpg,dog";
            util::fs::write_to_path(&bbox_path, data)?;
            let paths = vec![bbox_path];
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_2_id,
                directory_name.to_str().unwrap(),
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok());

            let mergeable = api::client::workspaces::commits::mergeability(
                &remote_repo,
                DEFAULT_BRANCH_NAME,
                workspace_2_id,
            )
            .await?;
            println!("mergeable: {mergeable:?}");
            assert!(mergeable.is_mergeable);
            assert_eq!(mergeable.conflicts.len(), 0);
            assert_eq!(mergeable.commits.len(), 2);

            let body = NewCommitBody {
                message: "Update bounding box".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };

            let commit_result = api::client::workspaces::commit(
                &remote_repo,
                DEFAULT_BRANCH_NAME,
                workspace_2_id,
                &body,
            )
            .await;
            assert!(commit_result.is_ok());

            Ok(remote_repo)
        })
        .await
    }

    #[tokio::test]
    async fn test_mergeability_with_conflicts() -> Result<(), OxenError> {
        test::run_remote_repo_test_bounding_box_csv_pushed(|local_repo, remote_repo| async move {
            let workspace_1_id = "workspace_1";
            let directory_name = Path::new("annotations").join("train");
            api::client::workspaces::create(&remote_repo, DEFAULT_BRANCH_NAME, &workspace_1_id)
                .await?;

            // Create a second workspace with the same branch off of the same commit
            let workspace_2_id = "workspace_2";
            api::client::workspaces::create(&remote_repo, DEFAULT_BRANCH_NAME, &workspace_2_id)
                .await?;

            // And write new data to the annotations/train/bounding_box.csv file
            let bbox_path = local_repo
                .path
                .join("annotations")
                .join("train")
                .join("bounding_box.csv");
            let data = "file,label,min_x,min_y,width,height\ntest/test.jpg,dog,13.5,32.0,385,330";
            util::fs::write_to_path(&bbox_path, data)?;
            let paths = vec![bbox_path];
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_1_id,
                directory_name.to_str().unwrap(),
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok());
            let body = NewCommitBody {
                message: "Update bounding box".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };
            // Commit to get the branch ahead
            api::client::workspaces::commit(
                &remote_repo,
                DEFAULT_BRANCH_NAME,
                workspace_1_id,
                &body,
            )
            .await?;

            // And write new data to the annotations/train/bounding_box.csv file
            let bbox_path = local_repo
                .path
                .join("annotations")
                .join("train")
                .join("bounding_box.csv");
            let data = "file,label\ntest/test.jpg,dog";
            util::fs::write_to_path(&bbox_path, data)?;
            let paths = vec![bbox_path];
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_2_id,
                directory_name.to_str().unwrap(),
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok());
            let body = NewCommitBody {
                message: "Update bounding box".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };

            let mergeable = api::client::workspaces::commits::mergeability(
                &remote_repo,
                DEFAULT_BRANCH_NAME,
                workspace_2_id,
            )
            .await?;
            assert!(!mergeable.is_mergeable);
            assert_eq!(mergeable.conflicts.len(), 1);
            assert_eq!(mergeable.commits.len(), 2);

            let commit_result = api::client::workspaces::commit(
                &remote_repo,
                DEFAULT_BRANCH_NAME,
                workspace_2_id,
                &body,
            )
            .await;
            assert!(commit_result.is_err());

            Ok(remote_repo)
        })
        .await
    }

    #[tokio::test]
    async fn test_commit_added_column_in_dataframe() -> Result<(), OxenError> {
        // Skip duckdb if on windows
        if std::env::consts::OS == "windows" {
            return Ok(());
        }

        test::run_remote_repo_test_bounding_box_csv_pushed(|_local_repo, remote_repo| async move {
            let branch_name = "add-images";
            let branch = api::client::branches::create_from_branch(
                &remote_repo,
                branch_name,
                DEFAULT_BRANCH_NAME,
            )
            .await?;
            assert_eq!(branch.name, branch_name);
            let workspace_id = UserConfig::identifier()?;
            let workspace =
                api::client::workspaces::create(&remote_repo, &branch_name, &workspace_id).await?;
            assert_eq!(workspace.id, workspace_id);

            // train/dog_1.jpg,dog,101.5,32.0,385,330
            let path = Path::new("annotations")
                .join("train")
                .join("bounding_box.csv");
            let column_name = "my_new_column";
            let data = format!(r#"{{"name":"{column_name}", "data_type": "str"}}"#);

            api::client::workspaces::data_frames::index(&remote_repo, &workspace_id, &path).await?;
            let result = api::client::workspaces::data_frames::columns::create(
                &remote_repo,
                &workspace_id,
                &path,
                data.to_string(),
            )
            .await;
            assert!(result.is_ok());

            let body = NewCommitBody {
                message: "Update row".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };
            let commit =
                api::client::workspaces::commit(&remote_repo, branch_name, &workspace_id, &body)
                    .await?;

            let remote_commit = api::client::commits::get_by_id(&remote_repo, &commit.id).await?;
            assert!(remote_commit.is_some());
            assert_eq!(commit.id, remote_commit.unwrap().id);

            let df =
                api::client::data_frames::get(&remote_repo, branch_name, &path, DFOpts::empty())
                    .await?;

            assert_eq!(
                df.data_frame.source.schema.fields.len(),
                df.data_frame.view.schema.fields.len()
            );

            if !df
                .data_frame
                .view
                .schema
                .fields
                .iter()
                .any(|field| field.name == column_name)
            {
                panic!("Column `{column_name}` does not exist in the data frame");
            }

            Ok(remote_repo)
        })
        .await
    }

    #[tokio::test]
    async fn test_commit_same_data_frame_file_twice() -> Result<(), OxenError> {
        test::run_remote_created_and_readme_remote_repo_test(|remote_repo| async move {
            let branch_name = "main";
            let branch = api::client::branches::create_from_branch(
                &remote_repo,
                branch_name,
                DEFAULT_BRANCH_NAME,
            )
            .await?;
            assert_eq!(branch.name, branch_name);

            let workspace_id = UserConfig::identifier()?;
            let ws =
                api::client::workspaces::create(&remote_repo, &branch_name, &workspace_id).await?;
            assert_eq!(ws.id, workspace_id);

            let directory_name = "";
            let paths = vec![test::test_100_parquet()];

            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_id,
                directory_name,
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok(), "{result:?}");

            let commit = api::client::workspaces::commit(
                &remote_repo,
                branch_name,
                &workspace_id,
                &NewCommitBody {
                    message: "Adding 100 row parquet".to_string(),
                    author: "Test User".to_string(),
                    email: "test@oxen.ai".to_string(),
                },
            )
            .await?;

            let remote_commit = api::client::commits::get_by_id(&remote_repo, &commit.id).await?;
            assert_eq!(commit.id, remote_commit.unwrap().id);

            // List the files on main
            let revision = "main";
            let path = "";
            let page = 1;
            let page_size = 100;
            let entries =
                api::client::dir::list(&remote_repo, revision, path, page, page_size).await?;

            // There should be the README and the parquet file
            assert_eq!(entries.total_entries, 2);
            assert_eq!(entries.entries.len(), 2);

            // Add the same file again
            let workspace_id = UserConfig::identifier()? + "2";
            let ws =
                api::client::workspaces::create(&remote_repo, &branch_name, &workspace_id).await?;
            assert_eq!(ws.id, workspace_id);

            let paths = vec![test::test_100_parquet()];
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_id,
                directory_name,
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok(), "{result:?}");

            println!("RESULT FROM 2nd ADD: {:?}", result.unwrap());

            // Commit the changes
            let result = api::client::workspaces::commit(
                &remote_repo,
                branch_name,
                &workspace_id,
                &NewCommitBody {
                    message: "Adding 100 row parquet AGAIN".to_string(),
                    author: "Test User".to_string(),
                    email: "test@oxen.ai".to_string(),
                },
            )
            .await;
            assert!(result.is_err(), "{result:?}");

            // List the files on main
            let entries =
                api::client::dir::list(&remote_repo, revision, path, page, page_size).await?;
            assert_eq!(entries.total_entries, 2);
            assert_eq!(entries.entries.len(), 2);

            Ok(remote_repo)
        })
        .await
    }

    #[tokio::test]
    async fn test_reupload_same_file_without_update_timestamp_fails() -> Result<(), OxenError> {
        test::run_remote_created_and_readme_remote_repo_test(|remote_repo| async move {
            let branch_name = "main";

            // First upload and commit
            let workspace_id = UserConfig::identifier()?;
            api::client::workspaces::create(&remote_repo, branch_name, &workspace_id).await?;

            let paths = vec![test::test_img_file()];
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_id,
                "images",
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok(), "{result:?}");

            let body = NewCommitBody {
                message: "Add image".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };
            let first_commit =
                api::client::workspaces::commit(&remote_repo, branch_name, &workspace_id, &body)
                    .await?;
            assert!(!first_commit.id.is_empty());

            // Re-upload the same file without update_timestamp
            let workspace_id_2 = UserConfig::identifier()? + "_2";
            api::client::workspaces::create(&remote_repo, branch_name, &workspace_id_2).await?;

            let paths = vec![test::test_img_file()];
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_id_2,
                "images",
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok(), "{result:?}");

            // Commit should fail because there are no changes
            let body = NewCommitBody {
                message: "Re-add same image".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };
            let result =
                api::client::workspaces::commit(&remote_repo, branch_name, &workspace_id_2, &body)
                    .await;
            assert!(
                result.is_err(),
                "Expected commit to fail with no changes, but got: {result:?}"
            );

            Ok(remote_repo)
        })
        .await
    }

    #[tokio::test]
    async fn test_reupload_same_file_with_update_timestamp_succeeds() -> Result<(), OxenError> {
        test::run_remote_created_and_readme_remote_repo_test(|remote_repo| async move {
            let branch_name = "main";

            // First upload and commit
            let workspace_id = UserConfig::identifier()?;
            api::client::workspaces::create(&remote_repo, branch_name, &workspace_id).await?;

            let paths = vec![test::test_img_file()];
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_id,
                "images",
                paths,
                &None,
            )
            .await;
            assert!(result.is_ok(), "{result:?}");

            let body = NewCommitBody {
                message: "Add image".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };
            let first_commit =
                api::client::workspaces::commit(&remote_repo, branch_name, &workspace_id, &body)
                    .await?;
            assert!(!first_commit.id.is_empty());

            // Re-upload the same file WITH update_timestamp
            let workspace_id_2 = UserConfig::identifier()? + "_2";
            api::client::workspaces::create(&remote_repo, branch_name, &workspace_id_2).await?;

            let paths = vec![test::test_img_file()];
            let result = api::client::workspaces::files::add_with_opts(
                &remote_repo,
                &workspace_id_2,
                "images",
                paths,
                &None,
                true, // update_timestamp
            )
            .await;
            assert!(result.is_ok(), "{result:?}");

            // Commit should succeed because update_timestamp forces timestamp update
            let body = NewCommitBody {
                message: "Force update same image".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };
            let second_commit =
                api::client::workspaces::commit(&remote_repo, branch_name, &workspace_id_2, &body)
                    .await?;
            assert!(!second_commit.id.is_empty());

            // The commit IDs should be different
            assert_ne!(
                first_commit.id, second_commit.id,
                "Expected different commit IDs after force update"
            );

            // Verify latest_commit on the file entry matches the second commit
            let entries =
                api::client::dir::list(&remote_repo, branch_name, Path::new("images"), 1, 100)
                    .await?;
            let file_entry = entries
                .entries
                .iter()
                .find(|e| e.filename() == "dwight_vince.jpeg")
                .expect("Should find the uploaded file in the directory listing");
            let latest_commit = file_entry
                .latest_commit()
                .expect("File entry should have a latest_commit");
            assert_eq!(
                latest_commit.id, second_commit.id,
                "latest_commit on the file entry should match the update_timestamp commit, got {} expected {}",
                latest_commit.id, second_commit.id,
            );

            Ok(remote_repo)
        })
        .await
    }

    #[tokio::test]
    async fn test_reupload_same_large_file_with_update_timestamp_succeeds() -> Result<(), OxenError>
    {
        test::run_remote_created_and_readme_remote_repo_test(|remote_repo| async move {
            let branch_name = "main";

            let workspace_id = UserConfig::identifier()?;
            api::client::workspaces::create(&remote_repo, branch_name, &workspace_id).await?;

            let paths = vec![test::test_30k_parquet()];
            let result = api::client::workspaces::files::add(
                &remote_repo,
                &workspace_id,
                "parquet",
                paths.clone(),
                &None,
            )
            .await;
            assert!(result.is_ok(), "{result:?}");

            let body = NewCommitBody {
                message: "Add large parquet".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };
            let first_commit =
                api::client::workspaces::commit(&remote_repo, branch_name, &workspace_id, &body)
                    .await?;
            assert!(!first_commit.id.is_empty());

            let workspace_id_2 = UserConfig::identifier()? + "_2";
            api::client::workspaces::create(&remote_repo, branch_name, &workspace_id_2).await?;

            let result = api::client::workspaces::files::add_with_opts(
                &remote_repo,
                &workspace_id_2,
                "parquet",
                paths,
                &None,
                true,
            )
            .await;
            assert!(result.is_ok(), "{result:?}");

            let body = NewCommitBody {
                message: "Force update same large parquet".to_string(),
                author: "Test User".to_string(),
                email: "test@oxen.ai".to_string(),
            };
            let second_commit =
                api::client::workspaces::commit(&remote_repo, branch_name, &workspace_id_2, &body)
                    .await?;
            assert!(!second_commit.id.is_empty());

            assert_ne!(
                first_commit.id, second_commit.id,
                "Expected different commit IDs after force update on a large file"
            );

            let entries =
                api::client::dir::list(&remote_repo, branch_name, Path::new("parquet"), 1, 100)
                    .await?;
            let file_entry = entries
                .entries
                .iter()
                .find(|e| e.filename() == "wiki_30k.parquet")
                .expect("Should find the uploaded large file in the directory listing");
            let latest_commit = file_entry
                .latest_commit()
                .expect("File entry should have a latest_commit");
            assert_eq!(
                latest_commit.id, second_commit.id,
                "latest_commit on the large file entry should match the update_timestamp commit, got {} expected {}",
                latest_commit.id, second_commit.id,
            );

            Ok(remote_repo)
        })
        .await
    }
}