Skip to content

(dolt branches) interrupting gen push before assets finish uploading breaks remote #218

Description

@bobvh

Where

src/commands/remote/operations.rs, execute_push() (~line 462-499)

What

execute_push() pushes the Dolt metadata commit first (run_graph_transfer(...push(&graph, ...)...)), then uploads the referenced asset bytes second (transfer_assets(..., RemoteOperation::Push, ...)). These are two separate, non-atomic network operations with no rollback between them.

Repro

#!/usr/bin/env bash
set -euo pipefail
gen=/path/to/gen/target/debug/gen   # adjust: native debug build of the `gen` CLI
remote_url=http://localhost:5800/api/repos/<namespace>/<repo>   # any writable GenHub remote

# 1. Clone and stage a new sample so the next push has a new asset to upload.
tmp=$(mktemp -d) && cd "$tmp"
"$gen" clone "$remote_url"
cd */  # enter the cloned repo directory
printf '>killtest\nGGGGTTTTCCCCAAAA\n' > /tmp/killtest.fasta
"$gen" import fasta /tmp/killtest.fasta --sample killtest

# 2. In the `gen` source tree, temporarily add a delay between the metadata
#    push and the asset transfer in execute_push() (src/commands/remote/operations.rs),
#    right after the `run_graph_transfer(..., RemoteOperation::Push, ...)` call
#    and before the `transfer_assets(...)` call:
#
#        eprintln!("DEBUGREPRO: metadata push done, sleeping before asset transfer");
#        std::thread::sleep(std::time::Duration::from_secs(5));
#
#    then `cargo build --bin gen` in the gen repo.

# 3. Background the push, wait for the debug marker, then kill mid-sleep
#    (i.e. after the Dolt metadata push has landed remotely, before the asset
#    upload starts):
nohup "$gen" push > /tmp/push_kill_test.log 2>&1 &
push_pid=$!
sleep 3   # tune so /tmp/push_kill_test.log contains the DEBUGREPRO line first
grep -q DEBUGREPRO /tmp/push_kill_test.log   # confirms we're mid-sleep, not still in the metadata push
kill -9 "$push_pid"

# 4. Any fresh clone of the same branch now fails permanently:
tmp2=$(mktemp -d) && cd "$tmp2"
"$gen" clone "$remote_url"
# -> Error: Asset <hash> download failed with HTTP 404

# 5. Revert the temporary sleep/eprintln (git checkout -- src/commands/remote/operations.rs
#    or manually remove the two lines) and rebuild before doing anything else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions