Repository navigation
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: smith-xyz The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
PR Summary by QodoAdd typed artifact loading and decoding to the Go SDK
AI Description
Diagram
High-Level Assessment
Files changed (14)
|
Code Review by Qodo
1. Report page shows success on core outage
|
- ade2385a (Artifact reads fail without a Content-Length): findings.Get sizes the object from the bytes it reads — a proxy may serve content chunked and Go's transport drops the header when it decompresses — instead of refusing a body no length header describes. - f97b86d8 (Null reports appear successfully decoded): findings.Decode refuses a null body, as the SDK's response decoder already does, so a null report never reads as an empty one. - d706ac24 (A report that fails to decode breaks its whole page): the example app's artifact page renders the evidence it already holds and says why the report is missing, instead of failing wholesale. Changed tests: TestGetReadsTheArtifactsHeadersAndBody — its comment no longer promises the size comes from the headers (comment only, no assertion changed).
…inds core#555's Qodo fixes add the validation-recording and report-input companion kinds; the kind enum and the generated kind map follow.
|
Code review by qodo was updated up to the latest commit a964933 |
What
The SDK's typed artifact loader, on core's P6 (traust-core#555). Stacked on #92; pins core at P6's head
bc3e0901until #555 merges (merge commits keep the SHA).traust.ReportArtifact,traust.TriageArtifact, …),ArtifactKind(67),ArtifactView— from core's OpenAPI only.findings, where core's artifact routes map):Getreads kind, digest, media type and size from core's content headers, refusing a missing or unknownTraust-Artifact-Kind(ErrUnknownKind);Decode[T]uses a generated type → kind map (kinds.gen.go, emitted fromx-traust-artifact-kind). Diffs, SBOMs and feeds are read fromBody.skip-prunekeeps the components;normalize.pygains three 3.1→3.0 rewrites (typearrays,const, droppingif/then/else— without the last, oapi-codegen silently renders 35 documents asinterface{}), and namespaces the artifact enums so adding schemas never renames an existing API constant.Decodeand serves content under its real media type (the uri-extension guessing is deleted).API surface
Against #92's
client.gen.go: 1,067 identifiers added, 1 removed —type Artifact, core's intended rename toArtifactView(P6, labelledapi-breaking).Tests
findings/artifacts_test.go: headers →Object; missing/unknown kind refused;Decodea report; kind mismatch; non-JSON refused; a diff's raw body.findings/kinds_test.go: the generated map covers every generated*Artifacttype, and nothing else.make lint test guardrails lean,make -C go check-drift,make -C go securitygreen. The box e2e waits for the box's move out of the SDK.Tracker
XWING-3510