diff --git a/openapi.public.json b/openapi.public.json
index 22e8774e..1cef9a9e 100644
--- a/openapi.public.json
+++ b/openapi.public.json
@@ -704,6 +704,65 @@
],
"type": "object"
},
+ "ChangeSummary": {
+ "description": "What a review recorded about its change.",
+ "properties": {
+ "base_sha": {
+ "description": "The compared base commit. Null when the review pinned none.",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "files": {
+ "description": "The changed files the review read, by path, with the depth it read\n them at. Empty when the review recorded no change digest. Files the\n review's filters kept from review are listed apart, with their reason.",
+ "items": {
+ "$ref": "#/components/schemas/FileFact"
+ },
+ "type": "array"
+ },
+ "head_sha": {
+ "description": "The reviewed head commit.",
+ "type": "string"
+ },
+ "prose": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/Prose"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Model-written prose. Present only when `prose_outcome` is `PUBLISHED`.\n It is untrusted text: render it inert."
+ },
+ "prose_outcome": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ProseOutcome"
+ }
+ ],
+ "description": "The recorded prose-generation outcome, before response-time withholding."
+ },
+ "route": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/SummaryRoute"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "The route the summary applied. Null when the review recorded no change\n digest, so no route was asked."
+ }
+ },
+ "required": [
+ "head_sha",
+ "files",
+ "prose_outcome"
+ ],
+ "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": [
@@ -1757,6 +1816,17 @@
],
"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."
},
+ "change_summary": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/ChangeSummary"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "What the change does and which files the review read at which depth\n (§55). Null until the review's publication records it, and for a\n review that is not of a pull request. Generated text has current\n credentials and recorded protected values withheld; missing or expired\n provenance withholds the generated text whole."
+ },
"check_run_url": {
"description": "The GitHub check run Proofline published for this review. Null when\n none was published.",
"type": [
@@ -2206,6 +2276,17 @@
"string",
"null"
]
+ },
+ "terraform": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/TerraformRootsView"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "The Terraform addresses the reach also started from, or why it took\n none. Absent when the assessment read reach only from the deployed\n revision."
}
},
"required": [
@@ -2389,6 +2470,51 @@
],
"type": "string"
},
+ "FileFact": {
+ "properties": {
+ "additions": {
+ "description": "Lines added in this file's recorded diff.",
+ "format": "int64",
+ "type": "integer"
+ },
+ "deletions": {
+ "description": "Lines deleted in this file's recorded diff.",
+ "format": "int64",
+ "type": "integer"
+ },
+ "depth": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ReviewDepth"
+ }
+ ],
+ "description": "The review depth recorded for this file."
+ },
+ "path": {
+ "description": "The repository-relative path of the changed file.",
+ "type": "string"
+ },
+ "previous_path": {
+ "description": "The path before a rename.",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "status": {
+ "description": "GitHub's file status: `added`, `modified`, `removed`, `renamed` and so on.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "path",
+ "status",
+ "additions",
+ "deletions",
+ "depth"
+ ],
+ "type": "object"
+ },
"FileProjection": {
"properties": {
"depth": {
@@ -3954,6 +4080,75 @@
"title": "Problem",
"type": "object"
},
+ "Prose": {
+ "properties": {
+ "headline": {
+ "description": "At most 120 characters.",
+ "type": "string"
+ },
+ "notable_paths": {
+ "description": "Paths in the pinned diff the prose calls out.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "paragraphs": {
+ "description": "At most three of at most 400 characters; one on the `SHORT` route.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ }
+ },
+ "required": [
+ "headline",
+ "paragraphs",
+ "notable_paths"
+ ],
+ "type": "object"
+ },
+ "ProseOutcome": {
+ "description": "Why the summary carries prose or does not.",
+ "oneOf": [
+ {
+ "enum": [
+ "PUBLISHED"
+ ],
+ "type": "string"
+ },
+ {
+ "const": "NO_CHANGE_DIGEST",
+ "description": "The review recorded no change digest to summarize.",
+ "type": "string"
+ },
+ {
+ "const": "NOT_REQUESTED",
+ "description": "The applied route was `DETERMINISTIC_ONLY`.",
+ "type": "string"
+ },
+ {
+ "const": "MODEL_UNAVAILABLE",
+ "description": "No fast-tier model was bound, priced or funded, or it did not answer.",
+ "type": "string"
+ },
+ {
+ "const": "MALFORMED",
+ "description": "The answer did not fit the tool's schema or its limits.",
+ "type": "string"
+ },
+ {
+ "const": "REJECTED",
+ "description": "The prose used a word a summary never uses (\"safe\", \"no risk\",\n \"approved\") or named a path outside the diff.",
+ "type": "string"
+ },
+ {
+ "const": "UNGROUNDED",
+ "description": "Jev answered that a statement does not follow from the diff slices.",
+ "type": "string"
+ }
+ ]
+ },
"PullRequestMergeGate": {
"properties": {
"assessment_count": {
@@ -4435,6 +4630,13 @@
],
"type": "object"
},
+ "ReviewDepth": {
+ "description": "The depth the applied route plan read a file at.",
+ "enum": [
+ "STANDARD"
+ ],
+ "type": "string"
+ },
"ReviewDiffStats": {
"properties": {
"additions": {
@@ -5826,6 +6028,56 @@
],
"type": "object"
},
+ "SummaryRoute": {
+ "enum": [
+ "DETERMINISTIC_ONLY",
+ "SHORT",
+ "FULL"
+ ],
+ "type": "string"
+ },
+ "TerraformPlanView": {
+ "enum": [
+ "TAKEN",
+ "NOT_DECLARED",
+ "NOT_PINNED",
+ "HEAD_DIFFERS",
+ "ADDRESSES_UNREPORTED"
+ ],
+ "type": "string"
+ },
+ "TerraformRootsView": {
+ "description": "The Terraform roots of one declared reach read.",
+ "properties": {
+ "addresses": {
+ "description": "The changed resource instance addresses taken as roots.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "omitted": {
+ "description": "Changed addresses left out at World's limit of 100 roots per read.",
+ "format": "uint",
+ "minimum": 0,
+ "type": "integer"
+ },
+ "plan": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/TerraformPlanView"
+ }
+ ],
+ "description": "`TAKEN` when the plan pinned for the reviewed commit named the roots,\n `NOT_DECLARED` when the environment captures no Terraform plan for this\n review, `NOT_PINNED` when it declares one and none was pinned,\n `HEAD_DIFFERS` when the pinned plan is for another commit, and\n `ADDRESSES_UNREPORTED` when the pinned plan records no changed\n addresses because it was pinned before World reported them."
+ }
+ },
+ "required": [
+ "plan",
+ "addresses",
+ "omitted"
+ ],
+ "type": "object"
+ },
"ThreadObservationFreshness": {
"enum": [
"FRESH",
diff --git a/proofline/_generated/models/__init__.py b/proofline/_generated/models/__init__.py
index 1de5de78..d7572b7c 100644
--- a/proofline/_generated/models/__init__.py
+++ b/proofline/_generated/models/__init__.py
@@ -18,6 +18,7 @@
from .change_diagram_kind_view import ChangeDiagramKindView
from .change_diagram_outcome_type_0 import ChangeDiagramOutcomeType0
from .change_diagram_view import ChangeDiagramView
+from .change_summary import ChangeSummary
from .code_assessment_status_type_0 import CodeAssessmentStatusType0
from .comment_address_evaluation_view import CommentAddressEvaluationView
from .comment_address_outcome import CommentAddressOutcome
@@ -52,6 +53,7 @@
from .export_review_status import ExportReviewStatus
from .export_validation import ExportValidation
from .export_validation_source import ExportValidationSource
+from .file_fact import FileFact
from .file_projection import FileProjection
from .file_review_request import FileReviewRequest
from .file_review_response import FileReviewResponse
@@ -107,6 +109,8 @@
from .permission_view import PermissionView
from .plan_projection import PlanProjection
from .problem import Problem
+from .prose import Prose
+from .prose_outcome_type_0 import ProseOutcomeType0
from .pull_request_merge_gate import PullRequestMergeGate
from .reach_gap_view import ReachGapView
from .reach_step_view import ReachStepView
@@ -119,6 +123,7 @@
from .repository_names import RepositoryNames
from .rerun_response import RerunResponse
from .review_actions import ReviewActions
+from .review_depth import ReviewDepth
from .review_diff_stats import ReviewDiffStats
from .review_filters import ReviewFilters
from .review_open_items import ReviewOpenItems
@@ -157,6 +162,9 @@
from .stop_response import StopResponse
from .subject_authorization import SubjectAuthorization
from .subject_view import SubjectView
+from .summary_route import SummaryRoute
+from .terraform_plan_view import TerraformPlanView
+from .terraform_roots_view import TerraformRootsView
from .thread_observation_freshness import ThreadObservationFreshness
from .thread_observation_view import ThreadObservationView
from .thread_provider_state import ThreadProviderState
@@ -182,6 +190,7 @@
"ChangeDiagramKindView",
"ChangeDiagramOutcomeType0",
"ChangeDiagramView",
+ "ChangeSummary",
"CodeAssessmentStatusType0",
"CommentAddressEvaluationView",
"CommentAddressOutcome",
@@ -216,6 +225,7 @@
"ExportReviewStatus",
"ExportValidation",
"ExportValidationSource",
+ "FileFact",
"FileProjection",
"FileReviewRequest",
"FileReviewResponse",
@@ -271,6 +281,8 @@
"PermissionView",
"PlanProjection",
"Problem",
+ "Prose",
+ "ProseOutcomeType0",
"PullRequestMergeGate",
"ReachedEntityView",
"ReachGapView",
@@ -283,6 +295,7 @@
"RepositoryNames",
"RerunResponse",
"ReviewActions",
+ "ReviewDepth",
"ReviewDiffStats",
"ReviewedTreeCitationView",
"ReviewFilters",
@@ -321,6 +334,9 @@
"StopResponse",
"SubjectAuthorization",
"SubjectView",
+ "SummaryRoute",
+ "TerraformPlanView",
+ "TerraformRootsView",
"ThreadObservationFreshness",
"ThreadObservationView",
"ThreadProviderState",
diff --git a/proofline/_generated/models/change_summary.py b/proofline/_generated/models/change_summary.py
new file mode 100644
index 00000000..91f0a3b1
--- /dev/null
+++ b/proofline/_generated/models/change_summary.py
@@ -0,0 +1,289 @@
+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 ..models.prose_outcome_type_0 import ProseOutcomeType0
+from ..models.summary_route import SummaryRoute
+from ..types import UNSET, Unset
+
+if TYPE_CHECKING:
+ from ..models.file_fact import FileFact
+ from ..models.prose import Prose
+
+
+T = TypeVar("T", bound="ChangeSummary")
+
+
+@_attrs_define
+class ChangeSummary:
+ """What a review recorded about its change.
+
+ Attributes:
+ files (list[FileFact]): The changed files the review read, by path, with the depth it read
+ them at. Empty when the review recorded no change digest. Files the
+ review's filters kept from review are listed apart, with their reason.
+ head_sha (str): The reviewed head commit.
+ prose_outcome (Literal['MALFORMED'] | Literal['MODEL_UNAVAILABLE'] | Literal['NO_CHANGE_DIGEST'] |
+ Literal['NOT_REQUESTED'] | Literal['REJECTED'] | Literal['UNGROUNDED'] | ProseOutcomeType0): Why the summary
+ carries prose or does not.
+ base_sha (None | str | Unset): The compared base commit. Null when the review pinned none.
+ prose (None | Prose | Unset): Model-written prose. Present only when `prose_outcome` is `PUBLISHED`.
+ It is untrusted text: render it inert.
+ route (None | SummaryRoute | Unset): The route the summary applied. Null when the review recorded no change
+ digest, so no route was asked.
+ """
+
+ files: list[FileFact]
+ head_sha: str
+ prose_outcome: (
+ Literal["MALFORMED"]
+ | Literal["MODEL_UNAVAILABLE"]
+ | Literal["NO_CHANGE_DIGEST"]
+ | Literal["NOT_REQUESTED"]
+ | Literal["REJECTED"]
+ | Literal["UNGROUNDED"]
+ | ProseOutcomeType0
+ )
+ base_sha: None | str | Unset = UNSET
+ prose: None | Prose | Unset = UNSET
+ route: None | SummaryRoute | Unset = UNSET
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> dict[str, Any]:
+ from ..models.prose import Prose # noqa: PLC0415
+
+ files = []
+ for files_item_data in self.files:
+ files_item = files_item_data.to_dict()
+ files.append(files_item)
+
+ head_sha = self.head_sha
+
+ prose_outcome: (
+ Literal["MALFORMED"]
+ | Literal["MODEL_UNAVAILABLE"]
+ | Literal["NO_CHANGE_DIGEST"]
+ | Literal["NOT_REQUESTED"]
+ | Literal["REJECTED"]
+ | Literal["UNGROUNDED"]
+ | str
+ )
+ if isinstance(self.prose_outcome, ProseOutcomeType0):
+ prose_outcome = self.prose_outcome.value
+ else:
+ prose_outcome = self.prose_outcome
+
+ base_sha: None | str | Unset
+ if isinstance(self.base_sha, Unset):
+ base_sha = UNSET
+ else:
+ base_sha = self.base_sha
+
+ prose: dict[str, Any] | None | Unset
+ if isinstance(self.prose, Unset):
+ prose = UNSET
+ elif isinstance(self.prose, Prose):
+ prose = self.prose.to_dict()
+ else:
+ prose = self.prose
+
+ route: None | str | Unset
+ if isinstance(self.route, Unset):
+ route = UNSET
+ elif isinstance(self.route, SummaryRoute):
+ route = self.route.value
+ else:
+ route = self.route
+
+ field_dict: dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "files": files,
+ "head_sha": head_sha,
+ "prose_outcome": prose_outcome,
+ }
+ )
+ if base_sha is not UNSET:
+ field_dict["base_sha"] = base_sha
+ if prose is not UNSET:
+ field_dict["prose"] = prose
+ if route is not UNSET:
+ field_dict["route"] = route
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
+ from ..models.file_fact import FileFact # noqa: PLC0415
+ from ..models.prose import Prose # noqa: PLC0415
+
+ d = dict(src_dict)
+ files = []
+ _files = d.pop("files")
+ for files_item_data in _files:
+ files_item = FileFact.from_dict(files_item_data)
+
+ files.append(files_item)
+
+ head_sha = d.pop("head_sha")
+
+ def _parse_prose_outcome(
+ data: object,
+ ) -> (
+ Literal["MALFORMED"]
+ | Literal["MODEL_UNAVAILABLE"]
+ | Literal["NO_CHANGE_DIGEST"]
+ | Literal["NOT_REQUESTED"]
+ | Literal["REJECTED"]
+ | Literal["UNGROUNDED"]
+ | ProseOutcomeType0
+ ):
+ try:
+ if not isinstance(data, str):
+ raise TypeError()
+ componentsschemas_prose_outcome_type_0 = ProseOutcomeType0(data)
+
+ return componentsschemas_prose_outcome_type_0
+ except (TypeError, ValueError, AttributeError, KeyError):
+ pass
+ try:
+ if not (type(data) is str and data == "NO_CHANGE_DIGEST"):
+ raise TypeError()
+ componentsschemas_prose_outcome_type_1 = cast(Literal["NO_CHANGE_DIGEST"], data)
+ if componentsschemas_prose_outcome_type_1 != "NO_CHANGE_DIGEST":
+ raise ValueError(
+ f"/components/schemas/ProseOutcome_type_1 must match const 'NO_CHANGE_DIGEST', got '{componentsschemas_prose_outcome_type_1}'"
+ )
+ return componentsschemas_prose_outcome_type_1
+ except (TypeError, ValueError, AttributeError, KeyError):
+ pass
+ try:
+ if not (type(data) is str and data == "NOT_REQUESTED"):
+ raise TypeError()
+ componentsschemas_prose_outcome_type_2 = cast(Literal["NOT_REQUESTED"], data)
+ if componentsschemas_prose_outcome_type_2 != "NOT_REQUESTED":
+ raise ValueError(
+ f"/components/schemas/ProseOutcome_type_2 must match const 'NOT_REQUESTED', got '{componentsschemas_prose_outcome_type_2}'"
+ )
+ return componentsschemas_prose_outcome_type_2
+ except (TypeError, ValueError, AttributeError, KeyError):
+ pass
+ try:
+ if not (type(data) is str and data == "MODEL_UNAVAILABLE"):
+ raise TypeError()
+ componentsschemas_prose_outcome_type_3 = cast(Literal["MODEL_UNAVAILABLE"], data)
+ if componentsschemas_prose_outcome_type_3 != "MODEL_UNAVAILABLE":
+ raise ValueError(
+ f"/components/schemas/ProseOutcome_type_3 must match const 'MODEL_UNAVAILABLE', got '{componentsschemas_prose_outcome_type_3}'"
+ )
+ return componentsschemas_prose_outcome_type_3
+ except (TypeError, ValueError, AttributeError, KeyError):
+ pass
+ try:
+ if not (type(data) is str and data == "MALFORMED"):
+ raise TypeError()
+ componentsschemas_prose_outcome_type_4 = cast(Literal["MALFORMED"], data)
+ if componentsschemas_prose_outcome_type_4 != "MALFORMED":
+ raise ValueError(
+ f"/components/schemas/ProseOutcome_type_4 must match const 'MALFORMED', got '{componentsschemas_prose_outcome_type_4}'"
+ )
+ return componentsschemas_prose_outcome_type_4
+ except (TypeError, ValueError, AttributeError, KeyError):
+ pass
+ try:
+ if not (type(data) is str and data == "REJECTED"):
+ raise TypeError()
+ componentsschemas_prose_outcome_type_5 = cast(Literal["REJECTED"], data)
+ if componentsschemas_prose_outcome_type_5 != "REJECTED":
+ raise ValueError(
+ f"/components/schemas/ProseOutcome_type_5 must match const 'REJECTED', got '{componentsschemas_prose_outcome_type_5}'"
+ )
+ return componentsschemas_prose_outcome_type_5
+ except (TypeError, ValueError, AttributeError, KeyError):
+ pass
+ if not (type(data) is str and data == "UNGROUNDED"):
+ raise TypeError()
+ componentsschemas_prose_outcome_type_6 = cast(Literal["UNGROUNDED"], data)
+ if componentsschemas_prose_outcome_type_6 != "UNGROUNDED":
+ raise ValueError(
+ f"/components/schemas/ProseOutcome_type_6 must match const 'UNGROUNDED', got '{componentsschemas_prose_outcome_type_6}'"
+ )
+ return componentsschemas_prose_outcome_type_6
+
+ prose_outcome = _parse_prose_outcome(d.pop("prose_outcome"))
+
+ def _parse_base_sha(data: object) -> None | str | Unset:
+ if data is None:
+ return data
+ if isinstance(data, Unset):
+ return data
+ return cast(None | str | Unset, data)
+
+ base_sha = _parse_base_sha(d.pop("base_sha", UNSET))
+
+ def _parse_prose(data: object) -> None | Prose | Unset:
+ if data is None:
+ return data
+ if isinstance(data, Unset):
+ return data
+ try:
+ if not isinstance(data, dict):
+ raise TypeError()
+ prose_type_0 = Prose.from_dict(data)
+
+ return prose_type_0
+ except (TypeError, ValueError, AttributeError, KeyError):
+ pass
+ return cast(None | Prose | Unset, data)
+
+ prose = _parse_prose(d.pop("prose", UNSET))
+
+ def _parse_route(data: object) -> None | SummaryRoute | Unset:
+ if data is None:
+ return data
+ if isinstance(data, Unset):
+ return data
+ try:
+ if not isinstance(data, str):
+ raise TypeError()
+ route_type_0 = SummaryRoute(data)
+
+ return route_type_0
+ except (TypeError, ValueError, AttributeError, KeyError):
+ pass
+ return cast(None | SummaryRoute | Unset, data)
+
+ route = _parse_route(d.pop("route", UNSET))
+
+ change_summary = cls(
+ files=files,
+ head_sha=head_sha,
+ prose_outcome=prose_outcome,
+ base_sha=base_sha,
+ prose=prose,
+ route=route,
+ )
+
+ change_summary.additional_properties = d
+ return change_summary
+
+ @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_review_detail.py b/proofline/_generated/models/customer_review_detail.py
index 529dd201..725a2053 100644
--- a/proofline/_generated/models/customer_review_detail.py
+++ b/proofline/_generated/models/customer_review_detail.py
@@ -14,6 +14,7 @@
if TYPE_CHECKING:
from ..models.actor_view import ActorView
from ..models.change_diagram_view import ChangeDiagramView
+ from ..models.change_summary import ChangeSummary
from ..models.customer_assessment import CustomerAssessment
from ..models.customer_code_assessment import CustomerCodeAssessment
from ..models.deep_review_escalation import DeepReviewEscalation
@@ -75,6 +76,12 @@ class CustomerReviewDetail:
pinned code
index and the relations World declares. Absent when the review
recorded none.
+ change_summary (ChangeSummary | None | Unset): What the change does and which files the review read at which
+ depth
+ (§55). Null until the review's publication records it, and for a
+ review that is not of a pull request. Generated text has current
+ credentials and recorded protected values withheld; missing or expired
+ provenance withholds the generated text whole.
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
@@ -188,6 +195,7 @@ class CustomerReviewDetail:
base_commit_url: None | str | Unset = UNSET
base_ref: None | str | Unset = UNSET
change_diagram: ChangeDiagramView | None | Unset = UNSET
+ change_summary: ChangeSummary | None | Unset = UNSET
check_run_url: None | str | Unset = UNSET
code_assessment: CustomerCodeAssessment | None | Unset = UNSET
compare_url: None | str | Unset = UNSET
@@ -230,6 +238,7 @@ 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.change_summary import ChangeSummary # 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
@@ -309,6 +318,14 @@ def to_dict(self) -> dict[str, Any]:
else:
change_diagram = self.change_diagram
+ change_summary: dict[str, Any] | None | Unset
+ if isinstance(self.change_summary, Unset):
+ change_summary = UNSET
+ elif isinstance(self.change_summary, ChangeSummary):
+ change_summary = self.change_summary.to_dict()
+ else:
+ change_summary = self.change_summary
+
check_run_url: None | str | Unset
if isinstance(self.check_run_url, Unset):
check_run_url = UNSET
@@ -593,6 +610,8 @@ def to_dict(self) -> dict[str, Any]:
field_dict["base_ref"] = base_ref
if change_diagram is not UNSET:
field_dict["change_diagram"] = change_diagram
+ if change_summary is not UNSET:
+ field_dict["change_summary"] = change_summary
if check_run_url is not UNSET:
field_dict["check_run_url"] = check_run_url
if code_assessment is not UNSET:
@@ -674,6 +693,7 @@ def to_dict(self) -> dict[str, Any]:
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.change_summary import ChangeSummary # 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
@@ -788,6 +808,23 @@ def _parse_change_diagram(data: object) -> ChangeDiagramView | None | Unset:
change_diagram = _parse_change_diagram(d.pop("change_diagram", UNSET))
+ def _parse_change_summary(data: object) -> ChangeSummary | None | Unset:
+ if data is None:
+ return data
+ if isinstance(data, Unset):
+ return data
+ try:
+ if not isinstance(data, dict):
+ raise TypeError()
+ change_summary_type_0 = ChangeSummary.from_dict(data)
+
+ return change_summary_type_0
+ except (TypeError, ValueError, AttributeError, KeyError):
+ pass
+ return cast(ChangeSummary | None | Unset, data)
+
+ change_summary = _parse_change_summary(d.pop("change_summary", UNSET))
+
def _parse_check_run_url(data: object) -> None | str | Unset:
if data is None:
return data
@@ -1280,6 +1317,7 @@ def _parse_trigger_source(data: object) -> None | PatchTriggerSource | Unset:
base_commit_url=base_commit_url,
base_ref=base_ref,
change_diagram=change_diagram,
+ change_summary=change_summary,
check_run_url=check_run_url,
code_assessment=code_assessment,
compare_url=compare_url,
diff --git a/proofline/_generated/models/declared_reach_view.py b/proofline/_generated/models/declared_reach_view.py
index 99bb308e..e211a035 100644
--- a/proofline/_generated/models/declared_reach_view.py
+++ b/proofline/_generated/models/declared_reach_view.py
@@ -13,6 +13,7 @@
if TYPE_CHECKING:
from ..models.reach_gap_view import ReachGapView
from ..models.reached_entity_view import ReachedEntityView
+ from ..models.terraform_roots_view import TerraformRootsView
T = TypeVar("T", bound="DeclaredReachView")
@@ -32,6 +33,10 @@ class DeclaredReachView:
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`.
+ terraform (None | TerraformRootsView | Unset): The Terraform addresses the reach also started from, or why it
+ took
+ none. Absent when the assessment read reach only from the deployed
+ revision.
"""
complete: bool
@@ -40,9 +45,12 @@ class DeclaredReachView:
outcome: DeclaredReachOutcome
receipt_digest: None | str | Unset = UNSET
snapshot_id: None | Unset | UUID = UNSET
+ terraform: None | TerraformRootsView | Unset = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
+ from ..models.terraform_roots_view import TerraformRootsView # noqa: PLC0415
+
complete = self.complete
entities = []
@@ -71,6 +79,14 @@ def to_dict(self) -> dict[str, Any]:
else:
snapshot_id = self.snapshot_id
+ terraform: dict[str, Any] | None | Unset
+ if isinstance(self.terraform, Unset):
+ terraform = UNSET
+ elif isinstance(self.terraform, TerraformRootsView):
+ terraform = self.terraform.to_dict()
+ else:
+ terraform = self.terraform
+
field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
@@ -85,6 +101,8 @@ def to_dict(self) -> dict[str, Any]:
field_dict["receipt_digest"] = receipt_digest
if snapshot_id is not UNSET:
field_dict["snapshot_id"] = snapshot_id
+ if terraform is not UNSET:
+ field_dict["terraform"] = terraform
return field_dict
@@ -92,6 +110,7 @@ def to_dict(self) -> dict[str, Any]:
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
+ from ..models.terraform_roots_view import TerraformRootsView # noqa: PLC0415
d = dict(src_dict)
complete = d.pop("complete")
@@ -138,6 +157,23 @@ def _parse_snapshot_id(data: object) -> None | Unset | UUID:
snapshot_id = _parse_snapshot_id(d.pop("snapshot_id", UNSET))
+ def _parse_terraform(data: object) -> None | TerraformRootsView | Unset:
+ if data is None:
+ return data
+ if isinstance(data, Unset):
+ return data
+ try:
+ if not isinstance(data, dict):
+ raise TypeError()
+ terraform_type_0 = TerraformRootsView.from_dict(data)
+
+ return terraform_type_0
+ except (TypeError, ValueError, AttributeError, KeyError):
+ pass
+ return cast(None | TerraformRootsView | Unset, data)
+
+ terraform = _parse_terraform(d.pop("terraform", UNSET))
+
declared_reach_view = cls(
complete=complete,
entities=entities,
@@ -145,6 +181,7 @@ def _parse_snapshot_id(data: object) -> None | Unset | UUID:
outcome=outcome,
receipt_digest=receipt_digest,
snapshot_id=snapshot_id,
+ terraform=terraform,
)
declared_reach_view.additional_properties = d
diff --git a/proofline/_generated/models/file_fact.py b/proofline/_generated/models/file_fact.py
new file mode 100644
index 00000000..6ed28054
--- /dev/null
+++ b/proofline/_generated/models/file_fact.py
@@ -0,0 +1,116 @@
+from __future__ import annotations
+
+from collections.abc import Mapping
+from typing import Any, TypeVar, cast
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+from ..models.review_depth import ReviewDepth
+from ..types import UNSET, Unset
+
+T = TypeVar("T", bound="FileFact")
+
+
+@_attrs_define
+class FileFact:
+ """
+ Attributes:
+ additions (int): Lines added in this file's recorded diff.
+ deletions (int): Lines deleted in this file's recorded diff.
+ depth (ReviewDepth): The depth the applied route plan read a file at.
+ path (str): The repository-relative path of the changed file.
+ status (str): GitHub's file status: `added`, `modified`, `removed`, `renamed` and so on.
+ previous_path (None | str | Unset): The path before a rename.
+ """
+
+ additions: int
+ deletions: int
+ depth: ReviewDepth
+ path: str
+ status: str
+ previous_path: None | str | Unset = UNSET
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> dict[str, Any]:
+ additions = self.additions
+
+ deletions = self.deletions
+
+ depth = self.depth.value
+
+ path = self.path
+
+ status = self.status
+
+ previous_path: None | str | Unset
+ if isinstance(self.previous_path, Unset):
+ previous_path = UNSET
+ else:
+ previous_path = self.previous_path
+
+ field_dict: dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "additions": additions,
+ "deletions": deletions,
+ "depth": depth,
+ "path": path,
+ "status": status,
+ }
+ )
+ if previous_path is not UNSET:
+ field_dict["previous_path"] = previous_path
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
+ d = dict(src_dict)
+ additions = d.pop("additions")
+
+ deletions = d.pop("deletions")
+
+ depth = ReviewDepth(d.pop("depth"))
+
+ path = d.pop("path")
+
+ status = d.pop("status")
+
+ def _parse_previous_path(data: object) -> None | str | Unset:
+ if data is None:
+ return data
+ if isinstance(data, Unset):
+ return data
+ return cast(None | str | Unset, data)
+
+ previous_path = _parse_previous_path(d.pop("previous_path", UNSET))
+
+ file_fact = cls(
+ additions=additions,
+ deletions=deletions,
+ depth=depth,
+ path=path,
+ status=status,
+ previous_path=previous_path,
+ )
+
+ file_fact.additional_properties = d
+ return file_fact
+
+ @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/prose.py b/proofline/_generated/models/prose.py
new file mode 100644
index 00000000..ca78168e
--- /dev/null
+++ b/proofline/_generated/models/prose.py
@@ -0,0 +1,77 @@
+from __future__ import annotations
+
+from collections.abc import Mapping
+from typing import Any, TypeVar, cast
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+T = TypeVar("T", bound="Prose")
+
+
+@_attrs_define
+class Prose:
+ """
+ Attributes:
+ headline (str): At most 120 characters.
+ notable_paths (list[str]): Paths in the pinned diff the prose calls out.
+ paragraphs (list[str]): At most three of at most 400 characters; one on the `SHORT` route.
+ """
+
+ headline: str
+ notable_paths: list[str]
+ paragraphs: list[str]
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> dict[str, Any]:
+ headline = self.headline
+
+ notable_paths = self.notable_paths
+
+ paragraphs = self.paragraphs
+
+ field_dict: dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "headline": headline,
+ "notable_paths": notable_paths,
+ "paragraphs": paragraphs,
+ }
+ )
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
+ d = dict(src_dict)
+ headline = d.pop("headline")
+
+ notable_paths = cast(list[str], d.pop("notable_paths"))
+
+ paragraphs = cast(list[str], d.pop("paragraphs"))
+
+ prose = cls(
+ headline=headline,
+ notable_paths=notable_paths,
+ paragraphs=paragraphs,
+ )
+
+ prose.additional_properties = d
+ return prose
+
+ @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/prose_outcome_type_0.py b/proofline/_generated/models/prose_outcome_type_0.py
new file mode 100644
index 00000000..0c82fad1
--- /dev/null
+++ b/proofline/_generated/models/prose_outcome_type_0.py
@@ -0,0 +1,8 @@
+from enum import StrEnum
+
+
+class ProseOutcomeType0(StrEnum):
+ PUBLISHED = "PUBLISHED"
+
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/proofline/_generated/models/review_depth.py b/proofline/_generated/models/review_depth.py
new file mode 100644
index 00000000..4bb855db
--- /dev/null
+++ b/proofline/_generated/models/review_depth.py
@@ -0,0 +1,8 @@
+from enum import StrEnum
+
+
+class ReviewDepth(StrEnum):
+ STANDARD = "STANDARD"
+
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/proofline/_generated/models/summary_route.py b/proofline/_generated/models/summary_route.py
new file mode 100644
index 00000000..b2517b88
--- /dev/null
+++ b/proofline/_generated/models/summary_route.py
@@ -0,0 +1,10 @@
+from enum import StrEnum
+
+
+class SummaryRoute(StrEnum):
+ DETERMINISTIC_ONLY = "DETERMINISTIC_ONLY"
+ FULL = "FULL"
+ SHORT = "SHORT"
+
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/proofline/_generated/models/terraform_plan_view.py b/proofline/_generated/models/terraform_plan_view.py
new file mode 100644
index 00000000..24cf8f61
--- /dev/null
+++ b/proofline/_generated/models/terraform_plan_view.py
@@ -0,0 +1,12 @@
+from enum import StrEnum
+
+
+class TerraformPlanView(StrEnum):
+ ADDRESSES_UNREPORTED = "ADDRESSES_UNREPORTED"
+ HEAD_DIFFERS = "HEAD_DIFFERS"
+ NOT_DECLARED = "NOT_DECLARED"
+ NOT_PINNED = "NOT_PINNED"
+ TAKEN = "TAKEN"
+
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/proofline/_generated/models/terraform_roots_view.py b/proofline/_generated/models/terraform_roots_view.py
new file mode 100644
index 00000000..2ef0ccc9
--- /dev/null
+++ b/proofline/_generated/models/terraform_roots_view.py
@@ -0,0 +1,80 @@
+from __future__ import annotations
+
+from collections.abc import Mapping
+from typing import Any, TypeVar, cast
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+from ..models.terraform_plan_view import TerraformPlanView
+
+T = TypeVar("T", bound="TerraformRootsView")
+
+
+@_attrs_define
+class TerraformRootsView:
+ """The Terraform roots of one declared reach read.
+
+ Attributes:
+ addresses (list[str]): The changed resource instance addresses taken as roots.
+ omitted (int): Changed addresses left out at World's limit of 100 roots per read.
+ plan (TerraformPlanView):
+ """
+
+ addresses: list[str]
+ omitted: int
+ plan: TerraformPlanView
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> dict[str, Any]:
+ addresses = self.addresses
+
+ omitted = self.omitted
+
+ plan = self.plan.value
+
+ field_dict: dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "addresses": addresses,
+ "omitted": omitted,
+ "plan": plan,
+ }
+ )
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
+ d = dict(src_dict)
+ addresses = cast(list[str], d.pop("addresses"))
+
+ omitted = d.pop("omitted")
+
+ plan = TerraformPlanView(d.pop("plan"))
+
+ terraform_roots_view = cls(
+ addresses=addresses,
+ omitted=omitted,
+ plan=plan,
+ )
+
+ terraform_roots_view.additional_properties = d
+ return terraform_roots_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/tests/test_http.py b/tests/test_http.py
index 185bf36a..2a2287da 100644
--- a/tests/test_http.py
+++ b/tests/test_http.py
@@ -42,6 +42,7 @@
StopResponse,
_sync_http,
_transport,
+ models,
)
from proofline import client as client_module
from proofline._generated.models.finding_fix_prompt_type_0 import FindingFixPromptType0
@@ -113,7 +114,13 @@ async def async_sleep(self, delay: float) -> None:
@MODES
-async def test_all_public_operations_use_generated_models_and_scoped_paths(mode: str) -> None:
+@pytest.mark.parametrize(
+ "terraform",
+ [UNSET, None, {"plan": "TAKEN", "addresses": ["aws_s3_bucket.synthetic"], "omitted": 1}],
+)
+async def test_all_public_operations_use_generated_models_and_scoped_paths(
+ mode: str, terraform: Any
+) -> None:
prefix = f"/api/v1/organizations/{ORG}"
paths = [
("GET", f"{prefix}/reviews", page(), ReviewPage),
@@ -192,6 +199,19 @@ async def test_all_public_operations_use_generated_models_and_scoped_paths(mode:
),
]
+ for _, _, body, response_model in paths:
+ if response_model is CustomerReviewDetail:
+ assessments = body["assessments"]
+ elif response_model is CustomerAssessmentDetail:
+ assessments = [body]
+ else:
+ continue
+ for entry in assessments:
+ reach = {"complete": True, "entities": [], "gaps": [], "outcome": "READ"}
+ if terraform is not UNSET:
+ reach["terraform"] = terraform
+ entry["declared_reach"] = reach
+
def respond(request: Request, index: int) -> Reply:
method, path, body, _ = paths[index]
assert request.method == method
@@ -223,6 +243,19 @@ def respond(request: Request, index: int) -> Reply:
for index, (name, args, kwargs) in enumerate(calls):
result = await call(client, name, *args, **kwargs)
assert isinstance(result, paths[index][3])
+ if isinstance(result, (CustomerReviewDetail, CustomerAssessmentDetail)):
+ entries = (
+ result.assessments if isinstance(result, CustomerReviewDetail) else [result]
+ )
+ for entry in entries:
+ roots = entry.declared_reach.terraform
+ if isinstance(terraform, dict):
+ assert isinstance(roots, models.TerraformRootsView)
+ assert roots.plan is models.TerraformPlanView.TAKEN
+ assert roots.addresses == ["aws_s3_bucket.synthetic"]
+ assert roots.omitted == 1
+ else:
+ assert roots is terraform
if isinstance(result, CustomerFinding):
assert result.rule_refs[0].key == "no-sync-io-in-handlers"
revision = result.rule_refs[0].revisions[0]
@@ -358,6 +391,87 @@ def respond(request: Request, index: int) -> Reply:
assert len(server.requests) == 1
+@MODES
+@pytest.mark.parametrize("summary_state", ["absent", "null", "published", "withheld"])
+async def test_review_reads_preserve_summary_and_exact_code_identity(
+ mode: str, summary_state: str
+) -> None:
+ body = review()
+ body.update(head_commit_sha="a" * 40, base_commit_sha="b" * 40)
+ if summary_state != "absent":
+ body["change_summary"] = (
+ None
+ if summary_state == "null"
+ else {
+ "head_sha": "a" * 40,
+ "base_sha": "b" * 40,
+ "files": [
+ {
+ "path": "src/new.py",
+ "previous_path": "src/old.py",
+ "status": "renamed",
+ "additions": 3,
+ "deletions": 1,
+ "depth": "STANDARD",
+ }
+ ],
+ "route": "SHORT",
+ "prose_outcome": "PUBLISHED",
+ "prose": None
+ if summary_state == "withheld"
+ else {
+ "headline": "[withheld] ",
+ "paragraphs": ["Moves the request handler."],
+ "notable_paths": ["src/new.py"],
+ },
+ }
+ )
+
+ def respond(request: Request, index: int) -> Reply:
+ assert request.method == "GET"
+ assert request.headers["Authorization"] == f"Bearer {TOKEN}"
+ return Reply(body=body)
+
+ with Server(respond) as server:
+ async with session(mode, server.url) as client:
+ for operation, args in [
+ ("get_review", (ORG, REVIEW)),
+ ("get_pull_request_review", (ORG, "repo/name", 42, 3)),
+ ("get_deployment_review", (ORG, "deployment")),
+ ]:
+ result = await call(client, operation, *args)
+ assert result.publication == "WITHHELD"
+ assert result.head_commit_sha == "a" * 40
+ assert result.base_commit_sha == "b" * 40
+ summary = result.change_summary
+ if summary_state in {"absent", "null"}:
+ assert summary is (UNSET if summary_state == "absent" else None)
+ continue
+ assert isinstance(summary, models.ChangeSummary)
+ assert (summary.head_sha, summary.base_sha) == ("a" * 40, "b" * 40)
+ assert summary.route is models.SummaryRoute.SHORT
+ assert summary.prose_outcome == "PUBLISHED"
+ assert len(summary.files) == 1
+ file = summary.files[0]
+ assert (file.path, file.previous_path, file.status) == (
+ "src/new.py",
+ "src/old.py",
+ "renamed",
+ )
+ assert (file.additions, file.deletions, file.depth) == (
+ 3,
+ 1,
+ models.ReviewDepth.STANDARD,
+ )
+ if summary_state == "withheld":
+ assert summary.prose is None
+ else:
+ assert isinstance(summary.prose, models.Prose)
+ assert summary.prose.headline == "[withheld] "
+ assert summary.prose.paragraphs == ["Moves the request handler."]
+ assert summary.prose.notable_paths == ["src/new.py"]
+
+
@MODES
@pytest.mark.parametrize("status", [401, 403, 404])
async def test_authority_problems_do_not_retry_or_disclose_secrets(