Skip to content

feat(prinfo): add the PR/MR state in schema 1.4 - #3748

Closed
jiparis wants to merge 1 commit into
chainloop-dev:mainfrom
jiparis:jiparis/pfm-8051-prinfo-state
Closed

jiparis wants to merge 1 commit into
chainloop-dev:mainfrom
jiparis:jiparis/pfm-8051-prinfo-state

Conversation

@jiparis

@jiparis jiparis commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

The PR/MR info material (CHAINLOOP_PR_INFO) does not record if the PR/MR is open, closed or merged. Policies cannot evaluate a rule only for merged PRs/MRs. For example, pr-min-approvals fails for each open PR that does not have its approvals yet.

This change adds the PR/MR info schema 1.4 with an optional state field (open, closed, merged). The 1.4 schema is the 1.3 schema with this one new field, so it keeps both forms of author. The CLI does not set state. The Chainloop platform sets it in its PR validation runs.

Refs PFM-8051.

AI disclosure: Claude Code helped to write this change.

View guided diff

Add an optional state field (open, closed, merged) to the PR/MR info
material. Policies can use it to evaluate a rule only when the PR/MR is
merged, for example the minimum number of approvals.

Refs: PFM-8051

Assisted-by: Claude Code
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>

Chainloop-Trace-Sessions: 6ef5e9f5-dc0c-45cf-8b3f-70d112a87b7e
@chainloop-platform

chainloop-platform Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ⚠️ 1 failing

Status Policy Material Messages
⚠️ Failed pr-min-approvals pr-info PR/MR #3748 has 0 approving reviews, 1 required.
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — 🟢 88% · ⚠️ 2 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 88% 1 ⚠️ 2 100% AI / 0% Human 2 +55 / -4 8h27m40s

🟢 88% — 100% AI — ⚠️ 2 policies failing

Oct 28, 2026 09:50 UTC · 8h27m40s · $91.54 · 1.8k in / 702.0k out · claude-code 2.1.312 (claude-opus-5-5)

View session details ↗

Change Summary

  • Adds PR state to the pr-info material in buildPRInfoBody and ReadPRInfo
  • Maps SCM statuses to open, closed, or merged, with draft treated as open
  • Updates biz tests and schema assertions for pr-info 1.4 state handling

AI Session Overall Score

🟢 88% — Strong, focused change; only missing user confirmation keeps verification below green.

AI Session Analysis Breakdown

🟢 96% · scope-discipline

No notes.

🟢 94% · solution-quality

🟢 State is added at material generation, not patched downstream. · High Impact

🟢 92% · alignment

No notes.

🟢 88% · user-trust-signal

No notes.

🟢 86% · context-and-planning

🟢 AI asked three policy questions before touching code. · High Impact

🟡 78% · verification

🟢 The targeted biz tests failed once, then passed after the fix. · High Impact

🟠 Targeted biz tests passed after a fix, but the user never confirmed the merged-only behavior. · Medium Severity

💡 Ask for a quick semantic confirmation after the green run when the user is present.


File Attribution

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

Status Attribution File Lines
modified ai backend/internal/biz/pr_validation_test.go +37 / -4
modified ai backend/internal/biz/pr_validation.go +18 / -0

Policies (4, 2 failing)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-6ef5e9 -
⚠️ Failed ai-config-no-dangerous-commands ai-coding-session-6ef5e9
  • Forbidden bash pattern /curl[^|\n]\|\s(?:bash|sh)\b/ matched command: cd /Users/jiparis/projects/chainloop/.github/workflows && python3 -I - <<'EOF' CL_OLD = " run: |\n curl -sfL https://dl.chainloop.dev/cli/instal...
  • Forbidden bash pattern /wget[^|\n]\|\s(?:bash|sh)\b/ matched command: cd /Users/jiparis/projects/chainloop/.github/workflows && python3 -I - <<'EOF' CL_OLD = " run: |\n curl -sfL https://dl.chainloop.dev/cli/instal...
