Skip to content

Commit b397dd7

Browse files
committed
feat: US-093 - Add end-to-end dual-purpose shard cache tests
1 parent b672b17 commit b397dd7

5 files changed

Lines changed: 440 additions & 7 deletions

File tree

engine/packages/depot/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ We explicitly do **not** import:
178178
- Tests run against real UDB via `test_db()` (RocksDB-backed temp instance). No mocks for storage paths.
179179
- Shared depot integration-test helpers live in `tests/common/mod.rs`; use them for temp UDB creation, memory UPS construction, `Db` construction, and raw key reads instead of redefining helpers per test file.
180180
- Cold-tier tests use `ColdTier::Filesystem` (local filesystem stand-in for S3). UPS dispatch tests use the UPS memory driver. No real S3 required.
181+
- Workflow cold-publish e2e tests may need a short-lived restore point to pin commit metadata until cold publish; delete it before asserting shard-cache eviction.
181182
- Workflow compaction tests using real `Db::commit` should assert versionstamp-independent invariants; real UDB versionstamps do not encode txid bytes.
182183
- Workflow force-compaction tests should wait for manager companion workflow ids before signaling so the manager is in its durable loop.
183184
- Workflow compaction race tests can use debug-only workflow `test_hooks`; use stored `Notify` permits with `notify_one()` when a notification may arrive before the waiter arms.

engine/packages/depot/src/workflows/compaction/cold.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ pub async fn upload_cold_job(
1313
input: &UploadColdJobInput,
1414
) -> Result<UploadColdJobOutput> {
1515
let input = input.clone();
16+
let input_for_tx = input.clone();
1617
let upload = ctx
1718
.udb()?
1819
.run(move |tx| {
19-
let input = input.clone();
20+
let input = input_for_tx.clone();
2021
async move { prepare_cold_upload_tx(&tx, &input).await }
2122
})
2223
.await?;
@@ -42,10 +43,21 @@ pub async fn upload_cold_job(
4243
});
4344
};
4445
for object in objects {
45-
cold_tier
46-
.put_object(&object.object_key, &object.bytes)
47-
.await
48-
.with_context(|| format!("put sqlite workflow cold shard {}", object.object_key))?;
46+
if let Err(err) = cold_tier.put_object(&object.object_key, &object.bytes).await {
47+
tracing::warn!(
48+
?input.database_branch_id,
49+
?input.job_id,
50+
object_key = object.object_key.as_str(),
51+
error = ?err,
52+
"sqlite workflow cold shard upload failed"
53+
);
54+
return Ok(UploadColdJobOutput {
55+
status: CompactionJobStatus::Rejected {
56+
reason: "cold shard upload failed".to_string(),
57+
},
58+
output_refs: Vec::new(),
59+
});
60+
}
4961
}
5062

5163
Ok(UploadColdJobOutput {

0 commit comments

Comments
 (0)