Repository navigation
feat(trace): report the generated line totals of a session - #3680
Conversation
Add ai_generated_lines_added and ai_generated_lines_removed to the code changes of the AI coding session evidence. They hold the lines that all the agent edits of the session added and removed, also the lines that never reached a commit (spec issue-3639, R-011, D-011). Assisted-by: Claude Code Signed-off-by: Jose I. Paris <jiparis@chainloop.dev> Chainloop-Trace-Sessions: d13fc871-d294-4c08-b1d4-e7bdcaef6969
PR validation — ✅ 3 passing
AI Session Checks — 🟢 90% · ✅ 0 failing
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| modified | ai | app/cli/internal/trace/attribution/enrich_test.go |
+55 / -0 |
| modified | ai | pkg/attestation/crafter/materials/aicodingsession/aicodingsession.go |
+16 / -10 |
| modified | ai | app/cli/internal/trace/e2e/checks.go |
+18 / -3 |
| modified | ai | internal/schemavalidators/internal_schemas/aicodingsession/ai-coding-session-0.1.schema.json |
+14 / -6 |
| modified | ai | app/cli/internal/trace/attribution/enrich.go |
+4 / -0 |
| modified | ai | app/cli/internal/trace/README.md |
+1 / -1 |
Policies (4)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-d13fc8 |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-d13fc8 |
- |
| ✅ Passed | ai-config-no-secrets |
ai-coding-session-d13fc8 |
- |
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-d13fc8 |
- |
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 |
Security context
✅ Nothing this change touches has a recorded security-fix history.
View in Chainloop ↗ · How this works ↗
Powered by Chainloop and Chainloop Trace
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Assisted-by: Claude Code Signed-off-by: Jose I. Paris <jiparis@chainloop.dev> Chainloop-Trace-Sessions: d13fc871-d294-4c08-b1d4-e7bdcaef6969
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Also note that the session line totals are raw diff totals when a commit cannot be read. Assisted-by: Claude Code Signed-off-by: Jose I. Paris <jiparis@chainloop.dev> Chainloop-Trace-Sessions: d13fc871-d294-4c08-b1d4-e7bdcaef6969
Chainloop Trace now reports, in the AI coding session evidence, the total lines that the agent edits of a session added and removed. The totals include the lines that never reached a commit. Two new fields in
code_changeshold them:ai_generated_lines_addedandai_generated_lines_removed. Compare them withai_lines_addedandai_lines_removedto see how much of the generated code the session kept.The CLI already keeps these counts in the trace state (spec issue-3639, R-011). This PR does the follow-up that D-011 and the Non-goal of the spec defer: it reports the totals in the evidence. The change is additive, and a platform that does not know the fields keeps working (R-009). A session with no commit still sends no evidence, so it reports no totals.
This prepares the "Generated" stage of the AI code lifecycle view (PFM-7302).
AI disclosure: Claude Code assisted with this change.