test(sdk): give the isolation and retry-negative tests teeth
Three tests that would pass against a broken implementation: - `kv`/`docs` cross-app isolation asserted only that app B sees nothing — an execution_id-keyed (or script_id-keyed) bridge would pass that AND every single-execution round-trip, with app-scoped persistence entirely gone. Added the positive control: app A re-reads its own value in a LATER execution (a fresh execution_id/script_id via `baseline_request`), which only holds if storage is keyed by app_id. - `retry_policy_rejects_bogus_backoff` asserted a bare `is_err()`, which passes if `retry::policy` is unregistered (ErrorFunctionNotFound), on a script typo, or if every policy is rejected. Now it pins the message (`backoff`) and adds a valid-backoff control that must succeed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -311,6 +311,21 @@ async fn kv_bridge_preserves_cross_app_isolation() {
|
||||
let c = kv::collection("shared");
|
||||
c.get("k")
|
||||
"#;
|
||||
let body = run_script(engine, reader, baseline_request(app_b)).await;
|
||||
assert_eq!(body, Value::Null);
|
||||
let body = run_script(engine.clone(), reader, baseline_request(app_b)).await;
|
||||
assert_eq!(body, Value::Null, "app B must not see app A's value");
|
||||
|
||||
// Positive control — WITHOUT it this test has no teeth. `baseline_request`
|
||||
// mints a fresh execution_id AND script_id each call, so this second run under
|
||||
// app_a is a DIFFERENT execution/script than the writer. A bridge that keyed
|
||||
// storage by execution_id or script_id (instead of app_id) would pass the
|
||||
// negative above AND every single-execution round-trip, while app-scoped
|
||||
// persistence was completely gone. This catches that: app A must still read
|
||||
// back its own value across executions.
|
||||
let body = run_script(engine, reader, baseline_request(app_a)).await;
|
||||
assert_eq!(
|
||||
body,
|
||||
Value::from("from-a"),
|
||||
"app A must read back its own value in a later execution — storage is keyed \
|
||||
by app_id, not execution_id/script_id"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user