Skip to content

Surface execution-history lookup failures in df.instance_executions (#168)#225

Open
crprashant wants to merge 1 commit into
microsoft:mainfrom
crprashant:crprashant/fix-instance-executions-empty-rows
Open

Surface execution-history lookup failures in df.instance_executions (#168)#225
crprashant wants to merge 1 commit into
microsoft:mainfrom
crprashant:crprashant/fix-instance-executions-empty-rows

Conversation

@crprashant

Copy link
Copy Markdown

Summary

Fixes #168.

df.instance_executions() could return no rows for a completed instance, making "this instance genuinely has no execution history" indistinguishable from "the execution-history lookup silently failed."

Root cause

The function swallowed every failure path into an empty rowset:

  • building the async runtime
  • connecting to the duroxide store (new_backend_provider)
  • list_executions
  • get_execution_info

Each was Err(_) => return vec![]. But duroxide-pg writes the instances row and the first executions row in the same transaction, so a completed instance always has at least one execution row. An empty result could therefore only mean a silently-swallowed lookup failure.

Fix

  • Propagate the runtime / provider / list_executions / get_execution_info failures and raise an explicit error (pgrx::error!) instead of returning an empty rowset. The error is raised outside rt.block_on(...) to avoid longjmp-through-tokio, matching the existing pattern in dsl.rs / client.rs.
  • The legitimately-empty case — a non-existent or non-owned instance, gated by the existing RLS existence check — still returns an empty rowset, which is the correct response.
  • Validate limit_count >= 1 and cap it at 10000, matching df.list_instances.

Issue #168 explicitly accepts "return an explicit error" as a valid resolution.

Testing

  • cargo fmt -p pg_durable -- --check — clean
  • cargo build --features pg17 — clean (only a pre-existing, feature-gated extract_host dead-code warning that is unrelated to this change and absent under CI's feature combo)
  • cargo clippy --no-default-features --features pg17,http-allow-test-domains -- -D warnings — clean (0 warnings)
  • cargo pgrx test pg17 (./scripts/test-unit.sh) — 145 passed, 0 failed, 16 ignored
  • ./scripts/test-e2e-local.sh27 passed, 0 failed, including the new regression test tests/e2e/sql/05_instance_executions.sql

…icrosoft#168)

df.instance_executions() previously swallowed every failure (runtime build, provider connect, list_executions, get_execution_info) into an empty rowset. Because a completed instance always has at least one execution row, an empty result was indistinguishable from a silently failed lookup, masking real errors (issue microsoft#168).

These failures now raise an explicit error, while the genuinely-empty case (a non-existent or non-owned instance, gated by the RLS existence check) still returns an empty rowset. Also validate limit_count >= 1 and cap it at 10000, matching df.list_instances.

Add e2e regression test tests/e2e/sql/05_instance_executions.sql.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

df.instance_executions() can return no rows for completed instances

1 participant