From f620c94b4dc1e50e68d01d31444fa3d903383c71 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi <543633+mohsen1@users.noreply.github.com> Date: Sun, 18 Oct 2026 19:48:06 +0200 Subject: [PATCH] Sync Python SDK with canonical public review contract --- openapi.public.json | 831 +++++++++++++++++- proofline/__init__.py | 6 + .../api/default/request_file_review.py | 212 +++++ .../api/default/request_patch_review.py | 24 +- .../_generated/api/default/stop_review.py | 188 ++++ proofline/_generated/models/__init__.py | 38 + proofline/_generated/models/approval_gap.py | 70 ++ .../models/change_diagram_kind_view.py | 9 + .../models/change_diagram_outcome_type_0.py | 8 + .../_generated/models/change_diagram_view.py | 209 +++++ .../_generated/models/customer_assessment.py | 36 + .../models/customer_assessment_detail.py | 36 + .../models/customer_review_detail.py | 103 ++- .../models/declared_reach_outcome.py | 11 + .../_generated/models/declared_reach_view.py | 167 ++++ .../_generated/models/export_review_kind.py | 1 + .../_generated/models/file_review_request.py | 51 ++ .../_generated/models/file_review_response.py | 73 ++ proofline/_generated/models/file_scope.py | 52 ++ proofline/_generated/models/gate_state.py | 20 + .../_generated/models/local_reverification.py | 96 ++ .../models/local_reverification_outcome.py | 11 + .../_generated/models/occurrence_capture.py | 221 +++++ .../_generated/models/occurrence_question.py | 200 +++++ .../_generated/models/patch_review_request.py | 28 + .../models/patch_review_response.py | 25 +- .../_generated/models/patch_verification.py | 72 ++ .../models/pull_request_merge_gate.py | 5 +- proofline/_generated/models/reach_gap_view.py | 61 ++ .../_generated/models/reach_step_view.py | 79 ++ .../_generated/models/reached_entity_view.py | 109 +++ proofline/_generated/models/refresh_view.py | 141 +++ proofline/_generated/models/review_summary.py | 45 +- proofline/_generated/models/stop_response.py | 94 ++ proofline/_generated/models/subject_view.py | 34 + proofline/client.py | 35 + scripts/contracts.py | 4 +- tests/test_http.py | 33 +- 38 files changed, 3410 insertions(+), 28 deletions(-) create mode 100644 proofline/_generated/api/default/request_file_review.py create mode 100644 proofline/_generated/api/default/stop_review.py create mode 100644 proofline/_generated/models/approval_gap.py create mode 100644 proofline/_generated/models/change_diagram_kind_view.py create mode 100644 proofline/_generated/models/change_diagram_outcome_type_0.py create mode 100644 proofline/_generated/models/change_diagram_view.py create mode 100644 proofline/_generated/models/declared_reach_outcome.py create mode 100644 proofline/_generated/models/declared_reach_view.py create mode 100644 proofline/_generated/models/file_review_request.py create mode 100644 proofline/_generated/models/file_review_response.py create mode 100644 proofline/_generated/models/file_scope.py create mode 100644 proofline/_generated/models/local_reverification.py create mode 100644 proofline/_generated/models/local_reverification_outcome.py create mode 100644 proofline/_generated/models/occurrence_capture.py create mode 100644 proofline/_generated/models/occurrence_question.py create mode 100644 proofline/_generated/models/patch_verification.py create mode 100644 proofline/_generated/models/reach_gap_view.py create mode 100644 proofline/_generated/models/reach_step_view.py create mode 100644 proofline/_generated/models/reached_entity_view.py create mode 100644 proofline/_generated/models/refresh_view.py create mode 100644 proofline/_generated/models/stop_response.py diff --git a/openapi.public.json b/openapi.public.json index 7ab1d71a..0d85adb9 100644 --- a/openapi.public.json +++ b/openapi.public.json @@ -263,6 +263,24 @@ ], "type": "string" }, + "ApprovalGap": { + "properties": { + "assessment_id": { + "description": "Assessment whose approval could not supply deferred occurrence questions.", + "format": "uuid", + "type": "string" + }, + "code": { + "description": "Reason the assessment's approval could not supply deferred occurrence questions.", + "type": "string" + } + }, + "required": [ + "assessment_id", + "code" + ], + "type": "object" + }, "AssessmentProjection": { "properties": { "assessment_id": { @@ -457,6 +475,36 @@ } ] }, + "CaptureState": { + "description": "How the capture ended.", + "oneOf": [ + { + "const": "PENDING", + "description": "Still waiting for an authorized execution or a decidable look.", + "type": "string" + }, + { + "const": "RECORDED", + "description": "World recorded every deferred question.", + "type": "string" + }, + { + "const": "UNBOUND", + "description": "At least one deferred question is not bound to the execution.", + "type": "string" + }, + { + "const": "NOT_EXECUTED", + "description": "The gate never authorized the execution.", + "type": "string" + }, + { + "const": "INCOMPLETE", + "description": "The capture failed before it wrote its receipt. The gate is\n unchanged; nothing is inferred about the deferred questions.", + "type": "string" + } + ] + }, "ChangeAttributionView": { "description": "Which conditions behind a check's result the change brought, and which\n World found at the review's base revision. It sits beside the result and\n never changes it: a condition already at the base is still a condition.", "properties": { @@ -576,6 +624,86 @@ ], "type": "object" }, + "ChangeDiagramKindView": { + "enum": [ + "FLOWCHART", + "SEQUENCE" + ], + "type": "string" + }, + "ChangeDiagramOutcome": { + "oneOf": [ + { + "enum": [ + "DRAWN" + ], + "type": "string" + }, + { + "const": "NO_INTERACTION", + "description": "No interaction between three or more components survived selection.", + "type": "string" + }, + { + "const": "INDEX_INCOMPLETE", + "description": "The head's code index could not vouch for every edge.", + "type": "string" + }, + { + "const": "OVER_CAPS", + "description": "The changed call path is larger than a diagram shows.", + "type": "string" + }, + { + "const": "DECISION_UNAVAILABLE", + "description": "A decision the diagram depends on gave no answer.", + "type": "string" + } + ] + }, + "ChangeDiagramView": { + "description": "The change-level diagram recorded for a review, or why there is none.", + "properties": { + "kind": { + "anyOf": [ + { + "$ref": "#/components/schemas/ChangeDiagramKindView" + }, + { + "type": "null" + } + ], + "description": "Diagram format when a diagram was drawn; otherwise null." + }, + "legend": { + "description": "Markdown lines under the diagram: which environment and snapshot its\n dashed relations come from, or which environment was not read.", + "items": { + "type": "string" + }, + "type": "array" + }, + "mermaid": { + "description": "Mermaid source the server generated from the stored graph. Every\n label is escaped, and no model wrote any of it. Absent unless\n `outcome` is `DRAWN`.", + "type": [ + "string", + "null" + ] + }, + "outcome": { + "allOf": [ + { + "$ref": "#/components/schemas/ChangeDiagramOutcome" + } + ], + "description": "Whether the diagram was drawn, or why no diagram is available." + } + }, + "required": [ + "outcome", + "legend" + ], + "type": "object" + }, "CheckLifecycle": { "description": "World's lifecycle disclosure for the evaluator version that answered, as\n the receipt recorded it. A deployment gate counts only `GATING` results\n (`DeterministicCoverage::gate_effective_status`), and only when it\n evaluates a deployment; the lifecycle alone permits or blocks nothing.", "oneOf": [ @@ -795,6 +923,17 @@ ], "description": "The retained decision disclosure, which grants no deployment\n authorization. Absent when none is recorded and the review kind\n records no decision basis." }, + "declared_reach": { + "anyOf": [ + { + "$ref": "#/components/schemas/DeclaredReachView" + }, + { + "type": "null" + } + ], + "description": "What World declares depends on what this change deploys in this\n environment, at the assessment's pinned snapshot. Absent when the\n assessment's kind records no declared reach." + }, "domains": { "description": "The risk domains the assessment evaluated, each with its status and\n reason, ordered by domain.", "items": { @@ -894,6 +1033,17 @@ ], "description": "The retained decision disclosure, which grants no deployment\n authorization. Absent when none is recorded and the review kind\n records no decision basis." }, + "declared_reach": { + "anyOf": [ + { + "$ref": "#/components/schemas/DeclaredReachView" + }, + { + "type": "null" + } + ], + "description": "What World declares depends on what this change deploys in this\n environment, at the assessment's pinned snapshot. Absent when the\n assessment's kind records no declared reach." + }, "domains": { "description": "The risk domains the assessment evaluated, each with its status and\n reason, ordered by domain.", "items": { @@ -1596,6 +1746,17 @@ "null" ] }, + "change_diagram": { + "anyOf": [ + { + "$ref": "#/components/schemas/ChangeDiagramView" + }, + { + "type": "null" + } + ], + "description": "The change-level diagram: the changed call path from the pinned code\n index and the relations World declares. Absent when the review\n recorded none." + }, "check_run_url": { "description": "The GitHub check run Proofline published for this review. Null when\n none was published.", "type": [ @@ -1702,9 +1863,16 @@ "type": "string" }, "kind": { - "description": "`PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, a review of local changes\n sent as a patch, or `COMMIT`, a review of pushed commits.", + "description": "`PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, a review of local changes\n sent as a patch, `COMMIT`, a review of pushed commits, or `FILES`,\n complete selected files at one pushed commit.", "type": "string" }, + "local_reverifications": { + "description": "For a patch review requested with `verify_finding_ids`, each finding\n it re-verifies against the patch and the outcome. The outcome is\n local: the pull request's finding is unchanged whatever it is. Absent\n otherwise.", + "items": { + "$ref": "#/components/schemas/LocalReverification" + }, + "type": "array" + }, "merge_gate": { "anyOf": [ { @@ -1811,6 +1979,17 @@ "null" ] }, + "refresh": { + "anyOf": [ + { + "$ref": "#/components/schemas/RefreshView" + }, + { + "type": "null" + } + ], + "description": "How this review decided what it reviews after a push or a full-review\n request. Absent for a review that refreshes nothing, and while a\n refresh has not decided yet." + }, "related_reviews": { "description": "Every other run for this pull request the caller can see, plus reviews\n joined to this one by supersession or rerun.", "items": { @@ -1975,6 +2154,68 @@ ], "type": "string" }, + "DeclaredReachOutcome": { + "enum": [ + "READ", + "NO_ROOTS", + "ROOTS_UNKNOWN", + "UNAVAILABLE" + ], + "type": "string" + }, + "DeclaredReachView": { + "description": "One assessment's declared reach receipt. A reached entity declares a\n dependency on what the change deploys; it is never a claim that the change\n breaks it.", + "properties": { + "complete": { + "description": "Whether World's walk ended with no gap. An empty, incomplete reach\n says nothing about what depends on the change.", + "type": "boolean" + }, + "entities": { + "description": "Every reached entity, shorter paths first, then by kind.", + "items": { + "$ref": "#/components/schemas/ReachedEntityView" + }, + "type": "array" + }, + "gaps": { + "description": "Where World's walk or its evidence stopped.", + "items": { + "$ref": "#/components/schemas/ReachGapView" + }, + "type": "array" + }, + "outcome": { + "allOf": [ + { + "$ref": "#/components/schemas/DeclaredReachOutcome" + } + ], + "description": "`READ` when World answered, `NO_ROOTS` when no evidence bound a\n deployed artifact or workload to the repository, `ROOTS_UNKNOWN` when\n World's evidence does not establish which revision runs, and\n `UNAVAILABLE` when World gave no answer. Only `READ` carries entities or gaps." + }, + "receipt_digest": { + "description": "World's digest of its full answer. Null unless `READ`.", + "type": [ + "string", + "null" + ] + }, + "snapshot_id": { + "description": "The World snapshot the reach was read at. Null unless `READ`.", + "format": "uuid", + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "outcome", + "complete", + "entities", + "gaps" + ], + "type": "object" + }, "DeepReviewEscalation": { "properties": { "reason": { @@ -2091,7 +2332,8 @@ "PULL_REQUEST", "DEPLOYMENT", "PATCH", - "COMMIT" + "COMMIT", + "FILES" ], "type": "string" }, @@ -2172,6 +2414,69 @@ ], "type": "object" }, + "FileReviewRequest": { + "additionalProperties": false, + "description": "Whole files selected at one exact pushed commit.", + "properties": { + "commit_sha": { + "description": "The exact pushed commit whose whole files are reviewed.", + "type": "string" + }, + "paths": { + "description": "Between one and twenty exact repository-relative file paths.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "commit_sha", + "paths" + ], + "type": "object" + }, + "FileReviewResponse": { + "description": "What a named-file review request produced.", + "properties": { + "existing": { + "description": "True when this exact selection already had a review and that one is\n returned. Sending the same selection twice by the same person reviews it once.", + "type": "boolean" + }, + "review_id": { + "description": "The review of this selection, readable through the review and findings\n routes.", + "format": "uuid", + "type": "string" + } + }, + "required": [ + "review_id", + "existing" + ], + "type": "object" + }, + "FileScope": { + "additionalProperties": false, + "description": "The retained selection, not a digest of file contents. Its identity uses\n a version prefix and length-framed UTF-8 paths in their sorted order.", + "properties": { + "paths": { + "description": "Sorted, unique repository-relative paths selected for whole-file review.", + "items": { + "type": "string" + }, + "type": "array" + }, + "paths_digest": { + "description": "Digest of the selected paths, not the file contents.", + "type": "string" + } + }, + "required": [ + "paths", + "paths_digest" + ], + "type": "object" + }, "FilterChoice": { "properties": { "id": { @@ -3010,6 +3315,13 @@ }, "GateState": { "properties": { + "occurrence_captures": { + "description": "The occurrence questions the gate's approval deferred, as each\n observed execution of its deployment answered them. Outcome-only\n records: none of them changes the gate or grades a prediction.", + "items": { + "$ref": "#/components/schemas/OccurrenceCapture" + }, + "type": "array" + }, "override_record": { "anyOf": [ { @@ -3027,7 +3339,8 @@ } }, "required": [ - "status" + "status", + "occurrence_captures" ], "type": "object" }, @@ -3042,6 +3355,43 @@ ], "type": "string" }, + "LocalReverification": { + "description": "One finding a patch review re-verified against the patch. The outcome is\n local: the pull request's finding is unchanged whatever it is.", + "properties": { + "checks": { + "description": "Each deterministic check the finding cited and its result on the\n patched head. Empty until an outcome is recorded." + }, + "finding_id": { + "format": "uuid", + "type": "string" + }, + "iteration": { + "description": "The request's number among the requests to re-verify the finding's\n series on this patch, at most 3.", + "format": "int32", + "type": "integer" + }, + "outcome": { + "$ref": "#/components/schemas/LocalReverificationOutcome" + } + }, + "required": [ + "finding_id", + "iteration", + "outcome", + "checks" + ], + "type": "object" + }, + "LocalReverificationOutcome": { + "description": "`RESOLVED_VERIFIED` needs the re-investigation to reject the finding's\n hypothesis and every cited check to pass. `STILL_PRESENT`: the hypothesis\n is supported, or a check still finds the mechanism. `NOT_VERIFIED`:\n anything else, including a review that ended without an answer.\n `PENDING`: the review is still running.", + "enum": [ + "RESOLVED_VERIFIED", + "STILL_PRESENT", + "NOT_VERIFIED", + "PENDING" + ], + "type": "string" + }, "NotAssessedView": { "properties": { "environment_display_name": { @@ -3061,6 +3411,108 @@ ], "type": "object" }, + "OccurrenceCapture": { + "description": "The capture of one observed execution of a gate's deployment.", + "properties": { + "approval_gaps": { + "description": "Assessments whose approval could defer nothing, with the reason.", + "items": { + "$ref": "#/components/schemas/ApprovalGap" + }, + "type": "array" + }, + "detail": { + "description": "Explanation of the capture's outcome, when available.", + "type": [ + "string", + "null" + ] + }, + "occurrence_key": { + "description": "Retained identity of the deployment occurrence, when available.", + "type": [ + "string", + "null" + ] + }, + "questions": { + "description": "Deferred questions and their binding or observed results for this occurrence.", + "items": { + "$ref": "#/components/schemas/OccurrenceQuestion" + }, + "type": "array" + }, + "state": { + "allOf": [ + { + "$ref": "#/components/schemas/CaptureState" + } + ], + "description": "Whether the capture is pending, recorded, unbound, not executed, or incomplete." + } + }, + "required": [ + "state", + "approval_gaps", + "questions" + ], + "type": "object" + }, + "OccurrenceQuestion": { + "description": "One deferred question as the gate presents it.", + "properties": { + "assessment_id": { + "description": "Assessment whose approval deferred this question.", + "format": "uuid", + "type": "string" + }, + "code": { + "description": "World's binding or refusal code, or the control plane's own gap.", + "type": [ + "string", + "null" + ] + }, + "family_key": { + "description": "Hypothesis family key for the deferred question.", + "type": "string" + }, + "family_version": { + "description": "Hypothesis family version for the deferred question.", + "format": "int32", + "type": "integer" + }, + "observed_result": { + "description": "World's observed result once it recorded the question.", + "type": [ + "string", + "null" + ] + }, + "outcome_id": { + "description": "World outcome record identifier, when an observed result was recorded.", + "type": [ + "string", + "null" + ] + }, + "state": { + "allOf": [ + { + "$ref": "#/components/schemas/QuestionState" + } + ], + "description": "Whether the question is pending, recorded, unbound, or not executed." + } + }, + "required": [ + "assessment_id", + "family_key", + "family_version", + "state" + ], + "type": "object" + }, "OpenFindingCounts": { "properties": { "serious": { @@ -3330,6 +3782,15 @@ ], "default": null, "description": "The git hook that sent this request, when one did. A review recorded\n by an earlier identical request keeps the source it recorded." + }, + "verify_finding_ids": { + "default": [], + "description": "Open findings of one pull request in this repository to re-verify\n against the patch, at most 20. The review re-investigates each one\n and reports its outcome in `local_reverifications`; the pull\n request's findings are unchanged whatever it is. Requires an API\n token. Each finding's series takes at most 3 requests per patch, and\n the pull request at most 10 re-verification requests per hour,\n counted with those a coding agent makes through MCP.", + "items": { + "format": "uuid", + "type": "string" + }, + "type": "array" } }, "required": [ @@ -3353,12 +3814,20 @@ "description": "The review of this patch on this base, readable through the review\n and findings routes.", "format": "uuid", "type": "string" + }, + "verify": { + "description": "Each finding of `verify_finding_ids` the review re-verifies, one per\n finding series. Empty without `verify_finding_ids`.", + "items": { + "$ref": "#/components/schemas/PatchVerification" + }, + "type": "array" } }, "required": [ "review_id", "existing", - "patch_digest" + "patch_digest", + "verify" ], "type": "object" }, @@ -3368,7 +3837,26 @@ "HOOK_PRE_COMMIT", "HOOK_PRE_PUSH" ], - "type": "string" + "type": "string" + }, + "PatchVerification": { + "description": "One finding a patch review re-verifies against the patch.", + "properties": { + "finding_id": { + "format": "uuid", + "type": "string" + }, + "iteration": { + "description": "This request's number among the requests to re-verify the finding's\n series on this patch, at most 3.", + "format": "int32", + "type": "integer" + } + }, + "required": [ + "finding_id", + "iteration" + ], + "type": "object" }, "PermissionView": { "enum": [ @@ -3470,7 +3958,7 @@ ] }, "blocking_severity": { - "description": "The frozen blocking threshold, either SERIOUS or WARNING; later settings do not restamp it.", + "description": "The frozen blocking threshold, either SERIOUS (serious and critical findings) or WARNING (every\n supported finding); later settings do not restamp it.", "type": "string" }, "bypassed_at": { @@ -3590,6 +4078,140 @@ ], "type": "object" }, + "QuestionState": { + "description": "Where one deferred question stands.", + "oneOf": [ + { + "const": "PENDING", + "description": "World has stored no record yet: the execution is not yet decidable\n inside the question's window.", + "type": "string" + }, + { + "const": "RECORDED", + "description": "World recorded what the execution was observed to do.", + "type": "string" + }, + { + "const": "UNBOUND", + "description": "The question is not bound to the execution: World's binding code, its\n refusal of the replay, or the control plane's own gap says why.", + "type": "string" + }, + { + "const": "NOT_EXECUTED", + "description": "The gate never authorized the execution, so nothing ran to observe.", + "type": "string" + } + ] + }, + "ReachGapView": { + "properties": { + "code": { + "description": "`COVERAGE_INCOMPLETE`, `SOURCE_CAPABILITY_MISSING` or `BOUND_REACHED`.", + "type": "string" + } + }, + "required": [ + "code" + ], + "type": "object" + }, + "ReachStepView": { + "properties": { + "assertion_id": { + "description": "The World relation assertion behind this step.", + "format": "uuid", + "type": "string" + }, + "direction": { + "description": "`OUT` when the step follows the relation from its subject, `IN` when\n it follows it back to the subject.", + "type": "string" + }, + "relation": { + "description": "The relation key, such as `proofline.relation.consumes_api`.", + "type": "string" + } + }, + "required": [ + "assertion_id", + "relation", + "direction" + ], + "type": "object" + }, + "ReachedEntityView": { + "properties": { + "entity_id": { + "description": "World's entity ID.", + "format": "uuid", + "type": "string" + }, + "kind": { + "description": "The entity's kind, such as `service` or `queue`.", + "type": "string" + }, + "label": { + "description": "World's display label for the entity: environment evidence for\n readers of this organization, never published to GitHub.", + "type": "string" + }, + "path": { + "description": "The recorded relation assertions from the deployed root to the entity.", + "items": { + "$ref": "#/components/schemas/ReachStepView" + }, + "type": "array" + }, + "type_keys": { + "description": "World's registry type keys for the entity.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "entity_id", + "kind", + "type_keys", + "label", + "path" + ], + "type": "object" + }, + "RefreshView": { + "description": "A recorded refresh decision, as the console shows it.", + "properties": { + "decided_by": { + "description": "What decided: `FLOOR`, a refresh rule that always reviews the whole\n change; `JEV`, Proofline's decision model within those rules; or\n `FALLBACK`, the refresh rules because the model did not decide.\n Absent for a full review a person requested, and for reviews decided\n before it was recorded.", + "type": [ + "string", + "null" + ] + }, + "mode": { + "description": "`INCREMENTAL` reviews only the files the push touched and carries the\n earlier review's untouched findings forward; `FULL` reviews the whole change.", + "type": "string" + }, + "reason": { + "description": "Why, in words. Server text that may name repository paths.", + "type": [ + "string", + "null" + ] + }, + "refreshes_review_id": { + "description": "The review this one refreshes. Absent for a full review a person requested.", + "format": "uuid", + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "mode" + ], + "type": "object" + }, "RefusedEnvironment": { "description": "An environment a refusal names. `external_key` is how its pages are\n addressed.", "properties": { @@ -4151,7 +4773,7 @@ "type": "string" }, "kind": { - "description": "`PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, a review of local changes\n sent as a patch, or `COMMIT`, a review of pushed commits.", + "description": "`PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, a review of local changes\n sent as a patch, `COMMIT`, a review of pushed commits, or `FILES`,\n complete selected files at one pushed commit.", "type": "string" }, "public_key": { @@ -4227,6 +4849,17 @@ "null" ] }, + "refresh": { + "anyOf": [ + { + "$ref": "#/components/schemas/RefreshView" + }, + { + "type": "null" + } + ], + "description": "How this review decided what it reviews after a push or a full-review\n request. Absent for a review that refreshes nothing, and while a\n refresh has not decided yet." + }, "repository_full_name": { "description": "The repository's `owner/name`. Absent when the review names no repository.", "type": [ @@ -4377,7 +5010,7 @@ "$ref": "#/components/schemas/ExportReviewKind" } ], - "description": "Whether the review analyzes a pull request, a deployment, a local patch or pushed\n commits." + "description": "Whether the review analyzes a pull request, a deployment, a local patch, pushed\n commits or selected whole files." }, "organization_id": { "description": "The organization that owns the review.", @@ -5014,6 +5647,40 @@ ], "type": "object" }, + "StopResponse": { + "description": "What stopping a review recorded.", + "properties": { + "review_id": { + "description": "Identifier of the stopped review.", + "format": "uuid", + "type": "string" + }, + "status": { + "description": "Always `STOPPED`: the review's status once the stop is committed.", + "type": "string" + }, + "stopped_at": { + "description": "Time when the review was stopped.", + "format": "date-time", + "type": "string" + }, + "stopped_by": { + "allOf": [ + { + "$ref": "#/components/schemas/ActorView" + } + ], + "description": "Person who stopped the review." + } + }, + "required": [ + "review_id", + "status", + "stopped_by", + "stopped_at" + ], + "type": "object" + }, "SubjectAuthorization": { "description": "One assessment's authorization of one subject, by identity.\n\n The display name is not the answer on its own: an environment's external key\n is unique within its organization and a display name is mutable metadata,\n so two environments of one review can carry the same one.\n Collapsing to it would leave a reader unable to tell which assessment\n authorized the subject and which one gapped, which is the confusion this\n field exists to remove.", "properties": { @@ -5067,6 +5734,17 @@ "null" ] }, + "file_scope": { + "anyOf": [ + { + "$ref": "#/components/schemas/FileScope" + }, + { + "type": "null" + } + ], + "description": "Whole-file selection at the pinned revision; absent for comparisons." + }, "id": { "description": "The subject's stable identifier. It holds across a poll refresh even\n when a concurrently populated subject shifts this response's\n `(kind, id)` order: a client keying its own local UI state (an open\n disclosure, a focused control) by array index would otherwise lose\n that state to a reorder that changed nothing it owns.", "format": "uuid", @@ -5813,9 +6491,87 @@ "x-proofline-token-scope": "reviews:request" } }, + "/api/v1/organizations/{org_id}/repositories/{repo_id}/file-reviews": { + "post": { + "description": "Reviews up to twenty exact file paths at one pushed commit. Requires live GitHub read access and verifies every path at that commit. The retained selection is immutable; a repeat by the same person returns its review. Results remain in Proofline and are never posted to GitHub.", + "operationId": "request_file_review", + "parameters": [ + { + "in": "path", + "name": "org_id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + }, + "style": "simple" + }, + { + "in": "path", + "name": "repo_id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FileReviewRequest" + } + } + }, + "description": "Whole files selected at one exact pushed commit.", + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FileReviewResponse" + } + } + }, + "description": "What a named-file review request produced." + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunNowRefused" + } + } + }, + "description": "A run-now request that created nothing, as the 400 it is answered with.\n\n The refusal is a configuration fact, not a failure, and it is still sent\n as an RFC 9457 problem: `title`, `status` and `detail` are what a client\n that knows only problems shows, and `repository_name` and `refusal` are\n the extension members a client that knows refusals links from. During a\n rollout a page loaded from the previous bundle keeps working against\n this server, because a refusal was a 400 with a `detail` before too." + }, + "default": { + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + } + } + }, + "description": "An RFC 9457 problem; the HTTP status remains authoritative." + } + }, + "security": [ + { + "bearerAuth": [] + } + ], + "summary": "Review selected whole files", + "x-proofline-token-scope": "reviews:request" + } + }, "/api/v1/organizations/{org_id}/repositories/{repo_id}/patch-reviews": { "post": { - "description": "Reviews a unified diff against a commit GitHub has in the repository, and returns that patch's review when one exists. The review reads only that commit and the patch, and is never posted to a pull request. Requires live GitHub read access; the same patch on the same base always returns the same review.", + "description": "Reviews a unified diff against a commit GitHub has in the repository, and returns that patch's review when one exists. The review reads only that commit and the patch, and is never posted to a pull request. With `verify_finding_ids`, the review also re-verifies those open findings of one pull request against the patch and reports each outcome on the review, without changing the pull request's findings. Requires live GitHub read access; the same patch on the same base, re-verifying the same findings, always returns the same review.", "operationId": "request_patch_review", "parameters": [ { @@ -6824,6 +7580,63 @@ "summary": "Get review routing", "x-proofline-token-scope": "reviews:read" } + }, + "/api/v1/organizations/{org_id}/reviews/{review_id}/stop": { + "post": { + "description": "Stops the holder's own pending or running withheld patch, commit or named-file review. Requires a personal or CLI device token with live GitHub read access to the review's repository. Organization, CI job and MCP OAuth tokens cannot stop reviews. The stopped review retains its findings and exact code identity; requesting the same input returns that stopped review.", + "operationId": "stop_review", + "parameters": [ + { + "in": "path", + "name": "org_id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + }, + "style": "simple" + }, + { + "in": "path", + "name": "review_id", + "required": true, + "schema": { + "format": "uuid", + "type": "string" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StopResponse" + } + } + }, + "description": "What stopping a review recorded." + }, + "default": { + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/Problem" + } + } + }, + "description": "An RFC 9457 problem; the HTTP status remains authoritative." + } + }, + "security": [ + { + "bearerAuth": [] + } + ], + "summary": "Stop your local review", + "x-proofline-token-scope": "reviews:request" + } } } } diff --git a/proofline/__init__.py b/proofline/__init__.py index f78fdf8e..0b6b82ea 100644 --- a/proofline/__init__.py +++ b/proofline/__init__.py @@ -11,6 +11,8 @@ CustomerAssessmentDetail, CustomerFinding, CustomerReviewDetail, + FileReviewRequest, + FileReviewResponse, PatchReviewRequest, PatchReviewResponse, PatchTriggerSource, @@ -22,6 +24,7 @@ RunNowRequest, RunNowResponse, StartSession, + StopResponse, ) from ._transport import VERSION as __version__ from ._transport import ProoflineError @@ -39,6 +42,8 @@ "CustomerAssessmentDetail", "CustomerFinding", "CustomerReviewDetail", + "FileReviewRequest", + "FileReviewResponse", "PatchReviewRequest", "PatchReviewResponse", "PatchTriggerSource", @@ -55,6 +60,7 @@ "RunNowResponse", "SecretStr", "StartSession", + "StopResponse", "__version__", "models", ] diff --git a/proofline/_generated/api/default/request_file_review.py b/proofline/_generated/api/default/request_file_review.py new file mode 100644 index 00000000..eca1ea2a --- /dev/null +++ b/proofline/_generated/api/default/request_file_review.py @@ -0,0 +1,212 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ...client import AuthenticatedClient, Client +from ...models.file_review_request import FileReviewRequest +from ...models.file_review_response import FileReviewResponse +from ...models.problem import Problem +from ...models.run_now_refused import RunNowRefused +from ...types import Response + + +def _get_kwargs( + org_id: UUID, + repo_id: UUID, + *, + body: FileReviewRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/api/v1/organizations/{org_id}/repositories/{repo_id}/file-reviews".format( + org_id=quote(str(org_id), safe=""), + repo_id=quote(str(repo_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> FileReviewResponse | Problem | RunNowRefused: + if response.status_code == 200: + response_200 = FileReviewResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = RunNowRefused.from_dict(response.json()) + + return response_400 + + response_default = Problem.from_dict(response.json()) + + return response_default + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[FileReviewResponse | Problem | RunNowRefused]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + org_id: UUID, + repo_id: UUID, + *, + client: AuthenticatedClient, + body: FileReviewRequest, +) -> Response[FileReviewResponse | Problem | RunNowRefused]: + """Review selected whole files + + Reviews up to twenty exact file paths at one pushed commit. Requires live GitHub read access and + verifies every path at that commit. The retained selection is immutable; a repeat by the same person + returns its review. Results remain in Proofline and are never posted to GitHub. + + Args: + org_id (UUID): + repo_id (UUID): + body (FileReviewRequest): Whole files selected at one exact pushed commit. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[FileReviewResponse | Problem | RunNowRefused] + """ + + kwargs = _get_kwargs( + org_id=org_id, + repo_id=repo_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + org_id: UUID, + repo_id: UUID, + *, + client: AuthenticatedClient, + body: FileReviewRequest, +) -> FileReviewResponse | Problem | RunNowRefused | None: + """Review selected whole files + + Reviews up to twenty exact file paths at one pushed commit. Requires live GitHub read access and + verifies every path at that commit. The retained selection is immutable; a repeat by the same person + returns its review. Results remain in Proofline and are never posted to GitHub. + + Args: + org_id (UUID): + repo_id (UUID): + body (FileReviewRequest): Whole files selected at one exact pushed commit. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + FileReviewResponse | Problem | RunNowRefused + """ + + return sync_detailed( + org_id=org_id, + repo_id=repo_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + org_id: UUID, + repo_id: UUID, + *, + client: AuthenticatedClient, + body: FileReviewRequest, +) -> Response[FileReviewResponse | Problem | RunNowRefused]: + """Review selected whole files + + Reviews up to twenty exact file paths at one pushed commit. Requires live GitHub read access and + verifies every path at that commit. The retained selection is immutable; a repeat by the same person + returns its review. Results remain in Proofline and are never posted to GitHub. + + Args: + org_id (UUID): + repo_id (UUID): + body (FileReviewRequest): Whole files selected at one exact pushed commit. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[FileReviewResponse | Problem | RunNowRefused] + """ + + kwargs = _get_kwargs( + org_id=org_id, + repo_id=repo_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + org_id: UUID, + repo_id: UUID, + *, + client: AuthenticatedClient, + body: FileReviewRequest, +) -> FileReviewResponse | Problem | RunNowRefused | None: + """Review selected whole files + + Reviews up to twenty exact file paths at one pushed commit. Requires live GitHub read access and + verifies every path at that commit. The retained selection is immutable; a repeat by the same person + returns its review. Results remain in Proofline and are never posted to GitHub. + + Args: + org_id (UUID): + repo_id (UUID): + body (FileReviewRequest): Whole files selected at one exact pushed commit. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + FileReviewResponse | Problem | RunNowRefused + """ + + return ( + await asyncio_detailed( + org_id=org_id, + repo_id=repo_id, + client=client, + body=body, + ) + ).parsed diff --git a/proofline/_generated/api/default/request_patch_review.py b/proofline/_generated/api/default/request_patch_review.py index 5b11edab..68f74c94 100644 --- a/proofline/_generated/api/default/request_patch_review.py +++ b/proofline/_generated/api/default/request_patch_review.py @@ -77,8 +77,10 @@ def sync_detailed( Reviews a unified diff against a commit GitHub has in the repository, and returns that patch's review when one exists. The review reads only that commit and the patch, and is never posted to a - pull request. Requires live GitHub read access; the same patch on the same base always returns the - same review. + pull request. With `verify_finding_ids`, the review also re-verifies those open findings of one pull + request against the patch and reports each outcome on the review, without changing the pull + request's findings. Requires live GitHub read access; the same patch on the same base, re-verifying + the same findings, always returns the same review. Args: org_id (UUID): @@ -118,8 +120,10 @@ def sync( Reviews a unified diff against a commit GitHub has in the repository, and returns that patch's review when one exists. The review reads only that commit and the patch, and is never posted to a - pull request. Requires live GitHub read access; the same patch on the same base always returns the - same review. + pull request. With `verify_finding_ids`, the review also re-verifies those open findings of one pull + request against the patch and reports each outcome on the review, without changing the pull + request's findings. Requires live GitHub read access; the same patch on the same base, re-verifying + the same findings, always returns the same review. Args: org_id (UUID): @@ -154,8 +158,10 @@ async def asyncio_detailed( Reviews a unified diff against a commit GitHub has in the repository, and returns that patch's review when one exists. The review reads only that commit and the patch, and is never posted to a - pull request. Requires live GitHub read access; the same patch on the same base always returns the - same review. + pull request. With `verify_finding_ids`, the review also re-verifies those open findings of one pull + request against the patch and reports each outcome on the review, without changing the pull + request's findings. Requires live GitHub read access; the same patch on the same base, re-verifying + the same findings, always returns the same review. Args: org_id (UUID): @@ -193,8 +199,10 @@ async def asyncio( Reviews a unified diff against a commit GitHub has in the repository, and returns that patch's review when one exists. The review reads only that commit and the patch, and is never posted to a - pull request. Requires live GitHub read access; the same patch on the same base always returns the - same review. + pull request. With `verify_finding_ids`, the review also re-verifies those open findings of one pull + request against the patch and reports each outcome on the review, without changing the pull + request's findings. Requires live GitHub read access; the same patch on the same base, re-verifying + the same findings, always returns the same review. Args: org_id (UUID): diff --git a/proofline/_generated/api/default/stop_review.py b/proofline/_generated/api/default/stop_review.py new file mode 100644 index 00000000..6a58ba43 --- /dev/null +++ b/proofline/_generated/api/default/stop_review.py @@ -0,0 +1,188 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ...client import AuthenticatedClient, Client +from ...models.problem import Problem +from ...models.stop_response import StopResponse +from ...types import Response + + +def _get_kwargs( + org_id: UUID, + review_id: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/api/v1/organizations/{org_id}/reviews/{review_id}/stop".format( + org_id=quote(str(org_id), safe=""), + review_id=quote(str(review_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Problem | StopResponse: + if response.status_code == 200: + response_200 = StopResponse.from_dict(response.json()) + + return response_200 + + response_default = Problem.from_dict(response.json()) + + return response_default + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Problem | StopResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + org_id: UUID, + review_id: UUID, + *, + client: AuthenticatedClient, +) -> Response[Problem | StopResponse]: + """Stop your local review + + Stops the holder's own pending or running withheld patch, commit or named-file review. Requires a + personal or CLI device token with live GitHub read access to the review's repository. Organization, + CI job and MCP OAuth tokens cannot stop reviews. The stopped review retains its findings and exact + code identity; requesting the same input returns that stopped review. + + Args: + org_id (UUID): + review_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Problem | StopResponse] + """ + + kwargs = _get_kwargs( + org_id=org_id, + review_id=review_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + org_id: UUID, + review_id: UUID, + *, + client: AuthenticatedClient, +) -> Problem | StopResponse | None: + """Stop your local review + + Stops the holder's own pending or running withheld patch, commit or named-file review. Requires a + personal or CLI device token with live GitHub read access to the review's repository. Organization, + CI job and MCP OAuth tokens cannot stop reviews. The stopped review retains its findings and exact + code identity; requesting the same input returns that stopped review. + + Args: + org_id (UUID): + review_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Problem | StopResponse + """ + + return sync_detailed( + org_id=org_id, + review_id=review_id, + client=client, + ).parsed + + +async def asyncio_detailed( + org_id: UUID, + review_id: UUID, + *, + client: AuthenticatedClient, +) -> Response[Problem | StopResponse]: + """Stop your local review + + Stops the holder's own pending or running withheld patch, commit or named-file review. Requires a + personal or CLI device token with live GitHub read access to the review's repository. Organization, + CI job and MCP OAuth tokens cannot stop reviews. The stopped review retains its findings and exact + code identity; requesting the same input returns that stopped review. + + Args: + org_id (UUID): + review_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Problem | StopResponse] + """ + + kwargs = _get_kwargs( + org_id=org_id, + review_id=review_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + org_id: UUID, + review_id: UUID, + *, + client: AuthenticatedClient, +) -> Problem | StopResponse | None: + """Stop your local review + + Stops the holder's own pending or running withheld patch, commit or named-file review. Requires a + personal or CLI device token with live GitHub read access to the review's repository. Organization, + CI job and MCP OAuth tokens cannot stop reviews. The stopped review retains its findings and exact + code identity; requesting the same input returns that stopped review. + + Args: + org_id (UUID): + review_id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Problem | StopResponse + """ + + return ( + await asyncio_detailed( + org_id=org_id, + review_id=review_id, + client=client, + ) + ).parsed diff --git a/proofline/_generated/models/__init__.py b/proofline/_generated/models/__init__.py index 10b7fefc..1de5de78 100644 --- a/proofline/_generated/models/__init__.py +++ b/proofline/_generated/models/__init__.py @@ -7,6 +7,7 @@ from .agent_session_prompt_type_1 import AgentSessionPromptType1 from .agent_session_target import AgentSessionTarget from .agent_vendor import AgentVendor +from .approval_gap import ApprovalGap from .assessment_projection import AssessmentProjection from .attributed_condition_view import AttributedConditionView from .author_choice import AuthorChoice @@ -14,6 +15,9 @@ from .availability_type_0 import AvailabilityType0 from .change_attribution_view import ChangeAttributionView from .change_count_view import ChangeCountView +from .change_diagram_kind_view import ChangeDiagramKindView +from .change_diagram_outcome_type_0 import ChangeDiagramOutcomeType0 +from .change_diagram_view import ChangeDiagramView from .code_assessment_status_type_0 import CodeAssessmentStatusType0 from .comment_address_evaluation_view import CommentAddressEvaluationView from .comment_address_outcome import CommentAddressOutcome @@ -34,6 +38,8 @@ from .customer_finding_validation import CustomerFindingValidation from .customer_review_detail import CustomerReviewDetail from .dataset import Dataset +from .declared_reach_outcome import DeclaredReachOutcome +from .declared_reach_view import DeclaredReachView from .deep_review_escalation import DeepReviewEscalation from .deep_review_escalation_status import DeepReviewEscalationStatus from .domain_view import DomainView @@ -47,6 +53,9 @@ from .export_validation import ExportValidation from .export_validation_source import ExportValidationSource from .file_projection import FileProjection +from .file_review_request import FileReviewRequest +from .file_review_response import FileReviewResponse +from .file_scope import FileScope from .filter_choice import FilterChoice from .finding_causal_edge_view import FindingCausalEdgeView from .finding_causal_graph_view import FindingCausalGraphView @@ -74,7 +83,11 @@ from .findings_export_row import FindingsExportRow from .gate_state import GateState from .gate_status import GateStatus +from .local_reverification import LocalReverification +from .local_reverification_outcome import LocalReverificationOutcome from .not_assessed_view import NotAssessedView +from .occurrence_capture import OccurrenceCapture +from .occurrence_question import OccurrenceQuestion from .open_finding_counts import OpenFindingCounts from .open_item_environment import OpenItemEnvironment from .open_items_gap_reason import OpenItemsGapReason @@ -90,10 +103,15 @@ from .patch_review_request import PatchReviewRequest from .patch_review_response import PatchReviewResponse from .patch_trigger_source import PatchTriggerSource +from .patch_verification import PatchVerification from .permission_view import PermissionView from .plan_projection import PlanProjection from .problem import Problem from .pull_request_merge_gate import PullRequestMergeGate +from .reach_gap_view import ReachGapView +from .reach_step_view import ReachStepView +from .reached_entity_view import ReachedEntityView +from .refresh_view import RefreshView from .refused_environment import RefusedEnvironment from .related_review import RelatedReview from .repository_guidance import RepositoryGuidance @@ -136,6 +154,7 @@ from .spend_account_kind import SpendAccountKind from .spend_export_row import SpendExportRow from .start_session import StartSession +from .stop_response import StopResponse from .subject_authorization import SubjectAuthorization from .subject_view import SubjectView from .thread_observation_freshness import ThreadObservationFreshness @@ -152,6 +171,7 @@ "AgentSessionPromptType1", "AgentSessionTarget", "AgentVendor", + "ApprovalGap", "AssessmentProjection", "AttributedConditionView", "AuthorChoice", @@ -159,6 +179,9 @@ "AvailabilityType0", "ChangeAttributionView", "ChangeCountView", + "ChangeDiagramKindView", + "ChangeDiagramOutcomeType0", + "ChangeDiagramView", "CodeAssessmentStatusType0", "CommentAddressEvaluationView", "CommentAddressOutcome", @@ -179,6 +202,8 @@ "CustomerFindingValidation", "CustomerReviewDetail", "Dataset", + "DeclaredReachOutcome", + "DeclaredReachView", "DeepReviewEscalation", "DeepReviewEscalationStatus", "DomainView", @@ -192,6 +217,9 @@ "ExportValidation", "ExportValidationSource", "FileProjection", + "FileReviewRequest", + "FileReviewResponse", + "FileScope", "FilterChoice", "FindingCausalEdgeView", "FindingCausalGraphView", @@ -219,7 +247,11 @@ "FindingValidationsExportRow", "GateState", "GateStatus", + "LocalReverification", + "LocalReverificationOutcome", "NotAssessedView", + "OccurrenceCapture", + "OccurrenceQuestion", "OpenFindingCounts", "OpenItemEnvironment", "OpenItemsGapReason", @@ -235,10 +267,15 @@ "PatchReviewRequest", "PatchReviewResponse", "PatchTriggerSource", + "PatchVerification", "PermissionView", "PlanProjection", "Problem", "PullRequestMergeGate", + "ReachedEntityView", + "ReachGapView", + "ReachStepView", + "RefreshView", "RefusedEnvironment", "RelatedReview", "RepositoryGuidance", @@ -281,6 +318,7 @@ "SpendAccountKind", "SpendExportRow", "StartSession", + "StopResponse", "SubjectAuthorization", "SubjectView", "ThreadObservationFreshness", diff --git a/proofline/_generated/models/approval_gap.py b/proofline/_generated/models/approval_gap.py new file mode 100644 index 00000000..b1d80b0d --- /dev/null +++ b/proofline/_generated/models/approval_gap.py @@ -0,0 +1,70 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ApprovalGap") + + +@_attrs_define +class ApprovalGap: + """ + Attributes: + assessment_id (UUID): Assessment whose approval could not supply deferred occurrence questions. + code (str): Reason the assessment's approval could not supply deferred occurrence questions. + """ + + assessment_id: UUID + code: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + assessment_id = str(self.assessment_id) + + code = self.code + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "assessment_id": assessment_id, + "code": code, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + assessment_id = UUID(d.pop("assessment_id")) + + code = d.pop("code") + + approval_gap = cls( + assessment_id=assessment_id, + code=code, + ) + + approval_gap.additional_properties = d + return approval_gap + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/change_diagram_kind_view.py b/proofline/_generated/models/change_diagram_kind_view.py new file mode 100644 index 00000000..b2dee958 --- /dev/null +++ b/proofline/_generated/models/change_diagram_kind_view.py @@ -0,0 +1,9 @@ +from enum import StrEnum + + +class ChangeDiagramKindView(StrEnum): + FLOWCHART = "FLOWCHART" + SEQUENCE = "SEQUENCE" + + def __str__(self) -> str: + return str(self.value) diff --git a/proofline/_generated/models/change_diagram_outcome_type_0.py b/proofline/_generated/models/change_diagram_outcome_type_0.py new file mode 100644 index 00000000..dee16069 --- /dev/null +++ b/proofline/_generated/models/change_diagram_outcome_type_0.py @@ -0,0 +1,8 @@ +from enum import StrEnum + + +class ChangeDiagramOutcomeType0(StrEnum): + DRAWN = "DRAWN" + + def __str__(self) -> str: + return str(self.value) diff --git a/proofline/_generated/models/change_diagram_view.py b/proofline/_generated/models/change_diagram_view.py new file mode 100644 index 00000000..26f3c02b --- /dev/null +++ b/proofline/_generated/models/change_diagram_view.py @@ -0,0 +1,209 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, Literal, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.change_diagram_kind_view import ChangeDiagramKindView +from ..models.change_diagram_outcome_type_0 import ChangeDiagramOutcomeType0 +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ChangeDiagramView") + + +@_attrs_define +class ChangeDiagramView: + """The change-level diagram recorded for a review, or why there is none. + + Attributes: + legend (list[str]): Markdown lines under the diagram: which environment and snapshot its + dashed relations come from, or which environment was not read. + outcome (ChangeDiagramOutcomeType0 | Literal['DECISION_UNAVAILABLE'] | Literal['INDEX_INCOMPLETE'] | + Literal['NO_INTERACTION'] | Literal['OVER_CAPS']): + kind (ChangeDiagramKindView | None | Unset): Diagram format when a diagram was drawn; otherwise null. + mermaid (None | str | Unset): Mermaid source the server generated from the stored graph. Every + label is escaped, and no model wrote any of it. Absent unless + `outcome` is `DRAWN`. + """ + + legend: list[str] + outcome: ( + ChangeDiagramOutcomeType0 + | Literal["DECISION_UNAVAILABLE"] + | Literal["INDEX_INCOMPLETE"] + | Literal["NO_INTERACTION"] + | Literal["OVER_CAPS"] + ) + kind: ChangeDiagramKindView | None | Unset = UNSET + mermaid: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + legend = self.legend + + outcome: ( + Literal["DECISION_UNAVAILABLE"] + | Literal["INDEX_INCOMPLETE"] + | Literal["NO_INTERACTION"] + | Literal["OVER_CAPS"] + | str + ) + if isinstance(self.outcome, ChangeDiagramOutcomeType0): + outcome = self.outcome.value + else: + outcome = self.outcome + + kind: None | str | Unset + if isinstance(self.kind, Unset): + kind = UNSET + elif isinstance(self.kind, ChangeDiagramKindView): + kind = self.kind.value + else: + kind = self.kind + + mermaid: None | str | Unset + if isinstance(self.mermaid, Unset): + mermaid = UNSET + else: + mermaid = self.mermaid + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "legend": legend, + "outcome": outcome, + } + ) + if kind is not UNSET: + field_dict["kind"] = kind + if mermaid is not UNSET: + field_dict["mermaid"] = mermaid + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + legend = cast(list[str], d.pop("legend")) + + def _parse_outcome( + data: object, + ) -> ( + ChangeDiagramOutcomeType0 + | Literal["DECISION_UNAVAILABLE"] + | Literal["INDEX_INCOMPLETE"] + | Literal["NO_INTERACTION"] + | Literal["OVER_CAPS"] + ): + try: + if not isinstance(data, str): + raise TypeError() + componentsschemas_change_diagram_outcome_type_0 = ChangeDiagramOutcomeType0(data) + + return componentsschemas_change_diagram_outcome_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + try: + if not (type(data) is str and data == "NO_INTERACTION"): + raise TypeError() + componentsschemas_change_diagram_outcome_type_1 = cast( + Literal["NO_INTERACTION"], data + ) + if componentsschemas_change_diagram_outcome_type_1 != "NO_INTERACTION": + raise ValueError( + f"/components/schemas/ChangeDiagramOutcome_type_1 must match const 'NO_INTERACTION', got '{componentsschemas_change_diagram_outcome_type_1}'" + ) + return componentsschemas_change_diagram_outcome_type_1 + except (TypeError, ValueError, AttributeError, KeyError): + pass + try: + if not (type(data) is str and data == "INDEX_INCOMPLETE"): + raise TypeError() + componentsschemas_change_diagram_outcome_type_2 = cast( + Literal["INDEX_INCOMPLETE"], data + ) + if componentsschemas_change_diagram_outcome_type_2 != "INDEX_INCOMPLETE": + raise ValueError( + f"/components/schemas/ChangeDiagramOutcome_type_2 must match const 'INDEX_INCOMPLETE', got '{componentsschemas_change_diagram_outcome_type_2}'" + ) + return componentsschemas_change_diagram_outcome_type_2 + except (TypeError, ValueError, AttributeError, KeyError): + pass + try: + if not (type(data) is str and data == "OVER_CAPS"): + raise TypeError() + componentsschemas_change_diagram_outcome_type_3 = cast(Literal["OVER_CAPS"], data) + if componentsschemas_change_diagram_outcome_type_3 != "OVER_CAPS": + raise ValueError( + f"/components/schemas/ChangeDiagramOutcome_type_3 must match const 'OVER_CAPS', got '{componentsschemas_change_diagram_outcome_type_3}'" + ) + return componentsschemas_change_diagram_outcome_type_3 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not (type(data) is str and data == "DECISION_UNAVAILABLE"): + raise TypeError() + componentsschemas_change_diagram_outcome_type_4 = cast( + Literal["DECISION_UNAVAILABLE"], data + ) + if componentsschemas_change_diagram_outcome_type_4 != "DECISION_UNAVAILABLE": + raise ValueError( + f"/components/schemas/ChangeDiagramOutcome_type_4 must match const 'DECISION_UNAVAILABLE', got '{componentsschemas_change_diagram_outcome_type_4}'" + ) + return componentsschemas_change_diagram_outcome_type_4 + + outcome = _parse_outcome(d.pop("outcome")) + + def _parse_kind(data: object) -> ChangeDiagramKindView | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + kind_type_0 = ChangeDiagramKindView(data) + + return kind_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(ChangeDiagramKindView | None | Unset, data) + + kind = _parse_kind(d.pop("kind", UNSET)) + + def _parse_mermaid(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + mermaid = _parse_mermaid(d.pop("mermaid", UNSET)) + + change_diagram_view = cls( + legend=legend, + outcome=outcome, + kind=kind, + mermaid=mermaid, + ) + + change_diagram_view.additional_properties = d + return change_diagram_view + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/customer_assessment.py b/proofline/_generated/models/customer_assessment.py index 64940767..d4def2cd 100644 --- a/proofline/_generated/models/customer_assessment.py +++ b/proofline/_generated/models/customer_assessment.py @@ -14,6 +14,7 @@ from ..models.customer_checks import CustomerChecks from ..models.customer_decision import CustomerDecision from ..models.customer_finding import CustomerFinding + from ..models.declared_reach_view import DeclaredReachView from ..models.domain_view import DomainView @@ -37,6 +38,10 @@ class CustomerAssessment: deployment authorization. Absent when none is recorded and the review kind records no decision basis. + declared_reach (DeclaredReachView | None | Unset): What World declares depends on what this change deploys in + this + environment, at the assessment's pinned snapshot. Absent when the + assessment's kind records no declared reach. incompleteness_kind (None | str | Unset): Why an `INCOMPLETE` assessment is incomplete: `NOT_CONFIGURED`, `POLICY_EXCLUDED`, `EVIDENCE_UNAVAILABLE`, `HYPOTHESES_UNRESOLVED` or `MODEL_BUDGET_EXHAUSTED`. Absent otherwise; an unclassified gap is not a @@ -57,6 +62,7 @@ class CustomerAssessment: status: str completed_at: datetime.datetime | None | Unset = UNSET decision_presentation: CustomerDecision | None | Unset = UNSET + declared_reach: DeclaredReachView | None | Unset = UNSET incompleteness_kind: None | str | Unset = UNSET reason_codes: list[str] | None | Unset = UNSET release_evidence_gap: None | str | Unset = UNSET @@ -65,6 +71,7 @@ class CustomerAssessment: def to_dict(self) -> dict[str, Any]: from ..models.customer_decision import CustomerDecision # noqa: PLC0415 + from ..models.declared_reach_view import DeclaredReachView # noqa: PLC0415 checks = self.checks.to_dict() @@ -100,6 +107,14 @@ def to_dict(self) -> dict[str, Any]: else: decision_presentation = self.decision_presentation + declared_reach: dict[str, Any] | None | Unset + if isinstance(self.declared_reach, Unset): + declared_reach = UNSET + elif isinstance(self.declared_reach, DeclaredReachView): + declared_reach = self.declared_reach.to_dict() + else: + declared_reach = self.declared_reach + incompleteness_kind: None | str | Unset if isinstance(self.incompleteness_kind, Unset): incompleteness_kind = UNSET @@ -145,6 +160,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["completed_at"] = completed_at if decision_presentation is not UNSET: field_dict["decision_presentation"] = decision_presentation + if declared_reach is not UNSET: + field_dict["declared_reach"] = declared_reach if incompleteness_kind is not UNSET: field_dict["incompleteness_kind"] = incompleteness_kind if reason_codes is not UNSET: @@ -161,6 +178,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.customer_checks import CustomerChecks # noqa: PLC0415 from ..models.customer_decision import CustomerDecision # noqa: PLC0415 from ..models.customer_finding import CustomerFinding # noqa: PLC0415 + from ..models.declared_reach_view import DeclaredReachView # noqa: PLC0415 from ..models.domain_view import DomainView # noqa: PLC0415 d = dict(src_dict) @@ -220,6 +238,23 @@ def _parse_decision_presentation(data: object) -> CustomerDecision | None | Unse decision_presentation = _parse_decision_presentation(d.pop("decision_presentation", UNSET)) + def _parse_declared_reach(data: object) -> DeclaredReachView | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + declared_reach_type_0 = DeclaredReachView.from_dict(data) + + return declared_reach_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(DeclaredReachView | None | Unset, data) + + declared_reach = _parse_declared_reach(d.pop("declared_reach", UNSET)) + def _parse_incompleteness_kind(data: object) -> None | str | Unset: if data is None: return data @@ -281,6 +316,7 @@ def _parse_started_at(data: object) -> datetime.datetime | None | Unset: status=status, completed_at=completed_at, decision_presentation=decision_presentation, + declared_reach=declared_reach, incompleteness_kind=incompleteness_kind, reason_codes=reason_codes, release_evidence_gap=release_evidence_gap, diff --git a/proofline/_generated/models/customer_assessment_detail.py b/proofline/_generated/models/customer_assessment_detail.py index 3773f5f7..c8c32bdf 100644 --- a/proofline/_generated/models/customer_assessment_detail.py +++ b/proofline/_generated/models/customer_assessment_detail.py @@ -14,6 +14,7 @@ from ..models.customer_checks import CustomerChecks from ..models.customer_decision import CustomerDecision from ..models.customer_finding import CustomerFinding + from ..models.declared_reach_view import DeclaredReachView from ..models.domain_view import DomainView from ..models.subject_view import SubjectView @@ -41,6 +42,10 @@ class CustomerAssessmentDetail: deployment authorization. Absent when none is recorded and the review kind records no decision basis. + declared_reach (DeclaredReachView | None | Unset): What World declares depends on what this change deploys in + this + environment, at the assessment's pinned snapshot. Absent when the + assessment's kind records no declared reach. incompleteness_kind (None | str | Unset): Why an `INCOMPLETE` assessment is incomplete: `NOT_CONFIGURED`, `POLICY_EXCLUDED`, `EVIDENCE_UNAVAILABLE`, `HYPOTHESES_UNRESOLVED` or `MODEL_BUDGET_EXHAUSTED`. Absent otherwise; an unclassified gap is not a @@ -63,6 +68,7 @@ class CustomerAssessmentDetail: subjects: list[SubjectView] completed_at: datetime.datetime | None | Unset = UNSET decision_presentation: CustomerDecision | None | Unset = UNSET + declared_reach: DeclaredReachView | None | Unset = UNSET incompleteness_kind: None | str | Unset = UNSET reason_codes: list[str] | None | Unset = UNSET release_evidence_gap: None | str | Unset = UNSET @@ -71,6 +77,7 @@ class CustomerAssessmentDetail: def to_dict(self) -> dict[str, Any]: from ..models.customer_decision import CustomerDecision # noqa: PLC0415 + from ..models.declared_reach_view import DeclaredReachView # noqa: PLC0415 checks = self.checks.to_dict() @@ -113,6 +120,14 @@ def to_dict(self) -> dict[str, Any]: else: decision_presentation = self.decision_presentation + declared_reach: dict[str, Any] | None | Unset + if isinstance(self.declared_reach, Unset): + declared_reach = UNSET + elif isinstance(self.declared_reach, DeclaredReachView): + declared_reach = self.declared_reach.to_dict() + else: + declared_reach = self.declared_reach + incompleteness_kind: None | str | Unset if isinstance(self.incompleteness_kind, Unset): incompleteness_kind = UNSET @@ -160,6 +175,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["completed_at"] = completed_at if decision_presentation is not UNSET: field_dict["decision_presentation"] = decision_presentation + if declared_reach is not UNSET: + field_dict["declared_reach"] = declared_reach if incompleteness_kind is not UNSET: field_dict["incompleteness_kind"] = incompleteness_kind if reason_codes is not UNSET: @@ -176,6 +193,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.customer_checks import CustomerChecks # noqa: PLC0415 from ..models.customer_decision import CustomerDecision # noqa: PLC0415 from ..models.customer_finding import CustomerFinding # noqa: PLC0415 + from ..models.declared_reach_view import DeclaredReachView # noqa: PLC0415 from ..models.domain_view import DomainView # noqa: PLC0415 from ..models.subject_view import SubjectView # noqa: PLC0415 @@ -245,6 +263,23 @@ def _parse_decision_presentation(data: object) -> CustomerDecision | None | Unse decision_presentation = _parse_decision_presentation(d.pop("decision_presentation", UNSET)) + def _parse_declared_reach(data: object) -> DeclaredReachView | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + declared_reach_type_0 = DeclaredReachView.from_dict(data) + + return declared_reach_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(DeclaredReachView | None | Unset, data) + + declared_reach = _parse_declared_reach(d.pop("declared_reach", UNSET)) + def _parse_incompleteness_kind(data: object) -> None | str | Unset: if data is None: return data @@ -308,6 +343,7 @@ def _parse_started_at(data: object) -> datetime.datetime | None | Unset: subjects=subjects, completed_at=completed_at, decision_presentation=decision_presentation, + declared_reach=declared_reach, incompleteness_kind=incompleteness_kind, reason_codes=reason_codes, release_evidence_gap=release_evidence_gap, diff --git a/proofline/_generated/models/customer_review_detail.py b/proofline/_generated/models/customer_review_detail.py index 6a47549e..529dd201 100644 --- a/proofline/_generated/models/customer_review_detail.py +++ b/proofline/_generated/models/customer_review_detail.py @@ -13,11 +13,14 @@ if TYPE_CHECKING: from ..models.actor_view import ActorView + from ..models.change_diagram_view import ChangeDiagramView from ..models.customer_assessment import CustomerAssessment from ..models.customer_code_assessment import CustomerCodeAssessment from ..models.deep_review_escalation import DeepReviewEscalation + from ..models.local_reverification import LocalReverification from ..models.open_items_view import OpenItemsView from ..models.pull_request_merge_gate import PullRequestMergeGate + from ..models.refresh_view import RefreshView from ..models.related_review import RelatedReview from ..models.review_actions import ReviewActions from ..models.review_diff_stats import ReviewDiffStats @@ -41,7 +44,8 @@ class CustomerReviewDetail: finding_count (int): How many findings this review's assessments recorded, across all of them. id (UUID): The review's identifier. kind (str): `PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, a review of local changes - sent as a patch, or `COMMIT`, a review of pushed commits. + sent as a patch, `COMMIT`, a review of pushed commits, or `FILES`, + complete selected files at one pushed commit. public_key (str): The review's stable public address: `rev_` followed by its identifier without hyphens. publication (str): Whether the review reached the pull request: `PUBLISHED`, `WITHHELD`, `PUBLICATION_REQUESTED` or `PUBLICATION_REFUSED`. A review run from @@ -67,6 +71,10 @@ class CustomerReviewDetail: repository is unknown. base_ref (None | str | Unset): The pull request's base branch name as last recorded from GitHub, for orientation only. Null when no pull request state is recorded. + change_diagram (ChangeDiagramView | None | Unset): The change-level diagram: the changed call path from the + pinned code + index and the relations World declares. Absent when the review + recorded none. check_run_url (None | str | Unset): The GitHub check run Proofline published for this review. Null when none was published. code_assessment (CustomerCodeAssessment | None | Unset): The code assessment this review recorded, apart from @@ -94,6 +102,11 @@ class CustomerReviewDetail: branch moves, the reviewed input does not. Absent for a patch review. head_ref (None | str | Unset): The pull request's head branch name as last recorded from GitHub, for orientation only. Null when no pull request state is recorded. + local_reverifications (list[LocalReverification] | Unset): For a patch review requested with + `verify_finding_ids`, each finding + it re-verifies against the patch and the outcome. The outcome is + local: the pull request's finding is unchanged whatever it is. Absent + otherwise. merge_gate (None | PullRequestMergeGate | Unset): The deterministic policy for this exact repository/head, when opted in. Its captured review owner and GitHub bypass remain separate history. @@ -122,6 +135,9 @@ class CustomerReviewDetail: renderers must treat it as text, never markup. pull_request_url (None | str | Unset): The pull request on GitHub. Absent for a deployment review or when the repository is unknown. + refresh (None | RefreshView | Unset): How this review decided what it reviews after a push or a full-review + request. Absent for a review that refreshes nothing, and while a + refresh has not decided yet. repository_full_name (None | str | Unset): The repository's `owner/name`. Absent when the review names no repository. repository_id (None | Unset | UUID): The review's repository. Set only on a single-review read, and absent there @@ -171,6 +187,7 @@ class CustomerReviewDetail: base_commit_sha: None | str | Unset = UNSET base_commit_url: None | str | Unset = UNSET base_ref: None | str | Unset = UNSET + change_diagram: ChangeDiagramView | None | Unset = UNSET check_run_url: None | str | Unset = UNSET code_assessment: CustomerCodeAssessment | None | Unset = UNSET compare_url: None | str | Unset = UNSET @@ -181,6 +198,7 @@ class CustomerReviewDetail: head_commit_sha: None | str | Unset = UNSET head_commit_url: None | str | Unset = UNSET head_ref: None | str | Unset = UNSET + local_reverifications: list[LocalReverification] | Unset = UNSET merge_gate: None | PullRequestMergeGate | Unset = UNSET open_items: None | OpenItemsView | Unset = UNSET open_items_observation: None | ReviewOpenItems | Unset = UNSET @@ -193,6 +211,7 @@ class CustomerReviewDetail: pull_request_state: None | str | Unset = UNSET pull_request_title: None | str | Unset = UNSET pull_request_url: None | str | Unset = UNSET + refresh: None | RefreshView | Unset = UNSET repository_full_name: None | str | Unset = UNSET repository_id: None | Unset | UUID = UNSET repository_name: None | str | Unset = UNSET @@ -210,10 +229,12 @@ class CustomerReviewDetail: def to_dict(self) -> dict[str, Any]: from ..models.actor_view import ActorView # noqa: PLC0415 + from ..models.change_diagram_view import ChangeDiagramView # noqa: PLC0415 from ..models.customer_code_assessment import CustomerCodeAssessment # noqa: PLC0415 from ..models.deep_review_escalation import DeepReviewEscalation # noqa: PLC0415 from ..models.open_items_view import OpenItemsView # noqa: PLC0415 from ..models.pull_request_merge_gate import PullRequestMergeGate # noqa: PLC0415 + from ..models.refresh_view import RefreshView # noqa: PLC0415 from ..models.review_diff_stats import ReviewDiffStats # noqa: PLC0415 from ..models.review_open_items import ReviewOpenItems # noqa: PLC0415 @@ -280,6 +301,14 @@ def to_dict(self) -> dict[str, Any]: else: base_ref = self.base_ref + change_diagram: dict[str, Any] | None | Unset + if isinstance(self.change_diagram, Unset): + change_diagram = UNSET + elif isinstance(self.change_diagram, ChangeDiagramView): + change_diagram = self.change_diagram.to_dict() + else: + change_diagram = self.change_diagram + check_run_url: None | str | Unset if isinstance(self.check_run_url, Unset): check_run_url = UNSET @@ -348,6 +377,13 @@ def to_dict(self) -> dict[str, Any]: else: head_ref = self.head_ref + local_reverifications: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.local_reverifications, Unset): + local_reverifications = [] + for local_reverifications_item_data in self.local_reverifications: + local_reverifications_item = local_reverifications_item_data.to_dict() + local_reverifications.append(local_reverifications_item) + merge_gate: dict[str, Any] | None | Unset if isinstance(self.merge_gate, Unset): merge_gate = UNSET @@ -426,6 +462,14 @@ def to_dict(self) -> dict[str, Any]: else: pull_request_url = self.pull_request_url + refresh: dict[str, Any] | None | Unset + if isinstance(self.refresh, Unset): + refresh = UNSET + elif isinstance(self.refresh, RefreshView): + refresh = self.refresh.to_dict() + else: + refresh = self.refresh + repository_full_name: None | str | Unset if isinstance(self.repository_full_name, Unset): repository_full_name = UNSET @@ -547,6 +591,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["base_commit_url"] = base_commit_url if base_ref is not UNSET: field_dict["base_ref"] = base_ref + if change_diagram is not UNSET: + field_dict["change_diagram"] = change_diagram if check_run_url is not UNSET: field_dict["check_run_url"] = check_run_url if code_assessment is not UNSET: @@ -567,6 +613,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["head_commit_url"] = head_commit_url if head_ref is not UNSET: field_dict["head_ref"] = head_ref + if local_reverifications is not UNSET: + field_dict["local_reverifications"] = local_reverifications if merge_gate is not UNSET: field_dict["merge_gate"] = merge_gate if open_items is not UNSET: @@ -591,6 +639,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["pull_request_title"] = pull_request_title if pull_request_url is not UNSET: field_dict["pull_request_url"] = pull_request_url + if refresh is not UNSET: + field_dict["refresh"] = refresh if repository_full_name is not UNSET: field_dict["repository_full_name"] = repository_full_name if repository_id is not UNSET: @@ -623,11 +673,14 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.actor_view import ActorView # noqa: PLC0415 + from ..models.change_diagram_view import ChangeDiagramView # noqa: PLC0415 from ..models.customer_assessment import CustomerAssessment # noqa: PLC0415 from ..models.customer_code_assessment import CustomerCodeAssessment # noqa: PLC0415 from ..models.deep_review_escalation import DeepReviewEscalation # noqa: PLC0415 + from ..models.local_reverification import LocalReverification # noqa: PLC0415 from ..models.open_items_view import OpenItemsView # noqa: PLC0415 from ..models.pull_request_merge_gate import PullRequestMergeGate # noqa: PLC0415 + from ..models.refresh_view import RefreshView # noqa: PLC0415 from ..models.related_review import RelatedReview # noqa: PLC0415 from ..models.review_actions import ReviewActions # noqa: PLC0415 from ..models.review_diff_stats import ReviewDiffStats # noqa: PLC0415 @@ -718,6 +771,23 @@ def _parse_base_ref(data: object) -> None | str | Unset: base_ref = _parse_base_ref(d.pop("base_ref", UNSET)) + def _parse_change_diagram(data: object) -> ChangeDiagramView | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + change_diagram_type_0 = ChangeDiagramView.from_dict(data) + + return change_diagram_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(ChangeDiagramView | None | Unset, data) + + change_diagram = _parse_change_diagram(d.pop("change_diagram", UNSET)) + def _parse_check_run_url(data: object) -> None | str | Unset: if data is None: return data @@ -844,6 +914,17 @@ def _parse_head_ref(data: object) -> None | str | Unset: head_ref = _parse_head_ref(d.pop("head_ref", UNSET)) + _local_reverifications = d.pop("local_reverifications", UNSET) + local_reverifications: list[LocalReverification] | Unset = UNSET + if _local_reverifications is not UNSET: + local_reverifications = [] + for local_reverifications_item_data in _local_reverifications: + local_reverifications_item = LocalReverification.from_dict( + local_reverifications_item_data + ) + + local_reverifications.append(local_reverifications_item) + def _parse_merge_gate(data: object) -> None | PullRequestMergeGate | Unset: if data is None: return data @@ -986,6 +1067,23 @@ def _parse_pull_request_url(data: object) -> None | str | Unset: pull_request_url = _parse_pull_request_url(d.pop("pull_request_url", UNSET)) + def _parse_refresh(data: object) -> None | RefreshView | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + refresh_type_0 = RefreshView.from_dict(data) + + return refresh_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | RefreshView | Unset, data) + + refresh = _parse_refresh(d.pop("refresh", UNSET)) + def _parse_repository_full_name(data: object) -> None | str | Unset: if data is None: return data @@ -1181,6 +1279,7 @@ def _parse_trigger_source(data: object) -> None | PatchTriggerSource | Unset: base_commit_sha=base_commit_sha, base_commit_url=base_commit_url, base_ref=base_ref, + change_diagram=change_diagram, check_run_url=check_run_url, code_assessment=code_assessment, compare_url=compare_url, @@ -1191,6 +1290,7 @@ def _parse_trigger_source(data: object) -> None | PatchTriggerSource | Unset: head_commit_sha=head_commit_sha, head_commit_url=head_commit_url, head_ref=head_ref, + local_reverifications=local_reverifications, merge_gate=merge_gate, open_items=open_items, open_items_observation=open_items_observation, @@ -1203,6 +1303,7 @@ def _parse_trigger_source(data: object) -> None | PatchTriggerSource | Unset: pull_request_state=pull_request_state, pull_request_title=pull_request_title, pull_request_url=pull_request_url, + refresh=refresh, repository_full_name=repository_full_name, repository_id=repository_id, repository_name=repository_name, diff --git a/proofline/_generated/models/declared_reach_outcome.py b/proofline/_generated/models/declared_reach_outcome.py new file mode 100644 index 00000000..1279c6ef --- /dev/null +++ b/proofline/_generated/models/declared_reach_outcome.py @@ -0,0 +1,11 @@ +from enum import StrEnum + + +class DeclaredReachOutcome(StrEnum): + NO_ROOTS = "NO_ROOTS" + READ = "READ" + ROOTS_UNKNOWN = "ROOTS_UNKNOWN" + UNAVAILABLE = "UNAVAILABLE" + + def __str__(self) -> str: + return str(self.value) diff --git a/proofline/_generated/models/declared_reach_view.py b/proofline/_generated/models/declared_reach_view.py new file mode 100644 index 00000000..99bb308e --- /dev/null +++ b/proofline/_generated/models/declared_reach_view.py @@ -0,0 +1,167 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.declared_reach_outcome import DeclaredReachOutcome +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.reach_gap_view import ReachGapView + from ..models.reached_entity_view import ReachedEntityView + + +T = TypeVar("T", bound="DeclaredReachView") + + +@_attrs_define +class DeclaredReachView: + """One assessment's declared reach receipt. A reached entity declares a + dependency on what the change deploys; it is never a claim that the change + breaks it. + + Attributes: + complete (bool): Whether World's walk ended with no gap. An empty, incomplete reach + says nothing about what depends on the change. + entities (list[ReachedEntityView]): Every reached entity, shorter paths first, then by kind. + gaps (list[ReachGapView]): Where World's walk or its evidence stopped. + outcome (DeclaredReachOutcome): + receipt_digest (None | str | Unset): World's digest of its full answer. Null unless `READ`. + snapshot_id (None | Unset | UUID): The World snapshot the reach was read at. Null unless `READ`. + """ + + complete: bool + entities: list[ReachedEntityView] + gaps: list[ReachGapView] + outcome: DeclaredReachOutcome + receipt_digest: None | str | Unset = UNSET + snapshot_id: None | Unset | UUID = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + complete = self.complete + + entities = [] + for entities_item_data in self.entities: + entities_item = entities_item_data.to_dict() + entities.append(entities_item) + + gaps = [] + for gaps_item_data in self.gaps: + gaps_item = gaps_item_data.to_dict() + gaps.append(gaps_item) + + outcome = self.outcome.value + + receipt_digest: None | str | Unset + if isinstance(self.receipt_digest, Unset): + receipt_digest = UNSET + else: + receipt_digest = self.receipt_digest + + snapshot_id: None | str | Unset + if isinstance(self.snapshot_id, Unset): + snapshot_id = UNSET + elif isinstance(self.snapshot_id, UUID): + snapshot_id = str(self.snapshot_id) + else: + snapshot_id = self.snapshot_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "complete": complete, + "entities": entities, + "gaps": gaps, + "outcome": outcome, + } + ) + if receipt_digest is not UNSET: + field_dict["receipt_digest"] = receipt_digest + if snapshot_id is not UNSET: + field_dict["snapshot_id"] = snapshot_id + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.reach_gap_view import ReachGapView # noqa: PLC0415 + from ..models.reached_entity_view import ReachedEntityView # noqa: PLC0415 + + d = dict(src_dict) + complete = d.pop("complete") + + entities = [] + _entities = d.pop("entities") + for entities_item_data in _entities: + entities_item = ReachedEntityView.from_dict(entities_item_data) + + entities.append(entities_item) + + gaps = [] + _gaps = d.pop("gaps") + for gaps_item_data in _gaps: + gaps_item = ReachGapView.from_dict(gaps_item_data) + + gaps.append(gaps_item) + + outcome = DeclaredReachOutcome(d.pop("outcome")) + + def _parse_receipt_digest(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + receipt_digest = _parse_receipt_digest(d.pop("receipt_digest", UNSET)) + + def _parse_snapshot_id(data: object) -> None | Unset | UUID: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + snapshot_id_type_0 = UUID(data) + + return snapshot_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) + + snapshot_id = _parse_snapshot_id(d.pop("snapshot_id", UNSET)) + + declared_reach_view = cls( + complete=complete, + entities=entities, + gaps=gaps, + outcome=outcome, + receipt_digest=receipt_digest, + snapshot_id=snapshot_id, + ) + + declared_reach_view.additional_properties = d + return declared_reach_view + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/export_review_kind.py b/proofline/_generated/models/export_review_kind.py index 9ba28b14..f7b81df3 100644 --- a/proofline/_generated/models/export_review_kind.py +++ b/proofline/_generated/models/export_review_kind.py @@ -4,6 +4,7 @@ class ExportReviewKind(StrEnum): COMMIT = "COMMIT" DEPLOYMENT = "DEPLOYMENT" + FILES = "FILES" PATCH = "PATCH" PULL_REQUEST = "PULL_REQUEST" diff --git a/proofline/_generated/models/file_review_request.py b/proofline/_generated/models/file_review_request.py new file mode 100644 index 00000000..eabbef2e --- /dev/null +++ b/proofline/_generated/models/file_review_request.py @@ -0,0 +1,51 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define + +T = TypeVar("T", bound="FileReviewRequest") + + +@_attrs_define +class FileReviewRequest: + """Whole files selected at one exact pushed commit. + + Attributes: + commit_sha (str): The exact pushed commit whose whole files are reviewed. + paths (list[str]): Between one and twenty exact repository-relative file paths. + """ + + commit_sha: str + paths: list[str] + + def to_dict(self) -> dict[str, Any]: + commit_sha = self.commit_sha + + paths = self.paths + + field_dict: dict[str, Any] = {} + + field_dict.update( + { + "commit_sha": commit_sha, + "paths": paths, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + commit_sha = d.pop("commit_sha") + + paths = cast(list[str], d.pop("paths")) + + file_review_request = cls( + commit_sha=commit_sha, + paths=paths, + ) + + return file_review_request diff --git a/proofline/_generated/models/file_review_response.py b/proofline/_generated/models/file_review_response.py new file mode 100644 index 00000000..d59f17b1 --- /dev/null +++ b/proofline/_generated/models/file_review_response.py @@ -0,0 +1,73 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="FileReviewResponse") + + +@_attrs_define +class FileReviewResponse: + """What a named-file review request produced. + + Attributes: + existing (bool): True when this exact selection already had a review and that one is + returned. Sending the same selection twice by the same person reviews it once. + review_id (UUID): The review of this selection, readable through the review and findings + routes. + """ + + existing: bool + review_id: UUID + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + existing = self.existing + + review_id = str(self.review_id) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "existing": existing, + "review_id": review_id, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + existing = d.pop("existing") + + review_id = UUID(d.pop("review_id")) + + file_review_response = cls( + existing=existing, + review_id=review_id, + ) + + file_review_response.additional_properties = d + return file_review_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/file_scope.py b/proofline/_generated/models/file_scope.py new file mode 100644 index 00000000..9c3861de --- /dev/null +++ b/proofline/_generated/models/file_scope.py @@ -0,0 +1,52 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define + +T = TypeVar("T", bound="FileScope") + + +@_attrs_define +class FileScope: + """The retained selection, not a digest of file contents. Its identity uses + a version prefix and length-framed UTF-8 paths in their sorted order. + + Attributes: + paths (list[str]): Sorted, unique repository-relative paths selected for whole-file review. + paths_digest (str): Digest of the selected paths, not the file contents. + """ + + paths: list[str] + paths_digest: str + + def to_dict(self) -> dict[str, Any]: + paths = self.paths + + paths_digest = self.paths_digest + + field_dict: dict[str, Any] = {} + + field_dict.update( + { + "paths": paths, + "paths_digest": paths_digest, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + paths = cast(list[str], d.pop("paths")) + + paths_digest = d.pop("paths_digest") + + file_scope = cls( + paths=paths, + paths_digest=paths_digest, + ) + + return file_scope diff --git a/proofline/_generated/models/gate_state.py b/proofline/_generated/models/gate_state.py index ae53a8a9..7aad04c2 100644 --- a/proofline/_generated/models/gate_state.py +++ b/proofline/_generated/models/gate_state.py @@ -9,6 +9,7 @@ from ..types import UNSET, Unset if TYPE_CHECKING: + from ..models.occurrence_capture import OccurrenceCapture from ..models.override import Override @@ -19,12 +20,16 @@ class GateState: """ Attributes: + occurrence_captures (list[OccurrenceCapture]): The occurrence questions the gate's approval deferred, as each + observed execution of its deployment answered them. Outcome-only + records: none of them changes the gate or grades a prediction. status (str): Local gate state. ALLOWED/BLOCKED can precede provider delivery. This field does not confirm that GitHub released or blocked a run. override_record (None | Override | Unset): Recorded override authorization, not confirmation of provider delivery. """ + occurrence_captures: list[OccurrenceCapture] status: str override_record: None | Override | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) @@ -32,6 +37,11 @@ class GateState: def to_dict(self) -> dict[str, Any]: from ..models.override import Override # noqa: PLC0415 + occurrence_captures = [] + for occurrence_captures_item_data in self.occurrence_captures: + occurrence_captures_item = occurrence_captures_item_data.to_dict() + occurrence_captures.append(occurrence_captures_item) + status = self.status override_record: dict[str, Any] | None | Unset @@ -46,6 +56,7 @@ def to_dict(self) -> dict[str, Any]: field_dict.update(self.additional_properties) field_dict.update( { + "occurrence_captures": occurrence_captures, "status": status, } ) @@ -56,9 +67,17 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.occurrence_capture import OccurrenceCapture # noqa: PLC0415 from ..models.override import Override # noqa: PLC0415 d = dict(src_dict) + occurrence_captures = [] + _occurrence_captures = d.pop("occurrence_captures") + for occurrence_captures_item_data in _occurrence_captures: + occurrence_captures_item = OccurrenceCapture.from_dict(occurrence_captures_item_data) + + occurrence_captures.append(occurrence_captures_item) + status = d.pop("status") def _parse_override_record(data: object) -> None | Override | Unset: @@ -79,6 +98,7 @@ def _parse_override_record(data: object) -> None | Override | Unset: override_record = _parse_override_record(d.pop("override_record", UNSET)) gate_state = cls( + occurrence_captures=occurrence_captures, status=status, override_record=override_record, ) diff --git a/proofline/_generated/models/local_reverification.py b/proofline/_generated/models/local_reverification.py new file mode 100644 index 00000000..666fda68 --- /dev/null +++ b/proofline/_generated/models/local_reverification.py @@ -0,0 +1,96 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.local_reverification_outcome import LocalReverificationOutcome + +T = TypeVar("T", bound="LocalReverification") + + +@_attrs_define +class LocalReverification: + """One finding a patch review re-verified against the patch. The outcome is + local: the pull request's finding is unchanged whatever it is. + + Attributes: + checks (Any): Each deterministic check the finding cited and its result on the + patched head. Empty until an outcome is recorded. + finding_id (UUID): + iteration (int): The request's number among the requests to re-verify the finding's + series on this patch, at most 3. + outcome (LocalReverificationOutcome): `RESOLVED_VERIFIED` needs the re-investigation to reject the finding's + hypothesis and every cited check to pass. `STILL_PRESENT`: the hypothesis + is supported, or a check still finds the mechanism. `NOT_VERIFIED`: + anything else, including a review that ended without an answer. + `PENDING`: the review is still running. + """ + + checks: Any + finding_id: UUID + iteration: int + outcome: LocalReverificationOutcome + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + checks = self.checks + + finding_id = str(self.finding_id) + + iteration = self.iteration + + outcome = self.outcome.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "checks": checks, + "finding_id": finding_id, + "iteration": iteration, + "outcome": outcome, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + checks = d.pop("checks") + + finding_id = UUID(d.pop("finding_id")) + + iteration = d.pop("iteration") + + outcome = LocalReverificationOutcome(d.pop("outcome")) + + local_reverification = cls( + checks=checks, + finding_id=finding_id, + iteration=iteration, + outcome=outcome, + ) + + local_reverification.additional_properties = d + return local_reverification + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/local_reverification_outcome.py b/proofline/_generated/models/local_reverification_outcome.py new file mode 100644 index 00000000..f930e2e1 --- /dev/null +++ b/proofline/_generated/models/local_reverification_outcome.py @@ -0,0 +1,11 @@ +from enum import StrEnum + + +class LocalReverificationOutcome(StrEnum): + NOT_VERIFIED = "NOT_VERIFIED" + PENDING = "PENDING" + RESOLVED_VERIFIED = "RESOLVED_VERIFIED" + STILL_PRESENT = "STILL_PRESENT" + + def __str__(self) -> str: + return str(self.value) diff --git a/proofline/_generated/models/occurrence_capture.py b/proofline/_generated/models/occurrence_capture.py new file mode 100644 index 00000000..d065b861 --- /dev/null +++ b/proofline/_generated/models/occurrence_capture.py @@ -0,0 +1,221 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.approval_gap import ApprovalGap + from ..models.occurrence_question import OccurrenceQuestion + + +T = TypeVar("T", bound="OccurrenceCapture") + + +@_attrs_define +class OccurrenceCapture: + """The capture of one observed execution of a gate's deployment. + + Attributes: + approval_gaps (list[ApprovalGap]): Assessments whose approval could defer nothing, with the reason. + questions (list[OccurrenceQuestion]): Deferred questions and their binding or observed results for this + occurrence. + state (Literal['INCOMPLETE'] | Literal['NOT_EXECUTED'] | Literal['PENDING'] | Literal['RECORDED'] | + Literal['UNBOUND']): How the capture ended. + detail (None | str | Unset): Explanation of the capture's outcome, when available. + occurrence_key (None | str | Unset): Retained identity of the deployment occurrence, when available. + """ + + approval_gaps: list[ApprovalGap] + questions: list[OccurrenceQuestion] + state: ( + Literal["INCOMPLETE"] + | Literal["NOT_EXECUTED"] + | Literal["PENDING"] + | Literal["RECORDED"] + | Literal["UNBOUND"] + ) + detail: None | str | Unset = UNSET + occurrence_key: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + approval_gaps = [] + for approval_gaps_item_data in self.approval_gaps: + approval_gaps_item = approval_gaps_item_data.to_dict() + approval_gaps.append(approval_gaps_item) + + questions = [] + for questions_item_data in self.questions: + questions_item = questions_item_data.to_dict() + questions.append(questions_item) + + state: ( + Literal["INCOMPLETE"] + | Literal["NOT_EXECUTED"] + | Literal["PENDING"] + | Literal["RECORDED"] + | Literal["UNBOUND"] + ) + state = self.state + + detail: None | str | Unset + if isinstance(self.detail, Unset): + detail = UNSET + else: + detail = self.detail + + occurrence_key: None | str | Unset + if isinstance(self.occurrence_key, Unset): + occurrence_key = UNSET + else: + occurrence_key = self.occurrence_key + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "approval_gaps": approval_gaps, + "questions": questions, + "state": state, + } + ) + if detail is not UNSET: + field_dict["detail"] = detail + if occurrence_key is not UNSET: + field_dict["occurrence_key"] = occurrence_key + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.approval_gap import ApprovalGap # noqa: PLC0415 + from ..models.occurrence_question import OccurrenceQuestion # noqa: PLC0415 + + d = dict(src_dict) + approval_gaps = [] + _approval_gaps = d.pop("approval_gaps") + for approval_gaps_item_data in _approval_gaps: + approval_gaps_item = ApprovalGap.from_dict(approval_gaps_item_data) + + approval_gaps.append(approval_gaps_item) + + questions = [] + _questions = d.pop("questions") + for questions_item_data in _questions: + questions_item = OccurrenceQuestion.from_dict(questions_item_data) + + questions.append(questions_item) + + def _parse_state( + data: object, + ) -> ( + Literal["INCOMPLETE"] + | Literal["NOT_EXECUTED"] + | Literal["PENDING"] + | Literal["RECORDED"] + | Literal["UNBOUND"] + ): + try: + if not (type(data) is str and data == "PENDING"): + raise TypeError() + componentsschemas_capture_state_type_0 = cast(Literal["PENDING"], data) + if componentsschemas_capture_state_type_0 != "PENDING": + raise ValueError( + f"/components/schemas/CaptureState_type_0 must match const 'PENDING', got '{componentsschemas_capture_state_type_0}'" + ) + return componentsschemas_capture_state_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + try: + if not (type(data) is str and data == "RECORDED"): + raise TypeError() + componentsschemas_capture_state_type_1 = cast(Literal["RECORDED"], data) + if componentsschemas_capture_state_type_1 != "RECORDED": + raise ValueError( + f"/components/schemas/CaptureState_type_1 must match const 'RECORDED', got '{componentsschemas_capture_state_type_1}'" + ) + return componentsschemas_capture_state_type_1 + except (TypeError, ValueError, AttributeError, KeyError): + pass + try: + if not (type(data) is str and data == "UNBOUND"): + raise TypeError() + componentsschemas_capture_state_type_2 = cast(Literal["UNBOUND"], data) + if componentsschemas_capture_state_type_2 != "UNBOUND": + raise ValueError( + f"/components/schemas/CaptureState_type_2 must match const 'UNBOUND', got '{componentsschemas_capture_state_type_2}'" + ) + return componentsschemas_capture_state_type_2 + except (TypeError, ValueError, AttributeError, KeyError): + pass + try: + if not (type(data) is str and data == "NOT_EXECUTED"): + raise TypeError() + componentsschemas_capture_state_type_3 = cast(Literal["NOT_EXECUTED"], data) + if componentsschemas_capture_state_type_3 != "NOT_EXECUTED": + raise ValueError( + f"/components/schemas/CaptureState_type_3 must match const 'NOT_EXECUTED', got '{componentsschemas_capture_state_type_3}'" + ) + return componentsschemas_capture_state_type_3 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not (type(data) is str and data == "INCOMPLETE"): + raise TypeError() + componentsschemas_capture_state_type_4 = cast(Literal["INCOMPLETE"], data) + if componentsschemas_capture_state_type_4 != "INCOMPLETE": + raise ValueError( + f"/components/schemas/CaptureState_type_4 must match const 'INCOMPLETE', got '{componentsschemas_capture_state_type_4}'" + ) + return componentsschemas_capture_state_type_4 + + state = _parse_state(d.pop("state")) + + def _parse_detail(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + detail = _parse_detail(d.pop("detail", UNSET)) + + def _parse_occurrence_key(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + occurrence_key = _parse_occurrence_key(d.pop("occurrence_key", UNSET)) + + occurrence_capture = cls( + approval_gaps=approval_gaps, + questions=questions, + state=state, + detail=detail, + occurrence_key=occurrence_key, + ) + + occurrence_capture.additional_properties = d + return occurrence_capture + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/occurrence_question.py b/proofline/_generated/models/occurrence_question.py new file mode 100644 index 00000000..b76e745d --- /dev/null +++ b/proofline/_generated/models/occurrence_question.py @@ -0,0 +1,200 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, Literal, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="OccurrenceQuestion") + + +@_attrs_define +class OccurrenceQuestion: + """One deferred question as the gate presents it. + + Attributes: + assessment_id (UUID): Assessment whose approval deferred this question. + family_key (str): Hypothesis family key for the deferred question. + family_version (int): Hypothesis family version for the deferred question. + state (Literal['NOT_EXECUTED'] | Literal['PENDING'] | Literal['RECORDED'] | Literal['UNBOUND']): Where one + deferred question stands. + code (None | str | Unset): World's binding or refusal code, or the control plane's own gap. + observed_result (None | str | Unset): World's observed result once it recorded the question. + outcome_id (None | str | Unset): World outcome record identifier, when an observed result was recorded. + """ + + assessment_id: UUID + family_key: str + family_version: int + state: Literal["NOT_EXECUTED"] | Literal["PENDING"] | Literal["RECORDED"] | Literal["UNBOUND"] + code: None | str | Unset = UNSET + observed_result: None | str | Unset = UNSET + outcome_id: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + assessment_id = str(self.assessment_id) + + family_key = self.family_key + + family_version = self.family_version + + state: ( + Literal["NOT_EXECUTED"] | Literal["PENDING"] | Literal["RECORDED"] | Literal["UNBOUND"] + ) + state = self.state + + code: None | str | Unset + if isinstance(self.code, Unset): + code = UNSET + else: + code = self.code + + observed_result: None | str | Unset + if isinstance(self.observed_result, Unset): + observed_result = UNSET + else: + observed_result = self.observed_result + + outcome_id: None | str | Unset + if isinstance(self.outcome_id, Unset): + outcome_id = UNSET + else: + outcome_id = self.outcome_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "assessment_id": assessment_id, + "family_key": family_key, + "family_version": family_version, + "state": state, + } + ) + if code is not UNSET: + field_dict["code"] = code + if observed_result is not UNSET: + field_dict["observed_result"] = observed_result + if outcome_id is not UNSET: + field_dict["outcome_id"] = outcome_id + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + assessment_id = UUID(d.pop("assessment_id")) + + family_key = d.pop("family_key") + + family_version = d.pop("family_version") + + def _parse_state( + data: object, + ) -> ( + Literal["NOT_EXECUTED"] | Literal["PENDING"] | Literal["RECORDED"] | Literal["UNBOUND"] + ): + try: + if not (type(data) is str and data == "PENDING"): + raise TypeError() + componentsschemas_question_state_type_0 = cast(Literal["PENDING"], data) + if componentsschemas_question_state_type_0 != "PENDING": + raise ValueError( + f"/components/schemas/QuestionState_type_0 must match const 'PENDING', got '{componentsschemas_question_state_type_0}'" + ) + return componentsschemas_question_state_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + try: + if not (type(data) is str and data == "RECORDED"): + raise TypeError() + componentsschemas_question_state_type_1 = cast(Literal["RECORDED"], data) + if componentsschemas_question_state_type_1 != "RECORDED": + raise ValueError( + f"/components/schemas/QuestionState_type_1 must match const 'RECORDED', got '{componentsschemas_question_state_type_1}'" + ) + return componentsschemas_question_state_type_1 + except (TypeError, ValueError, AttributeError, KeyError): + pass + try: + if not (type(data) is str and data == "UNBOUND"): + raise TypeError() + componentsschemas_question_state_type_2 = cast(Literal["UNBOUND"], data) + if componentsschemas_question_state_type_2 != "UNBOUND": + raise ValueError( + f"/components/schemas/QuestionState_type_2 must match const 'UNBOUND', got '{componentsschemas_question_state_type_2}'" + ) + return componentsschemas_question_state_type_2 + except (TypeError, ValueError, AttributeError, KeyError): + pass + if not (type(data) is str and data == "NOT_EXECUTED"): + raise TypeError() + componentsschemas_question_state_type_3 = cast(Literal["NOT_EXECUTED"], data) + if componentsschemas_question_state_type_3 != "NOT_EXECUTED": + raise ValueError( + f"/components/schemas/QuestionState_type_3 must match const 'NOT_EXECUTED', got '{componentsschemas_question_state_type_3}'" + ) + return componentsschemas_question_state_type_3 + + state = _parse_state(d.pop("state")) + + def _parse_code(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + code = _parse_code(d.pop("code", UNSET)) + + def _parse_observed_result(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + observed_result = _parse_observed_result(d.pop("observed_result", UNSET)) + + def _parse_outcome_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + outcome_id = _parse_outcome_id(d.pop("outcome_id", UNSET)) + + occurrence_question = cls( + assessment_id=assessment_id, + family_key=family_key, + family_version=family_version, + state=state, + code=code, + observed_result=observed_result, + outcome_id=outcome_id, + ) + + occurrence_question.additional_properties = d + return occurrence_question + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/patch_review_request.py b/proofline/_generated/models/patch_review_request.py index 3bd72b62..4095db45 100644 --- a/proofline/_generated/models/patch_review_request.py +++ b/proofline/_generated/models/patch_review_request.py @@ -2,6 +2,7 @@ from collections.abc import Mapping from typing import Any, TypeVar, cast +from uuid import UUID from attrs import define as _attrs_define @@ -24,11 +25,19 @@ class PatchReviewRequest: trigger_source (None | PatchTriggerSource | Unset): The git hook that sent this request, when one did. A review recorded by an earlier identical request keeps the source it recorded. + verify_finding_ids (list[UUID] | Unset): Open findings of one pull request in this repository to re-verify + against the patch, at most 20. The review re-investigates each one + and reports its outcome in `local_reverifications`; the pull + request's findings are unchanged whatever it is. Requires an API + token. Each finding's series takes at most 3 requests per patch, and + the pull request at most 10 re-verification requests per hour, + counted with those a coding agent makes through MCP. """ base_commit_sha: str patch: str trigger_source: None | PatchTriggerSource | Unset = UNSET + verify_finding_ids: list[UUID] | Unset = UNSET def to_dict(self) -> dict[str, Any]: base_commit_sha = self.base_commit_sha @@ -43,6 +52,13 @@ def to_dict(self) -> dict[str, Any]: else: trigger_source = self.trigger_source + verify_finding_ids: list[str] | Unset = UNSET + if not isinstance(self.verify_finding_ids, Unset): + verify_finding_ids = [] + for verify_finding_ids_item_data in self.verify_finding_ids: + verify_finding_ids_item = str(verify_finding_ids_item_data) + verify_finding_ids.append(verify_finding_ids_item) + field_dict: dict[str, Any] = {} field_dict.update( @@ -53,6 +69,8 @@ def to_dict(self) -> dict[str, Any]: ) if trigger_source is not UNSET: field_dict["trigger_source"] = trigger_source + if verify_finding_ids is not UNSET: + field_dict["verify_finding_ids"] = verify_finding_ids return field_dict @@ -80,10 +98,20 @@ def _parse_trigger_source(data: object) -> None | PatchTriggerSource | Unset: trigger_source = _parse_trigger_source(d.pop("trigger_source", UNSET)) + _verify_finding_ids = d.pop("verify_finding_ids", UNSET) + verify_finding_ids: list[UUID] | Unset = UNSET + if _verify_finding_ids is not UNSET: + verify_finding_ids = [] + for verify_finding_ids_item_data in _verify_finding_ids: + verify_finding_ids_item = UUID(verify_finding_ids_item_data) + + verify_finding_ids.append(verify_finding_ids_item) + patch_review_request = cls( base_commit_sha=base_commit_sha, patch=patch, trigger_source=trigger_source, + verify_finding_ids=verify_finding_ids, ) return patch_review_request diff --git a/proofline/_generated/models/patch_review_response.py b/proofline/_generated/models/patch_review_response.py index d7711a13..4461d415 100644 --- a/proofline/_generated/models/patch_review_response.py +++ b/proofline/_generated/models/patch_review_response.py @@ -1,12 +1,16 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar +from typing import TYPE_CHECKING, Any, TypeVar from uuid import UUID from attrs import define as _attrs_define from attrs import field as _attrs_field +if TYPE_CHECKING: + from ..models.patch_verification import PatchVerification + + T = TypeVar("T", bound="PatchReviewResponse") @@ -21,11 +25,14 @@ class PatchReviewResponse: the repository and base commit. review_id (UUID): The review of this patch on this base, readable through the review and findings routes. + verify (list[PatchVerification]): Each finding of `verify_finding_ids` the review re-verifies, one per + finding series. Empty without `verify_finding_ids`. """ existing: bool patch_digest: str review_id: UUID + verify: list[PatchVerification] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -35,6 +42,11 @@ def to_dict(self) -> dict[str, Any]: review_id = str(self.review_id) + verify = [] + for verify_item_data in self.verify: + verify_item = verify_item_data.to_dict() + verify.append(verify_item) + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -42,6 +54,7 @@ def to_dict(self) -> dict[str, Any]: "existing": existing, "patch_digest": patch_digest, "review_id": review_id, + "verify": verify, } ) @@ -49,6 +62,8 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.patch_verification import PatchVerification # noqa: PLC0415 + d = dict(src_dict) existing = d.pop("existing") @@ -56,10 +71,18 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: review_id = UUID(d.pop("review_id")) + verify = [] + _verify = d.pop("verify") + for verify_item_data in _verify: + verify_item = PatchVerification.from_dict(verify_item_data) + + verify.append(verify_item) + patch_review_response = cls( existing=existing, patch_digest=patch_digest, review_id=review_id, + verify=verify, ) patch_review_response.additional_properties = d diff --git a/proofline/_generated/models/patch_verification.py b/proofline/_generated/models/patch_verification.py new file mode 100644 index 00000000..9c76f7cf --- /dev/null +++ b/proofline/_generated/models/patch_verification.py @@ -0,0 +1,72 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="PatchVerification") + + +@_attrs_define +class PatchVerification: + """One finding a patch review re-verifies against the patch. + + Attributes: + finding_id (UUID): + iteration (int): This request's number among the requests to re-verify the finding's + series on this patch, at most 3. + """ + + finding_id: UUID + iteration: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + finding_id = str(self.finding_id) + + iteration = self.iteration + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "finding_id": finding_id, + "iteration": iteration, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + finding_id = UUID(d.pop("finding_id")) + + iteration = d.pop("iteration") + + patch_verification = cls( + finding_id=finding_id, + iteration=iteration, + ) + + patch_verification.additional_properties = d + return patch_verification + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/pull_request_merge_gate.py b/proofline/_generated/models/pull_request_merge_gate.py index f9a3dc72..1c510cbd 100644 --- a/proofline/_generated/models/pull_request_merge_gate.py +++ b/proofline/_generated/models/pull_request_merge_gate.py @@ -19,8 +19,9 @@ class PullRequestMergeGate: """ Attributes: - blocking_severity (str): The frozen blocking threshold, either SERIOUS or WARNING; later settings do not restamp - it. + blocking_severity (str): The frozen blocking threshold, either SERIOUS (serious and critical findings) or + WARNING (every + supported finding); later settings do not restamp it. head_sha (str): The exact lowercase commit SHA whose captured policy this gate evaluates. id (UUID): The immutable identity of the gate captured for this tenant, repository and head. policy_version (str): The deterministic policy version frozen when this gate was captured. diff --git a/proofline/_generated/models/reach_gap_view.py b/proofline/_generated/models/reach_gap_view.py new file mode 100644 index 00000000..9dde73a8 --- /dev/null +++ b/proofline/_generated/models/reach_gap_view.py @@ -0,0 +1,61 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ReachGapView") + + +@_attrs_define +class ReachGapView: + """ + Attributes: + code (str): `COVERAGE_INCOMPLETE`, `SOURCE_CAPABILITY_MISSING` or `BOUND_REACHED`. + """ + + code: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + code = self.code + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "code": code, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + code = d.pop("code") + + reach_gap_view = cls( + code=code, + ) + + reach_gap_view.additional_properties = d + return reach_gap_view + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/reach_step_view.py b/proofline/_generated/models/reach_step_view.py new file mode 100644 index 00000000..038cbca8 --- /dev/null +++ b/proofline/_generated/models/reach_step_view.py @@ -0,0 +1,79 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ReachStepView") + + +@_attrs_define +class ReachStepView: + """ + Attributes: + assertion_id (UUID): The World relation assertion behind this step. + direction (str): `OUT` when the step follows the relation from its subject, `IN` when + it follows it back to the subject. + relation (str): The relation key, such as `proofline.relation.consumes_api`. + """ + + assertion_id: UUID + direction: str + relation: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + assertion_id = str(self.assertion_id) + + direction = self.direction + + relation = self.relation + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "assertion_id": assertion_id, + "direction": direction, + "relation": relation, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + assertion_id = UUID(d.pop("assertion_id")) + + direction = d.pop("direction") + + relation = d.pop("relation") + + reach_step_view = cls( + assertion_id=assertion_id, + direction=direction, + relation=relation, + ) + + reach_step_view.additional_properties = d + return reach_step_view + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/reached_entity_view.py b/proofline/_generated/models/reached_entity_view.py new file mode 100644 index 00000000..a31436c9 --- /dev/null +++ b/proofline/_generated/models/reached_entity_view.py @@ -0,0 +1,109 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.reach_step_view import ReachStepView + + +T = TypeVar("T", bound="ReachedEntityView") + + +@_attrs_define +class ReachedEntityView: + """ + Attributes: + entity_id (UUID): World's entity ID. + kind (str): The entity's kind, such as `service` or `queue`. + label (str): World's display label for the entity: environment evidence for + readers of this organization, never published to GitHub. + path (list[ReachStepView]): The recorded relation assertions from the deployed root to the entity. + type_keys (list[str]): World's registry type keys for the entity. + """ + + entity_id: UUID + kind: str + label: str + path: list[ReachStepView] + type_keys: list[str] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + entity_id = str(self.entity_id) + + kind = self.kind + + label = self.label + + path = [] + for path_item_data in self.path: + path_item = path_item_data.to_dict() + path.append(path_item) + + type_keys = self.type_keys + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "entity_id": entity_id, + "kind": kind, + "label": label, + "path": path, + "type_keys": type_keys, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.reach_step_view import ReachStepView # noqa: PLC0415 + + d = dict(src_dict) + entity_id = UUID(d.pop("entity_id")) + + kind = d.pop("kind") + + label = d.pop("label") + + path = [] + _path = d.pop("path") + for path_item_data in _path: + path_item = ReachStepView.from_dict(path_item_data) + + path.append(path_item) + + type_keys = cast(list[str], d.pop("type_keys")) + + reached_entity_view = cls( + entity_id=entity_id, + kind=kind, + label=label, + path=path, + type_keys=type_keys, + ) + + reached_entity_view.additional_properties = d + return reached_entity_view + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/refresh_view.py b/proofline/_generated/models/refresh_view.py new file mode 100644 index 00000000..b699a6b8 --- /dev/null +++ b/proofline/_generated/models/refresh_view.py @@ -0,0 +1,141 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="RefreshView") + + +@_attrs_define +class RefreshView: + """A recorded refresh decision, as the console shows it. + + Attributes: + mode (str): `INCREMENTAL` reviews only the files the push touched and carries the + earlier review's untouched findings forward; `FULL` reviews the whole change. + decided_by (None | str | Unset): What decided: `FLOOR`, a refresh rule that always reviews the whole + change; `JEV`, Proofline's decision model within those rules; or + `FALLBACK`, the refresh rules because the model did not decide. + Absent for a full review a person requested, and for reviews decided + before it was recorded. + reason (None | str | Unset): Why, in words. Server text that may name repository paths. + refreshes_review_id (None | Unset | UUID): The review this one refreshes. Absent for a full review a person + requested. + """ + + mode: str + decided_by: None | str | Unset = UNSET + reason: None | str | Unset = UNSET + refreshes_review_id: None | Unset | UUID = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + mode = self.mode + + decided_by: None | str | Unset + if isinstance(self.decided_by, Unset): + decided_by = UNSET + else: + decided_by = self.decided_by + + reason: None | str | Unset + if isinstance(self.reason, Unset): + reason = UNSET + else: + reason = self.reason + + refreshes_review_id: None | str | Unset + if isinstance(self.refreshes_review_id, Unset): + refreshes_review_id = UNSET + elif isinstance(self.refreshes_review_id, UUID): + refreshes_review_id = str(self.refreshes_review_id) + else: + refreshes_review_id = self.refreshes_review_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "mode": mode, + } + ) + if decided_by is not UNSET: + field_dict["decided_by"] = decided_by + if reason is not UNSET: + field_dict["reason"] = reason + if refreshes_review_id is not UNSET: + field_dict["refreshes_review_id"] = refreshes_review_id + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + mode = d.pop("mode") + + def _parse_decided_by(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + decided_by = _parse_decided_by(d.pop("decided_by", UNSET)) + + def _parse_reason(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + reason = _parse_reason(d.pop("reason", UNSET)) + + def _parse_refreshes_review_id(data: object) -> None | Unset | UUID: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + refreshes_review_id_type_0 = UUID(data) + + return refreshes_review_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) + + refreshes_review_id = _parse_refreshes_review_id(d.pop("refreshes_review_id", UNSET)) + + refresh_view = cls( + mode=mode, + decided_by=decided_by, + reason=reason, + refreshes_review_id=refreshes_review_id, + ) + + refresh_view.additional_properties = d + return refresh_view + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/review_summary.py b/proofline/_generated/models/review_summary.py index 01860738..a3f7d500 100644 --- a/proofline/_generated/models/review_summary.py +++ b/proofline/_generated/models/review_summary.py @@ -2,7 +2,7 @@ import datetime from collections.abc import Mapping -from typing import Any, TypeVar, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from uuid import UUID from attrs import define as _attrs_define @@ -10,6 +10,10 @@ from ..types import UNSET, Unset +if TYPE_CHECKING: + from ..models.refresh_view import RefreshView + + T = TypeVar("T", bound="ReviewSummary") @@ -24,7 +28,8 @@ class ReviewSummary: finding_count (int): How many findings this review's assessments recorded, across all of them. id (UUID): The review's identifier. kind (str): `PULL_REQUEST`, `DEPLOYMENT`, `PATCH`, a review of local changes - sent as a patch, or `COMMIT`, a review of pushed commits. + sent as a patch, `COMMIT`, a review of pushed commits, or `FILES`, + complete selected files at one pushed commit. public_key (str): The review's stable public address: `rev_` followed by its identifier without hyphens. publication (str): Whether the review reached the pull request: `PUBLISHED`, `WITHHELD`, `PUBLICATION_REQUESTED` or `PUBLICATION_REFUSED`. A review run from @@ -62,6 +67,9 @@ class ReviewSummary: renderers must treat it as text, never markup. pull_request_url (None | str | Unset): The pull request on GitHub. Absent for a deployment review or when the repository is unknown. + refresh (None | RefreshView | Unset): How this review decided what it reviews after a push or a full-review + request. Absent for a review that refreshes nothing, and while a + refresh has not decided yet. repository_full_name (None | str | Unset): The repository's `owner/name`. Absent when the review names no repository. repository_id (None | Unset | UUID): The review's repository. Set only on a single-review read, and absent there @@ -96,6 +104,7 @@ class ReviewSummary: pull_request_state: None | str | Unset = UNSET pull_request_title: None | str | Unset = UNSET pull_request_url: None | str | Unset = UNSET + refresh: None | RefreshView | Unset = UNSET repository_full_name: None | str | Unset = UNSET repository_id: None | Unset | UUID = UNSET repository_name: None | str | Unset = UNSET @@ -104,6 +113,8 @@ class ReviewSummary: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + from ..models.refresh_view import RefreshView # noqa: PLC0415 + assessment_count = self.assessment_count created_at = self.created_at.isoformat() @@ -204,6 +215,14 @@ def to_dict(self) -> dict[str, Any]: else: pull_request_url = self.pull_request_url + refresh: dict[str, Any] | None | Unset + if isinstance(self.refresh, Unset): + refresh = UNSET + elif isinstance(self.refresh, RefreshView): + refresh = self.refresh.to_dict() + else: + refresh = self.refresh + repository_full_name: None | str | Unset if isinstance(self.repository_full_name, Unset): repository_full_name = UNSET @@ -278,6 +297,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["pull_request_title"] = pull_request_title if pull_request_url is not UNSET: field_dict["pull_request_url"] = pull_request_url + if refresh is not UNSET: + field_dict["refresh"] = refresh if repository_full_name is not UNSET: field_dict["repository_full_name"] = repository_full_name if repository_id is not UNSET: @@ -293,6 +314,8 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.refresh_view import RefreshView # noqa: PLC0415 + d = dict(src_dict) assessment_count = d.pop("assessment_count") @@ -449,6 +472,23 @@ def _parse_pull_request_url(data: object) -> None | str | Unset: pull_request_url = _parse_pull_request_url(d.pop("pull_request_url", UNSET)) + def _parse_refresh(data: object) -> None | RefreshView | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + refresh_type_0 = RefreshView.from_dict(data) + + return refresh_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | RefreshView | Unset, data) + + refresh = _parse_refresh(d.pop("refresh", UNSET)) + def _parse_repository_full_name(data: object) -> None | str | Unset: if data is None: return data @@ -526,6 +566,7 @@ def _parse_run_number(data: object) -> int | None | Unset: pull_request_state=pull_request_state, pull_request_title=pull_request_title, pull_request_url=pull_request_url, + refresh=refresh, repository_full_name=repository_full_name, repository_id=repository_id, repository_name=repository_name, diff --git a/proofline/_generated/models/stop_response.py b/proofline/_generated/models/stop_response.py new file mode 100644 index 00000000..643bdfd1 --- /dev/null +++ b/proofline/_generated/models/stop_response.py @@ -0,0 +1,94 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.actor_view import ActorView + + +T = TypeVar("T", bound="StopResponse") + + +@_attrs_define +class StopResponse: + """What stopping a review recorded. + + Attributes: + review_id (UUID): Identifier of the stopped review. + status (str): Always `STOPPED`: the review's status once the stop is committed. + stopped_at (datetime.datetime): Time when the review was stopped. + stopped_by (ActorView): The person behind an action on a review, as the page names them. + """ + + review_id: UUID + status: str + stopped_at: datetime.datetime + stopped_by: ActorView + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + review_id = str(self.review_id) + + status = self.status + + stopped_at = self.stopped_at.isoformat() + + stopped_by = self.stopped_by.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "review_id": review_id, + "status": status, + "stopped_at": stopped_at, + "stopped_by": stopped_by, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.actor_view import ActorView # noqa: PLC0415 + + d = dict(src_dict) + review_id = UUID(d.pop("review_id")) + + status = d.pop("status") + + stopped_at = datetime.datetime.fromisoformat(d.pop("stopped_at")) + + stopped_by = ActorView.from_dict(d.pop("stopped_by")) + + stop_response = cls( + review_id=review_id, + status=status, + stopped_at=stopped_at, + stopped_by=stopped_by, + ) + + stop_response.additional_properties = d + return stop_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/proofline/_generated/models/subject_view.py b/proofline/_generated/models/subject_view.py index be6157f2..3e20a373 100644 --- a/proofline/_generated/models/subject_view.py +++ b/proofline/_generated/models/subject_view.py @@ -10,6 +10,7 @@ from ..types import UNSET, Unset if TYPE_CHECKING: + from ..models.file_scope import FileScope from ..models.subject_authorization import SubjectAuthorization @@ -47,6 +48,7 @@ class SubjectView: `GIT_PATCH` subject applies to. Absent for other kinds. deployment_external_id (None | str | Unset): The GitHub deployment identifier a `GITHUB_WORKFLOW_RUN` subject ran for. Absent when the run was not for a deployment. + file_scope (FileScope | None | Unset): Whole-file selection at the pinned revision; absent for comparisons. patch_digest (None | str | Unset): The SHA-256 of a `GIT_PATCH` subject's canonical patch. Absent for other kinds. repository_full_name (None | str | Unset): Absent only when the subject's repository record itself is gone. @@ -67,6 +69,7 @@ class SubjectView: artifact_digest: None | str | Unset = UNSET commit_sha: None | str | Unset = UNSET deployment_external_id: None | str | Unset = UNSET + file_scope: FileScope | None | Unset = UNSET patch_digest: None | str | Unset = UNSET repository_full_name: None | str | Unset = UNSET repository_id: None | Unset | UUID = UNSET @@ -76,6 +79,8 @@ class SubjectView: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + from ..models.file_scope import FileScope # noqa: PLC0415 + id = str(self.id) kind = self.kind @@ -105,6 +110,14 @@ def to_dict(self) -> dict[str, Any]: else: deployment_external_id = self.deployment_external_id + file_scope: dict[str, Any] | None | Unset + if isinstance(self.file_scope, Unset): + file_scope = UNSET + elif isinstance(self.file_scope, FileScope): + file_scope = self.file_scope.to_dict() + else: + file_scope = self.file_scope + patch_digest: None | str | Unset if isinstance(self.patch_digest, Unset): patch_digest = UNSET @@ -159,6 +172,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["commit_sha"] = commit_sha if deployment_external_id is not UNSET: field_dict["deployment_external_id"] = deployment_external_id + if file_scope is not UNSET: + field_dict["file_scope"] = file_scope if patch_digest is not UNSET: field_dict["patch_digest"] = patch_digest if repository_full_name is not UNSET: @@ -176,6 +191,7 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.file_scope import FileScope # noqa: PLC0415 from ..models.subject_authorization import SubjectAuthorization # noqa: PLC0415 d = dict(src_dict) @@ -223,6 +239,23 @@ def _parse_deployment_external_id(data: object) -> None | str | Unset: d.pop("deployment_external_id", UNSET) ) + def _parse_file_scope(data: object) -> FileScope | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + file_scope_type_0 = FileScope.from_dict(data) + + return file_scope_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(FileScope | None | Unset, data) + + file_scope = _parse_file_scope(d.pop("file_scope", UNSET)) + def _parse_patch_digest(data: object) -> None | str | Unset: if data is None: return data @@ -293,6 +326,7 @@ def _parse_workflow_run_id(data: object) -> int | None | Unset: artifact_digest=artifact_digest, commit_sha=commit_sha, deployment_external_id=deployment_external_id, + file_scope=file_scope, patch_digest=patch_digest, repository_full_name=repository_full_name, repository_id=repository_id, diff --git a/proofline/client.py b/proofline/client.py index 689fa292..1ff185f4 100644 --- a/proofline/client.py +++ b/proofline/client.py @@ -30,10 +30,12 @@ list_repositories, list_reviews, request_commit_review, + request_file_review, request_patch_review, request_review, rerun_review, start_agent_session, + stop_review, ) from ._generated.client import AuthenticatedClient from ._generated.models.agent_session import AgentSession @@ -44,6 +46,8 @@ from ._generated.models.customer_assessment_detail import CustomerAssessmentDetail from ._generated.models.customer_finding import CustomerFinding from ._generated.models.customer_review_detail import CustomerReviewDetail +from ._generated.models.file_review_request import FileReviewRequest +from ._generated.models.file_review_response import FileReviewResponse from ._generated.models.finding_fix_prompt_type_0 import FindingFixPromptType0 from ._generated.models.finding_fix_prompt_type_1 import FindingFixPromptType1 from ._generated.models.patch_review_request import PatchReviewRequest @@ -59,6 +63,7 @@ from ._generated.models.run_now_request import RunNowRequest from ._generated.models.run_now_response import RunNowResponse from ._generated.models.start_session import StartSession +from ._generated.models.stop_response import StopResponse from ._generated.types import UNSET, Response, Unset from ._transport import ProoflineError from .outcomes import ReviewOutcome, outcome @@ -370,6 +375,20 @@ def request_patch_review( body=body, ) + def request_file_review( + self, organization_id: UUID, repository_id: UUID, *, body: FileReviewRequest + ) -> FileReviewResponse: + return self._call( + request_file_review.sync_detailed, + FileReviewResponse, + organization_id, + repository_id, + body=body, + ) + + def stop_review(self, organization_id: UUID, review_id: UUID) -> StopResponse: + return self._call(stop_review.sync_detailed, StopResponse, organization_id, review_id) + def request_commit_review( self, organization_id: UUID, repository_id: UUID, *, body: CommitReviewRequest ) -> CommitReviewResponse: @@ -661,6 +680,22 @@ async def request_patch_review( body=body, ) + async def request_file_review( + self, organization_id: UUID, repository_id: UUID, *, body: FileReviewRequest + ) -> FileReviewResponse: + return await self._call( + request_file_review.asyncio_detailed, + FileReviewResponse, + organization_id, + repository_id, + body=body, + ) + + async def stop_review(self, organization_id: UUID, review_id: UUID) -> StopResponse: + return await self._call( + stop_review.asyncio_detailed, StopResponse, organization_id, review_id + ) + async def request_commit_review( self, organization_id: UUID, repository_id: UUID, *, body: CommitReviewRequest ) -> CommitReviewResponse: diff --git a/scripts/contracts.py b/scripts/contracts.py index 09f34623..f372bfc0 100644 --- a/scripts/contracts.py +++ b/scripts/contracts.py @@ -24,9 +24,9 @@ def main() -> None: for path in (ROOT / "proofline/_generated/api/default").glob("*.py") if path.name != "__init__.py" } - if declared != generated or len(declared) != 18: + if declared != generated or len(declared) != 20: raise SystemExit( - "The generated JSON operations must match the eighteen public JSON token routes." + "The generated JSON operations must match the twenty public JSON token routes." ) tree = ast.parse((ROOT / "proofline/client.py").read_text()) helpers = {"close", "aclose", "iter_reviews", "wait_for_review"} diff --git a/tests/test_http.py b/tests/test_http.py index 80e8ff14..185bf36a 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -26,6 +26,8 @@ CustomerAssessmentDetail, CustomerFinding, CustomerReviewDetail, + FileReviewRequest, + FileReviewResponse, PatchReviewRequest, PatchReviewResponse, ProoflineClient, @@ -37,6 +39,7 @@ RunNowMode, RunNowRequest, RunNowResponse, + StopResponse, _sync_http, _transport, ) @@ -170,6 +173,17 @@ async def test_all_public_operations_use_generated_models_and_scoped_paths(mode: }, RunNowResponse, ), + ( + "POST", + f"{prefix}/reviews/{REVIEW}/stop", + { + "review_id": str(REVIEW), + "status": "STOPPED", + "stopped_by": {"github_user_id": 42, "login": "synthetic-user"}, + "stopped_at": "2026-01-01T00:00:00Z", + }, + StopResponse, + ), ( "POST", f"{prefix}/reviews/{REVIEW}/rerun", @@ -203,6 +217,7 @@ def respond(request: Request, index: int) -> Reply: ("get_review_guidance", (ORG, REPOSITORY), {}), ("list_repositories", (ORG,), {}), ("request_review", (ORG, REPOSITORY, 42), {}), + ("stop_review", (ORG, REVIEW), {}), ("rerun_review", (ORG, REVIEW), {}), ] for index, (name, args, kwargs) in enumerate(calls): @@ -216,6 +231,10 @@ def respond(request: Request, index: int) -> Reply: "CONSOLE", 1, ) + elif isinstance(result, StopResponse): + assert result.review_id == REVIEW + assert result.status == "STOPPED" + assert result.stopped_by.github_user_id == 42 elif isinstance(result, FindingFixPromptType0): assert result.untrusted_text == PRIVATE elif isinstance(result, FindingFixPromptType1): @@ -293,7 +312,15 @@ def respond_run_now(request: Request, index: int) -> Reply: {"base_commit_sha": "a" * 40, "patch": "diff --git a/x b/x\n"}, PatchReviewRequest, PatchReviewResponse, - {"patch_digest": "b" * 64}, + {"patch_digest": "b" * 64, "verify": []}, + ), + ( + "request_file_review", + "file-reviews", + {"commit_sha": "a" * 40, "paths": ["src/main.py"]}, + FileReviewRequest, + FileReviewResponse, + {}, ), ( "request_commit_review", @@ -309,10 +336,10 @@ async def test_local_and_commit_reviews_post_their_subject_and_decode_the_review mode: str, operation: str, route: str, - sent: dict[str, str], + sent: dict[str, Any], request_model: Any, response_model: Any, - extra: dict[str, str], + extra: dict[str, Any], ) -> None: body = request_model(**sent)