Skip to content

Add failed_deploy_trail: the evidence around a failed deploy in one call - #132

Open
shrijacked wants to merge 8 commits into
prooflinedev:mainfrom
shrijacked:failed-deploy-trail
Open

shrijacked wants to merge 8 commits into
prooflinedev:mainfrom
shrijacked:failed-deploy-trail

Conversation

@shrijacked

Copy link
Copy Markdown

Summary

When a deploy fails, the evidence is spread across several reads. failed_deploy_trail on both ProoflineClient and AsyncProoflineClient returns one typed FailedDeployTrail so the next fix starts from evidence.

  • failed_deploy and failing_check: the commit's latest FAILED or regressed deploy (optionally in one environment_id) and its earliest REGRESSED checkpoint.
  • healthy_commit_sha and healthy_deploy: the newest earlier commit whose deploy in the same environment and deployment task verified healthy (VERIFIED or VERIFIED_UNTIL_SUPERSEDED, not regressed, not rolled back).
  • commit_range: the failed commit and the commits after the healthy one, newest first, each with its recorded deploys, reviews, and findings. Each commit is listed twice (kind=DEPLOYMENT, then unfiltered) and a review that appears in both is read once.
  • gaps: everything the trail could not establish. A failed read is kept as a ProoflineError with its traceback and chained exception removed, so a response body cannot stay attached to the result. API failures do not raise. An invalid SHA or a non-finite timeout raises ValueError before any request.

The public API lists no commit history, so the caller passes earlier commits, for example git rev-list --first-parent -n 50 <sha>~1. Only existing operations are used. timeout defaults to 120 seconds and uses the client's existing request deadline.

Who it helps

  • The engineer on call after a failed deploy.
  • Anyone scripting incident tooling on top of the SDK.

Limits

  • The range is only as good as the caller's commit list: at most 50 earlier commits, and 40-character SHA-1 only.
  • The walk stops at the first earlier commit whose deploys cannot be read.
  • Reviews come from the first page of each lookup. A truncated page is a gap.
  • A pull request review appears only when its head commit is in the trail. On a squash-merge repository the deployed commit is often not a pull request head.
  • Requests are sequential. The whole trail stops at timeout.
  • Server text is returned as the API sent it and is untrusted. repr hides it. Problem details keep the existing token redaction.
  • Not documented in README.md.

Still unverified against the live service

  • Whether list_reviews accepts kind together with search. If it rejects that combination, the deployment lookup becomes one gap per commit and the unfiltered lookup still runs.
  • Whether search=<full SHA> returns one run or one per kind.
  • That ReviewSummary.public_key is the value get_deployment_review expects.

Test plan

  • ruff check .
  • ruff format --check .
  • mypy proofline scripts
  • python scripts/generate.py --check
  • python scripts/contracts.py
  • pytest -q — 267 passed, including after merging origin/main (10.2.3)
  • Fake-server demo prints the failing check, the last healthy commit, and the range

scripts/check.py was not run locally because it downloads uv and packages. CI runs it.

Follow-ups

  • README section for the helper.
  • If the API adds commit or deploy history, discover earlier commits server-side.
  • Concurrent review reads in the async client.

Made with Cursor

shrijacked and others added 8 commits November 27, 2026 17:49
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

This branch has not been deployed

No deployments
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