···124124 'initial firehose CAR includes the created record block',
125125);
126126my $initial_commit = decode_dag_cbor($initial_commit_block->{bytes});
127127-ok(exists $initial_commit->{prev}, 'initial commit includes prev for compatibility');
128128-ok(!defined $initial_commit->{prev}, 'initial commit prev is null');
127127+is($initial_commit->{did}, $did, 'initial commit block belongs to the repo');
128128+is($initial_commit->{rev}, $decoded->{body}{rev}, 'initial commit block rev matches the event');
129129130130my $initial_rev = $decoded->{body}{rev};
131131···175175 'second firehose CAR does not resend unchanged prior record blocks',
176176);
177177my $second_commit = decode_dag_cbor($second_commit_block->{bytes});
178178-ok(exists $second_commit->{prev}, 'subsequent commit includes prev for compatibility');
179179-ok(!defined $second_commit->{prev}, 'subsequent commit prev is null');
178178+is($second_commit->{did}, $did, 'subsequent commit block belongs to the repo');
179179+is($second_commit->{rev}, $second->{body}{rev}, 'subsequent commit block rev matches the event');
180180$follow->finish_ok;
181181182182my $future = Test::Mojo->new($app);
+3-2
t/import-repo.t
···98989999my $records = $t->tx->res->json->{records} || [];
100100is(scalar @$records, 1, 'importRepo restores the earlier repo snapshot');
101101-is($records->[0]{uri}, "at://$did/app.bsky.feed.post/before-import", 'imported repo keeps the earlier record URI');
102102-is($records->[0]{value}{text}, 'state before import', 'imported repo restores the earlier record body');
101101+my ($restored) = grep { ($_->{uri} // q()) eq "at://$did/app.bsky.feed.post/before-import" } @$records;
102102+ok($restored, 'imported repo keeps the earlier record URI');
103103+is($restored->{value}{text}, 'state before import', 'imported repo restores the earlier record body');
103104104105done_testing;
+9-1
t/pds_smoke.t
···19192020use Test::Mojo;
2121use ATProto::PDS;
2222+use ATProto::PDS::Repo::CAR qw(read_car);
22232324my $root = File::Spec->rel2abs(File::Spec->catdir($Bin, '..'));
2425my $tmp = tempdir(CLEANUP => 1);
···6869})->status_is(200)
6970 ->json_has('/uri')
7071 ->json_has('/cid');
7272+my $record_cid = $t->tx->res->json->{cid};
71737274$t->get_ok('/xrpc/com.atproto.repo.listRecords' => form => {
7375 repo => $did,
···8082})->status_is(200)
8183 ->json_has('/cid')
8284 ->json_has('/rev');
8585+my $latest_commit_cid = $t->tx->res->json->{cid};
83868487$t->get_ok('/xrpc/com.atproto.sync.getRepo' => form => {
8588 did => $did,
8689})->status_is(200);
87908891like($t->tx->res->headers->content_type // '', qr{application/vnd\.ipld\.car}, 'repo export is served as CAR');
8989-ok(length($t->tx->res->body) > 0, 'repo export is non-empty');
9292+my $repo_car = read_car($t->tx->res->body);
9393+is($repo_car->{roots}[0]->to_string, $latest_commit_cid, 'repo export roots the latest commit');
9494+ok(
9595+ scalar(grep { $_->{cid}->to_string eq $record_cid } @{ $repo_car->{blocks} || [] }),
9696+ 'repo export includes the created record block',
9797+);
90989199done_testing;