Uh oh!
There was an error while loading. Please reload this page.
feat(prinfo): promote prinfo to a public package - #3381
Conversation
Move internal/prinfo to pkg/prinfo so consumers outside this module can use the CHAINLOOP_PR_INFO types instead of hand-copying them. The pr-info JSON schemas move alongside the types, and the package now exposes the schema versions, the canonical schema URLs, the raw schema documents and a Validate function. The PRInfoVersion constants and ValidatePRInfo are removed from internal/schemavalidators so the versions are declared in a single place. Also restores pr-info-1.2.schema.json, which a stale //go:generate directive had silently regenerated from a later revision of the Data struct, making the published 1.2 schema require the object-form author introduced in 1.3. The directive is removed: published schemas are immutable and the generator is now a manual scaffold for cutting a new version. Assisted-by: Claude Code Signed-off-by: Jose I. Paris <jiparis@chainloop.dev> Chainloop-Trace-Sessions: 1fcad8c1-fedc-4783-aece-b4fbb6966acc
AI Session Checks — 🟡 83% · ✅ 0 failing
|
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed | ai-coding-session-1fcad8 | - |
| ✅ Passed | ai-config-no-dangerous-commands | ai-coding-session-1fcad8 | - |
| ✅ Passed | ai-config-no-secrets | ai-coding-session-1fcad8 | - |
| ✅ Passed | ai-config-mcp-servers-allowed | ai-coding-session-1fcad8 | - |
Security Checks — evaluating
Policies are still being evaluated. Results will update once available.
iac-scan
⏭️ 2 scans not applied
| Scan | Reason |
|---|---|
vulnerability-scan | no manifest/lockfile changed |
github-actions-scan | no workflow files changed |
Powered by Chainloop and Chainloop Trace
There was a problem hiding this comment.
All reported issues were addressed across 19 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
The generator defaulted to LatestVersion, so running it with no arguments overwrote the published 1.3 schema from the current Data struct, dropping the hand-written string/object author union. That is the same corruption this branch repairs for 1.2, reachable by simply running the tool. --version is now required, and a version that is already embedded is refused unless --force is passed. Assisted-by: Claude Code Signed-off-by: Jose I. Paris <jiparis@chainloop.dev> Chainloop-Trace-Sessions: 1fcad8c1-fedc-4783-aece-b4fbb6966acc
Uh oh!
There was an error while loading. Please reload this page.
Summary
internal/prinfoheld theCHAINLOOP_PR_INFOtypes, andinternal/schemavalidatorsheld the pr-info JSON schemas and their version constants. Go's internal-package rule makes both unimportable from other modules, so consumers had no option but to hand-copy the material shape and the schema id.This promotes the package to
pkg/prinfoand moves the pr-info JSON schemas alongside the types.Public API
Evidence,Data,Author,Reviewer,NewEvidence,EvidenceID,EvidenceSchemaURL.VersionwithVersion1_0…Version1_3,LatestVersionandVersions().SchemaURL(Version)— the canonical published schema id.Schema(Version)— the raw schema document, so consumers can validate against the canonical schema instead of vendoring a copy.Validate(data, version)— an empty version defaults toLatestVersion.PRInfoVersion*andValidatePRInfoare removed frominternal/schemavalidators, so the versions are declared in a single place.Schema 1.2 fix
pr-info-1.2.schema.jsonhad been silently regenerated from a later revision of theDatastruct by a stale//go:generatedirective, in an unrelated commit (300adaf). The published 1.2 schema therefore required the object-formauthorthat was only introduced in 1.3, and rejected the string-form payloads it had been published to accept.The schema is restored to its intended content, and the
//go:generatedirective is removed: published schemas are immutable, and the generator becomes a manual scaffold for cutting a new version. Regenerating 1.3 would likewise have dropped its hand-written string/objectauthorunion, which the reflector cannot express.AI disclosure
This contribution was produced with the assistance of Claude Code.