Skip to content

feat(api): retry failed and cancelled analysis runs on loopback - #369

Draft
seonghobae wants to merge 1 commit into
feat/analysis-run-collection-get-gap-003afrom
feat/analysis-run-retry-http-gap-003a
Draft

feat(api): retry failed and cancelled analysis runs on loopback#369
seonghobae wants to merge 1 commit into
feat/analysis-run-collection-get-gap-003afrom
feat/analysis-run-retry-http-gap-003a

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Why

GAP-003A still has no operator-visible retry path. docs/API_CONTRACT.md documents failed → retryable, and collection GET (#368) can list a failed or cancelled run, but POST /v1/analysis-runs with the original idempotency key returns the original receipt. Operators cannot start a new attempt without reconstructing the original body.

Live slices that this PR does not duplicate:

What

Eighth GAP-003A slice stacked on #368 over protected main 1bc02f580cf48e1d39da239f0e818453437c31c3:

  • POST /v1/analysis-runs/{run_id}/retry on AnalysisRunLiveService
  • clones a failed or cancelled run into a new metric-free 202 Accepted with a new run_id and new idempotency key
  • parent remains failed/cancelled; collection GET lists both parent and child
  • reusing the parent idempotency key fails closed
  • accepted, running, succeeded, and unknown runs fail closed
  • empty POST bodies admitted (path run_id + header new key)
  • retry bodies and accepted receipts refuse RMSE/bias/coverage/SE-gate/scientific-acceptance/report keys
  • consumer isolation; path/header/body identity mismatch fails closed
  • GET-by-id remains 400 on this stack
  • ADR 0032 (0026–0031 live on other GAP-003A PRs)

Not an ADR 0014 scientific claim. Not persistence. Not GET-by-id. Not lifecycle POST. Not cancel HTTP. Not collection GET. Not loopback CLI.

Verification

  • cargo clippy -p tepp_api --all-targets -- -D warnings
  • cargo test -p tepp_api --all-targets
  • RUSTDOCFLAGS='-D warnings' cargo doc -p tepp_api --no-deps
  • python3 scripts/validate_documentation.py
  • python3 scripts/check_docstrings.py
  • crates/tepp_api/tests/analysis_run_retry_http_contract.rs
  • doctoring: docs/research/analysis-run-retry-http.md

Exact-head Checks on this SHA are required before merge. Two independent current-head APPROVEs are required. Author cannot self-approve. Merge #368 before this stacked PR, or retarget onto protected main after #368 lands. No force-push. Do not self-approve. Do not --admin merge.

GAP-003A eighth slice: POST /v1/analysis-runs/{run_id}/retry clones a
failed or cancelled run into a new metric-free 202 Accepted with a new
idempotency key. Accepted, running, succeeded, and unknown runs fail
closed. Stacked on collection GET. ADR 0032.
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This was referenced Aug 31, 2026
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.

1 participant