feat(prinfo): promote prinfo to a public package

Merged
JI
2mo ago
+414-202

Summary

internal/prinfo held the CHAINLOOP_PR_INFO types, and internal/schemavalidators held 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/prinfo and moves the pr-info JSON schemas alongside the types.

Public API

  • The existing types: Evidence, Data, Author, Reviewer, NewEvidence, EvidenceID, EvidenceSchemaURL.
  • Version with Version1_0…Version1_3, LatestVersion and Versions().
  • 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 to LatestVersion.

PRInfoVersion* and ValidatePRInfo are removed from internal/schemavalidators, so the versions are declared in a single place.

Schema 1.2 fix

pr-info-1.2.schema.json had been silently regenerated from a later revision of the Data struct by a stale //go:generate directive, in an unrelated commit (300adaf6). The published 1.2 schema therefore required the object-form author that 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:generate directive 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/object author union, which the reflector cannot express.

AI disclosure

This contribution was produced with the assistance of Claude Code.