Skip to content

feat(prinfo): promote prinfo to a public package - #3381

Merged
jiparis merged 3 commits into
chainloop-dev:mainfrom
jiparis:jiparis/pfm-7070-make-prinfo-public
Aug 28, 2026
Merged

feat(prinfo): promote prinfo to a public package#3381
jiparis merged 3 commits into
chainloop-dev:mainfrom
jiparis:jiparis/pfm-7070-make-prinfo-public

Conversation

@jiparis

@jiparisjiparis commented Aug 27, 2026

Copy link
Copy Markdown
Member

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_0Version1_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 (300adaf). 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.

Review in cubic

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
@chainloop-platform

chainloop-platformBot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

AI Session Checks — 🟡 83% · ✅ 0 failing

Avg scoreSessionsFailing policiesAttributionFilesLinesTotal Duration
🟡 83%1✅ 0100% AI / 0% Human29+1443 / -12315h38m21s

🟡 83% — 100% AI — ✅ All policies passing

Aug 27, 2026 15:57 UTC · 5h38m21s · $11.57 · 248 in / 59.2k out · claude-code 2.1.247 (claude-opus-5)

View session details ↗

Change Summary

  • Promotes internal/prinfo to public pkg/prinfo and exports schema/version APIs for platform consumers.
  • Moves published pr-info schemas and testdata into pkg/prinfo, updates validators and crafters, and adds schema regression tests.
  • Fixes schema-generation safety by restoring published behavior and requiring --version before regenerating schemas.

AI Session Overall Score

🟡 83% — Well-verified implementation, but a planning gap and one corrected overclaim keep this yellow.

AI Session Analysis Breakdown

🟢 90% · scope-discipline

🟢 Touched files stayed inside the prinfo promotion, call-site updates, tests, and review fix. · High Impact

🟢 90% · verification

🟢 AI exercised generate.go across failure and success paths before committing the review fix. · High Impact

🟢 88% · user-trust-signal

No notes.

🟢 86% · solution-quality

🟢 AI traced schema drift to the generator path and fixed the corruption source. · High Impact

🟡 72% · alignment

🟠 AI said published schemas were immutable, but review showed generate.go still rewrote 1.3 by default. · Medium Severity

💡 Before stating an invariant, exercise the unsafe path once so the summary matches the actual guardrails.

🟡 68% · context-and-planning

🟠 This multi-package public API move started without a written plan, TODO list, or shared step breakdown. · Medium Severity

💡 For multi-package moves, write a short shared plan before editing so scope and checkpoints stay explicit.


File Attribution

████████████████████ 100% AI / 0% Human

StatusAttributionFileLines
deletedaiinternal/prinfo/prinfo_test.go+0 / -440
createdaipkg/prinfo/prinfo_test.go+438 / -0
createdaipkg/prinfo/schema_test.go+201 / -0
deletedaiinternal/schemavalidators/internal_schemas/prinfo/pr-info-1.3.schema.json+0 / -133
createdaipkg/prinfo/schemas/pr-info-1.3.schema.json+133 / -0
createdaipkg/prinfo/schema.go+130 / -0
deletedaiinternal/schemavalidators/internal_schemas/prinfo/pr-info-1.2.schema.json+0 / -124
deletedaiinternal/prinfo/prinfo.go+0 / -117
createdaipkg/prinfo/prinfo.go+117 / -0
createdaipkg/prinfo/schemas/pr-info-1.2.schema.json+104 / -0
deletedaiinternal/schemavalidators/internal_schemas/prinfo/pr-info-1.1.schema.json+0 / -88
createdaipkg/prinfo/schemas/pr-info-1.1.schema.json+88 / -0
modifiedaipkg/prinfo/schemas/generate.go+69 / -7
modifiedaiinternal/schemavalidators/schemavalidators.go+0 / -71
deletedaiinternal/prinfo/generator.go+0 / -69
createdaipkg/prinfo/generator.go+69 / -0
deletedaiinternal/schemavalidators/internal_schemas/prinfo/pr-info-1.0.schema.json+0 / -61
createdaipkg/prinfo/schemas/pr-info-1.0.schema.json+61 / -0
deletedaiinternal/prinfo/schemas/generate.go+0 / -45
modifiedaiinternal/schemavalidators/schemavalidators_test.go+0 / -41
deletedaiinternal/schemavalidators/testdata/pr_info_valid.json+0 / -21
createdaipkg/prinfo/testdata/pr_info_valid.json+21 / -0
modifiedaipkg/attestation/crafter/materials/chainloop_pr_info_test.go+4 / -5
modifiedaipkg/attestation/crafter/materials/chainloop_pr_info.go+2 / -3
deletedaiinternal/schemavalidators/testdata/pr_info_missing_required.json+0 / -3

…and 4 more file(s).


Policies (4)

StatusPolicyMaterialMessages
✅ Passedai-config-ai-agents-allowedai-coding-session-1fcad8-
✅ Passedai-config-no-dangerous-commandsai-coding-session-1fcad8-
✅ Passedai-config-no-secretsai-coding-session-1fcad8-
✅ Passedai-config-mcp-servers-allowedai-coding-session-1fcad8-

Security Checks — evaluating

Policies are still being evaluated. Results will update once available.

iac-scan

⏭️ 2 scans not applied

ScanReason
vulnerability-scanno manifest/lockfile changed
github-actions-scanno workflow files changed

Powered by Chainloop and Chainloop Trace

@cubic-dev-aicubic-dev-aiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 19 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment threadpkg/prinfo/schemas/generate.go Outdated
@jiparis
jiparis requested a review from a teamAugust 27, 2026 17:12
migmartri
migmartri previously approved these changes Aug 27, 2026
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
@jiparis
jiparis merged commit 28d5c7d into chainloop-dev:mainAug 28, 2026
17 checks passed
@jiparis
jiparis deleted the jiparis/pfm-7070-make-prinfo-public branch August 28, 2026 10:11
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@jiparis@migmartri@javirln