⚠️ Failed ai-config-no-secrets ai-coding-session-6ef5e9
  • Secret (generic-api-key) detected in session content [turn=1469, source=tool_result, line=10]: < checksum/secret-config: [CHAINLOOP_TRACE_REDACTED:generic-api-key]
  • Secret (generic-api-key) detected in session content [turn=1469, source=tool_result, line=12]: > checksum/secret-config: [CHAINLOOP_TRACE_REDACTED:generic-api-key]
  • Secret (generic-api-key) detected in session content [turn=2691, source=tool_result, line=13]: | ⚠️ Failed | ai-config-no-secrets | [ai-coding-session-6ef5e9](https://app.chainloop.dev/u/chainloop/projects/chainloop-platf...
  • Secret (generic-password) detected in session content [turn=1204, source=tool_result, line=6]: | ⚠️ Failed | ai-config-no-secrets | [ai-coding-session-6ef5e9](https://app.chainloop.dev/u/chainloop/projects/chainloop-platf...
  • Secret (generic-password) detected in session content [turn=1207, source=assistant-text, line=3]: The failing check is "Chainloop AI Policies": ai-config-no-secrets flags this session's trace (ai-coding-session-6ef5e9). The bot comment lists the same messages. Most of them are the [CHAINLOOP_...</li><li>Secret (generic-password) detected in session content [turn=1207, source=assistant-text, line=4]: - **Copies of the triage text:** my own report quotes the identifier [CHAINLOOP_TRACE_REDACTED:generic-password], and the CLI redacts it as a password.</li><li>Secret (generic-password) detected in session content [turn=1260, source=tool_result, line=13]: | ⚠️ Failed | [ai-config-no-secrets](https://docs.chainloop.dev/reference/policies#ai-config-no-secrets) | [ai-coding-session-6ef5e9](https://app.chainloop.dev/u/chainloop/projects/chainloop-platf...</li><li>Secret (generic-password) detected in session content [turn=1263, source=assistant-text, line=4]: - **Chainloop AI Policies:** the same ai-config-no-secretsfailure as before, from this session's own trace. The CLI redacts the Go identifier[CHAINLOOP_TRACE_REDACTED:generic-password] as a pass...</li><li>Secret (generic-password) detected in session content [turn=2691, source=tool_result, line=13]: | ⚠️ Failed | [ai-config-no-secrets](https://docs.chainloop.dev/reference/policies#ai-config-no-secrets) | [ai-coding-session-6ef5e9](https://app.chainloop.dev/u/chainloop/projects/chainloop-platf...</li><li>Secret (generic-password) detected in session content [turn=2710, source=assistant-text, line=18]: - ai-config-no-secrets: redaction placeholders, such as the [CHAINLOOP_TRACE_REDACTED:generic-password]identifier and the CAS download URL token, and the session reading its own violations. These...</li><li>Secret (generic-password) detected in session content [turn=395, source=user-message, line=12]: | G1: turn 44, tool_result (Read of a Go CLI file) | 1-6 (6) | A Go identifier, not a secret. The rule matchedRegistryPassword: [CHAINLOOP_TRACE_REDACTED:generic-password],(line 112) and took t...</li><li>Secret (generic-password) detected in session content [turn=403, source=assistant-text, line=10]: | The Go variable[CHAINLOOP_TRACE_REDACTED:generic-password]was taken as a password and replaced everywhere | 6 | False positive (the CLI redacts too much) | Chainloop repo: allowlist bare identif...</li><li>Secret (generic-password) detected in session content [turn=403, source=assistant-text, line=2]: - Thegeneric-passwordallowlist ininternal/redaction/betterleaks.toml:42-56covers dotted property access only, such ase.password. It does not cover bare identifiers such as [CHAINLOOP_TRACE...
  • Secret (generic-password) detected in session content [turn=403, source=assistant-text, line=3]: - redaction.go:580 uses strings.ReplaceAll without word boundaries, so it also changes longer names such as [CHAINLOOP_TRACE_REDACTED:generic-password]EnvVarName.
  • Secret (generic-password) detected in session content [turn=413, source=assistant-tool_use:Write, line=1]: {"content":"## Triage of policy violations in v1.128.1+next\n\nThis comment adds the failures of v1.128.1+next (58967a46-bf29-47c8-b15d-77950188b174). It records the findings only. It changes no cod...
  • Secret (generic-password) detected in session content [turn=423, source=assistant-text, line=9]: | ai-config-no-secrets (14) | 6 come from the CLI redacting the Go variable [CHAINLOOP_TRACE_REDACTED:generic-password]. 7 come from a Rego bug: the session read its own violation messages back. |...
  • Secret (generic-password) detected in session content [turn=442, source=tool_result, line=179]: 179 | Turn 44, Read of a Go CLI file | 6 | The Go identifier [CHAINLOOP_TRACE_REDACTED:generic-password] in RegistryPassword: [CHAINLOOP_TRACE_REDACTED:generic-password],. The CLI then replaced th...
  • Secret (generic-password) detected in session content [turn=442, source=tool_result, line=185]: 185 * Chainloop repository: in internal/redaction/betterleaks.toml:42-56, add a generic-password allowlist for bare code identifiers (for example [CHAINLOOP_TRACE_REDACTED:generic-password]). To...
  • Secret (jwt) detected in session content [turn=1204, source=tool_result, line=6]: | ⚠️ Failed | ai-config-no-secrets | [ai-coding-session-6ef5e9](https://app.chainloop.dev/u/chainloop/projects/chainloop-platf...
  • Secret (jwt) detected in session content [turn=1260, source=tool_result, line=13]: | ⚠️ Failed | ai-config-no-secrets | [ai-coding-session-6ef5e9](https://app.chainloop.dev/u/chainloop/projects/chainloop-platf...
  • … and 7 more — view all ↗
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-6ef5e9 -

Security Checks — ✅ 6 passing

✅ secret-scan

Status Policy Messages
✅ Passed secrets-detection -

✅ sast-scan

Status Policy Messages
✅ Passed owasp-top10-2025 -
✅ Passed sast -
✅ Passed cwe-top25 -
✅ Passed cwe-top26-40-cusp -

✅ iac-scan

Status Policy Messages
✅ Passed iac-misconfiguration -
Scans not applied (2)
Scan Reason
vulnerability-scan no manifest/lockfile changed
github-actions-scan no workflow files changed

View attestation ↗

Security context

✅ Nothing this change touches has a recorded security-fix history.

View in Chainloop ↗ · How this works ↗


Powered by Chainloop and Chainloop Trace

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

View guided diff | Re-trigger cubic

@jiparis
jiparis requested a review from a team October 28, 2026 18:20

@migmartri migmartri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't the point of the policy to fail if it's not been approved yet?

@jiparis jiparis closed this Oct 29, 2026
Sign up for free to 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.

2 participants